rabin 7 yıl önce
ebeveyn
işleme
07cc3c4b27

+ 459 - 0
kissy/public/share/jweixin.js

@@ -0,0 +1,459 @@
+! function(a, b) {
+    "function" == typeof define && (define.amd || define.cmd) ? define(function() {
+        return b(a)
+    }) : b(a, !0)
+}(this, function(a, b) {
+    function c(b, c, d) {
+        a.WeixinJSBridge ? WeixinJSBridge.invoke(b, e(c), function(a) {
+            i(b, a, d)
+        }) : l(b, d)
+    }
+
+    function d(b, c, d) {
+        a.WeixinJSBridge ? WeixinJSBridge.on(b, function(a) {
+            d && d.trigger && d.trigger(a), i(b, a, c)
+        }) : d ? l(b, d) : l(b, c)
+    }
+
+    function e(a) {
+        return a = a || {}, a.appId = B.appId, a.verifyAppId = B.appId, a.verifySignType = "sha1", a.verifyTimestamp = B.timestamp + "", a.verifyNonceStr = B.nonceStr, a.verifySignature = B.signature, a
+    }
+
+    function f(a, b) {
+        return {
+            scope: b,
+            signType: "sha1",
+            timeStamp: a.timestamp + "",
+            nonceStr: a.nonceStr,
+            addrSign: a.addrSign
+        }
+    }
+
+    function g(a) {
+        return {
+            timeStamp: a.timestamp + "",
+            nonceStr: a.nonceStr,
+            "package": a.package,
+            paySign: a.paySign,
+            signType: "SHA1"
+        }
+    }
+
+    function i(a, b, c) {
+        var d, e, f;
+        switch (delete b.err_code, delete b.err_desc, delete b.err_detail, d = b.errMsg, d || (d = b.err_msg, delete b.err_msg, d = j(a, d, c), b.errMsg = d), c = c || {}, c._complete && (c._complete(b), delete c._complete), d = b.errMsg || "", B.debug && !c.isInnerInvoke && alert(JSON.stringify(b)), e = d.indexOf(":"), f = d.substring(e + 1)) {
+            case "ok":
+                c.success && c.success(b);
+                break;
+            case "cancel":
+                c.cancel && c.cancel(b);
+                break;
+            default:
+                c.fail && c.fail(b)
+        }
+        c.complete && c.complete(b)
+    }
+
+    function j(a, b) {
+        var d, e, f, g;
+        if (b) {
+            switch (d = b.indexOf(":"), a) {
+                case q.config:
+                    e = "config";
+                    break;
+                case q.openProductSpecificView:
+                    e = "openProductSpecificView";
+                    break;
+                default:
+                    e = b.substring(0, d), e = e.replace(/_/g, " "), e = e.replace(/\b\w+\b/g, function(a) {
+                        return a.substring(0, 1).toUpperCase() + a.substring(1)
+                    }), e = e.substring(0, 1).toLowerCase() + e.substring(1), e = e.replace(/ /g, ""), -1 != e.indexOf("Wcpay") && (e = e.replace("Wcpay", "WCPay")), f = r[e], f && (e = f)
+            }
+            g = b.substring(d + 1), "confirm" == g && (g = "ok"), -1 != g.indexOf("failed_") && (g = g.substring(7)), -1 != g.indexOf("fail_") && (g = g.substring(5)), g = g.replace(/_/g, " "), g = g.toLowerCase(), ("access denied" == g || "no permission to execute" == g) && (g = "permission denied"), "config" == e && "function not exist" == g && (g = "ok"), b = e + ":" + g
+        }
+        return b
+    }
+
+    function k(a) {
+        var b, c, d, e;
+        if (a) {
+            for (b = 0, c = a.length; c > b; ++b) d = a[b], e = q[d], e && (a[b] = e);
+            return a
+        }
+    }
+
+    function l(a, b) {
+        if (B.debug && !b.isInnerInvoke) {
+            var c = r[a];
+            c && (a = c), b && b._complete && delete b._complete, console.log('"' + a + '",', b || "")
+        }
+    }
+
+    function m() {
+        if (!("6.0.2" > y)) {
+            var b = new Image;
+            A.appId = B.appId, A.initTime = z.initEndTime - z.initStartTime, A.preVerifyTime = z.preVerifyEndTime - z.preVerifyStartTime, E.getNetworkType({
+                isInnerInvoke: !0,
+                success: function(a) {
+                    A.networkType = a.networkType;
+                    var c = "https://open.weixin.qq.com/sdk/report?v=" + A.version + "&o=" + A.isPreVerifyOk + "&s=" + A.systemType + "&c=" + A.clientVersion + "&a=" + A.appId + "&n=" + A.networkType + "&i=" + A.initTime + "&p=" + A.preVerifyTime + "&u=" + A.url;
+                    b.src = c
+                }
+            })
+        }
+    }
+
+    function n() {
+        return (new Date).getTime()
+    }
+
+    function o(b) {
+        v && (a.WeixinJSBridge ? b() : s.addEventListener && s.addEventListener("WeixinJSBridgeReady", b, !1))
+    }
+
+    function p() {
+        E.invoke || (E.invoke = function(b, c, d) {
+            a.WeixinJSBridge && WeixinJSBridge.invoke(b, e(c), d)
+        }, E.on = function(b, c) {
+            a.WeixinJSBridge && WeixinJSBridge.on(b, c)
+        })
+    }
+    var q, r, s, t, u, v, w, x, y, z, A, B, C, D, E;
+    if (!a.jWeixin) return q = {
+        config: "preVerifyJSAPI",
+        onMenuShareTimeline: "menu:share:timeline",
+        onMenuShareAppMessage: "menu:share:appmessage",
+        onMenuShareQQ: "menu:share:qq",
+        onMenuShareWeibo: "menu:share:weiboApp",
+        previewImage: "imagePreview",
+        getLocation: "geoLocation",
+        openProductSpecificView: "openProductViewWithPid",
+        addCard: "batchAddCard",
+        openCard: "batchViewCard",
+        chooseWXPay: "getBrandWCPayRequest"
+    }, r = function() {
+        var b, a = {};
+        for (b in q) a[q[b]] = b;
+        return a
+    }(), s = a.document, t = s.title, u = navigator.userAgent.toLowerCase(), v = -1 != u.indexOf("micromessenger"), w = -1 != u.indexOf("android"), x = -1 != u.indexOf("iphone") || -1 != u.indexOf("ipad"), y = function() {
+        var a = u.match(/micromessenger\/(\d+\.\d+\.\d+)/) || u.match(/micromessenger\/(\d+\.\d+)/);
+        return a ? a[1] : ""
+    }(), z = {
+        initStartTime: n(),
+        initEndTime: 0,
+        preVerifyStartTime: 0,
+        preVerifyEndTime: 0
+    }, A = {
+        version: 1,
+        appId: "",
+        initTime: 0,
+        preVerifyTime: 0,
+        networkType: "",
+        isPreVerifyOk: 1,
+        systemType: x ? 1 : w ? 2 : -1,
+        clientVersion: y,
+        url: encodeURIComponent(location.href)
+    }, B = {}, C = {
+        _completes: []
+    }, D = {
+        state: 0,
+        res: {}
+    }, o(function() {
+        z.initEndTime = n()
+    }), E = {
+        config: function(a) {
+            B = a, l("config", a), o(function() {
+                c(q.config, {
+                    verifyJsApiList: k(B.jsApiList)
+                }, function() {
+                    C._complete = function(a) {
+                        z.preVerifyEndTime = n(), D.state = 1, D.res = a
+                    }, C.success = function() {
+                        A.isPreVerifyOk = 0
+                    }, C.fail = function(a) {
+                        C._fail ? C._fail(a) : D.state = -1
+                    };
+                    var a = C._completes;
+                    return a.push(function() {
+                        B.debug || m()
+                    }), C.complete = function(b) {
+                        for (var c = 0, d = a.length; d > c; ++c) a[c](b);
+                        C._completes = []
+                    }, C
+                }()), z.preVerifyStartTime = n()
+            }), B.beta && p()
+        },
+        ready: function(a) {
+            0 != D.state ? a() : (C._completes.push(a), !v && B.debug && a())
+        },
+        error: function(a) {
+            "6.0.2" > y || (-1 == D.state ? a(D.res) : C._fail = a)
+        },
+        checkJsApi: function(a) {
+            var b = function(a) {
+                var c, d, b = a.checkResult;
+                for (c in b) d = r[c], d && (b[d] = b[c], delete b[c]);
+                return a
+            };
+            c("checkJsApi", {
+                jsApiList: k(a.jsApiList)
+            }, function() {
+                return a._complete = function(a) {
+                    if (w) {
+                        var c = a.checkResult;
+                        c && (a.checkResult = JSON.parse(c))
+                    }
+                    a = b(a)
+                }, a
+            }())
+        },
+        onMenuShareTimeline: function(a) {
+            d(q.onMenuShareTimeline, {
+                complete: function() {
+                    c("shareTimeline", {
+                        title: a.title || t,
+                        desc: a.title || t,
+                        img_url: a.imgUrl,
+                        link: a.link || location.href
+                    }, a)
+                }
+            }, a)
+        },
+        onMenuShareAppMessage: function(a) {
+            d(q.onMenuShareAppMessage, {
+                complete: function() {
+                    c("sendAppMessage", {
+                        title: a.title || t,
+                        desc: a.desc || "",
+                        link: a.link || location.href,
+                        img_url: a.imgUrl,
+                        type: a.type || "link",
+                        data_url: a.dataUrl || ""
+                    }, a)
+                }
+            }, a)
+        },
+        onMenuShareQQ: function(a) {
+            d(q.onMenuShareQQ, {
+                complete: function() {
+                    c("shareQQ", {
+                        title: a.title || t,
+                        desc: a.desc || "",
+                        img_url: a.imgUrl,
+                        link: a.link || location.href
+                    }, a)
+                }
+            }, a)
+        },
+        onMenuShareWeibo: function(a) {
+            d(q.onMenuShareWeibo, {
+                complete: function() {
+                    c("shareWeiboApp", {
+                        title: a.title || t,
+                        desc: a.desc || "",
+                        img_url: a.imgUrl,
+                        link: a.link || location.href
+                    }, a)
+                }
+            }, a)
+        },
+        startRecord: function(a) {
+            c("startRecord", {}, a)
+        },
+        stopRecord: function(a) {
+            c("stopRecord", {}, a)
+        },
+        onVoiceRecordEnd: function(a) {
+            d("onVoiceRecordEnd", a)
+        },
+        playVoice: function(a) {
+            c("playVoice", {
+                localId: a.localId
+            }, a)
+        },
+        pauseVoice: function(a) {
+            c("pauseVoice", {
+                localId: a.localId
+            }, a)
+        },
+        stopVoice: function(a) {
+            c("stopVoice", {
+                localId: a.localId
+            }, a)
+        },
+        onVoicePlayEnd: function(a) {
+            d("onVoicePlayEnd", a)
+        },
+        uploadVoice: function(a) {
+            c("uploadVoice", {
+                localId: a.localId,
+                isShowProgressTips: a.isShowProgressTips || 1
+            }, a)
+        },
+        downloadVoice: function(a) {
+            c("downloadVoice", {
+                serverId: a.serverId,
+                isShowProgressTips: a.isShowProgressTips || 1
+            }, a)
+        },
+        translateVoice: function(a) {
+            c("translateVoice", {
+                localId: a.localId,
+                isShowProgressTips: a.isShowProgressTips || 1
+            }, a)
+        },
+        chooseImage: function(a) {
+            c("chooseImage", {
+                scene: "1|2"
+            }, function() {
+                return a._complete = function(a) {
+                    if (w) {
+                        var b = a.localIds;
+                        b && (a.localIds = JSON.parse(b))
+                    }
+                }, a
+            }())
+        },
+        previewImage: function(a) {
+            c(q.previewImage, {
+                current: a.current,
+                urls: a.urls
+            }, a)
+        },
+        uploadImage: function(a) {
+            c("uploadImage", {
+                localId: a.localId,
+                isShowProgressTips: a.isShowProgressTips || 1
+            }, a)
+        },
+        downloadImage: function(a) {
+            c("downloadImage", {
+                serverId: a.serverId,
+                isShowProgressTips: a.isShowProgressTips || 1
+            }, a)
+        },
+        getNetworkType: function(a) {
+            var b = function(a) {
+                var c, d, e, b = a.errMsg;
+                if (a.errMsg = "getNetworkType:ok", c = a.subtype, delete a.subtype, c) a.networkType = c;
+                else switch (d = b.indexOf(":"), e = b.substring(d + 1)) {
+                    case "fail":
+                    case "permission denied":
+                    case "localparameters":
+                        a.errMsg = "getNetworkType:fail";
+                        break;
+                    default:
+                        a.networkType = e
+                }
+                return a
+            };
+            c("getNetworkType", {}, function() {
+                return a._complete = function(a) {
+                    a = b(a)
+                }, a
+            }())
+        },
+        openLocation: function(a) {
+            c("openLocation", {
+                latitude: a.latitude,
+                longitude: a.longitude,
+                name: a.name || "",
+                address: a.address || "",
+                scale: a.scale || 28,
+                infoUrl: a.infoUrl || ""
+            }, a)
+        },
+        getLocation: function(a) {
+            c(q.getLocation, f(a, "jsapi_location"), a)
+        },
+        hideOptionMenu: function(a) {
+            c("hideOptionMenu", {}, a)
+        },
+        showOptionMenu: function(a) {
+            c("showOptionMenu", {}, a)
+        },
+        closeWindow: function(a) {
+            c("closeWindow", {
+                immediate_close: a && a.immediateClose || 0
+            }, a)
+        },
+        hideMenuItems: function(a) {
+            c("hideMenuItems", {
+                menuList: a.menuList
+            }, a)
+        },
+        showMenuItems: function(a) {
+            c("showMenuItems", {
+                menuList: a.menuList
+            }, a)
+        },
+        hideAllNonBaseMenuItem: function(a) {
+            c("hideAllNonBaseMenuItem", {}, a)
+        },
+        showAllNonBaseMenuItem: function(a) {
+            c("showAllNonBaseMenuItem", {}, a)
+        },
+        scanQRCode: function(a) {
+            c("scanQRCode", {
+                desc: a.desc,
+                needResult: a.needResult || 0,
+                scanType: a.scanType || ["qrCode", "barCode"]
+            }, a)
+        },
+        openProductSpecificView: function(a) {
+            c(q.openProductSpecificView, {
+                pid: a.productId,
+                view_type: a.viewType || 0
+            }, a)
+        },
+        addCard: function(a) {
+            var e, f, g, h, b = a.cardList,
+                d = [];
+            for (e = 0, f = b.length; f > e; ++e) g = b[e], h = {
+                card_id: g.cardId,
+                card_ext: g.cardExt
+            }, d.push(h);
+            c(q.addCard, {
+                card_list: d
+            }, function() {
+                return a._complete = function(a) {
+                    var c, d, e, b = a.card_list;
+                    if (b) {
+                        for (b = JSON.parse(b), c = 0, d = b.length; d > c; ++c) e = b[c], e.cardId = e.card_id, e.cardExt = e.card_ext, e.isSuccess = e.is_succ ? !0 : !1, delete e.card_id, delete e.card_ext, delete e.is_succ;
+                        a.cardList = b, delete a.card_list
+                    }
+                }, a
+            }())
+        },
+        chooseCard: function(a) {
+            c("chooseCard", {
+                app_id: B.appId,
+                location_id: a.shopId || "",
+                sign_type: "SHA1",
+                card_id: a.cardId || "",
+                card_type: a.cardType || "",
+                card_sign: a.cardSign,
+                time_stamp: a.timestamp + "",
+                nonce_str: a.nonceStr
+            }, function() {
+                return a._complete = function(a) {
+                    a.cardList = a.choose_card_info, delete a.choose_card_info
+                }, a
+            }())
+        },
+        openCard: function(a) {
+            var e, f, g, h, b = a.cardList,
+                d = [];
+            for (e = 0, f = b.length; f > e; ++e) g = b[e], h = {
+                card_id: g.cardId,
+                code: g.code
+            }, d.push(h);
+            c(q.openCard, {
+                card_list: d
+            }, a)
+        },
+        chooseWXPay: function(a) {
+            c(q.chooseWXPay, g(a), a)
+        }
+    }, b && (a.wx = a.jWeixin = E), E
+});

+ 289 - 0
kissy/public/share/mshare.js

@@ -0,0 +1,289 @@
+;(function($, window, document, undefined) {
+    function regist(mName, module) {
+        if (typeof window.brickjs === "undefined") {
+            window.brickjs = {};
+        }
+        brickjs[mName] = module;
+    }
+;/** 
+ * @file 微信,微博分享
+ * @author jie.qin@condenast.com.cn
+ * @version 0.1.0
+ * @requires http://js.selfimg.com.cn/jquery/jquery-1.7.1.min.js|http://js.selfimg.com.cn/gallery/zepto/1.1.4/zepto.min.js
+ * @requires http://js.selfimg.com.cn/lib/jweixin-1.0.0.js
+ * @example <a href="../mshare/examples/demo.html">demo.html</a>
+ * @see http://js.selfimg.com.cn/brickjs/mshare/0.1.0/mshare.min.js
+ */
+var isWeixin = navigator.userAgent.toLowerCase().indexOf("micromessenger") > -1;
+//isWeixin = true;
+/** 
+ * 微信,微博分享定义组件。(微博分享功能,可以在按钮上配置属性实现动态替换分享属性,属性名称:data-desc,data-sUrl,data-imgUrl)
+ * @class
+ * @author jie.qin@condenast.com.cn
+ * @version 0.1.0
+ * @requires http://js.selfimg.com.cn/jquery/jquery-1.7.1.min.js|http://js.selfimg.com.cn/gallery/zepto/1.1.4/zepto.min.js
+ * @requires http://js.selfimg.com.cn/lib/jweixin-1.0.0.js
+ * @example <a href="../mshare/examples/demo.html">demo.html</a>
+ * @see http://js.selfimg.com.cn/brickjs/mshare/0.1.0/mshare.min.js
+ * @param {Object} cfgs 配置项
+ * @param {String} [cfgs.site=""] 1、vogue 2、self 3、gq 4、adstyle 5、cnt 6、subscribe (必须,用于微信获得签名和统计使用)
+ * @param {String} [cfgs.catalog=""] 栏目id(仅对微博有效)
+ * @param {String} [cfgs.sUrl=window.location.href] 分享地址url
+ * @param {String} [cfgs.title=document.title] 分享标题(仅对微信有效,微博分享使用desc)
+ * @param {String} [cfgs.desc=""] 分享说明
+ * @param {String} [cfgs.imgUrl=""] 分享时携带图片地址
+ * @param {String} [cfgs.ralateUid=""] (仅对微博有效)
+ * @param {String} [cfgs.timelineCallback] 分享到朋友圈回调(仅对微信有效)
+ * @param {String} [cfgs.sendMessageCallback] 发送给朋友回调(仅对微信有效)
+ * @param {String} [cfgs.appKey] 分享到微信和微博对应的appkey
+ * @param {String} [cfgs.appKey.tsina] 分享到微博对应的appkey
+ * @param {String} [cfgs.wxGuide] 分享到微信引导(仅对微信有效)
+ * @param {String} [cfgs.wxGuide.tpl] 分享到微信引导弹层自定义模板
+ * @param {String} [cfgs.wxGuide.imgUrl] 分享到微信引导图片地址
+ * @param {String} [cfgs.wxGuide.width] 分享到微信引导图片宽度
+ * @param {String} [cfgs.wxGuide.height] 分享到微信引导图片高度
+ * @param {Object} [cfgs.wxGuide.style={top:0,right:0}] 分享到微信引导弹层样式
+ * @param {Object} selector 绑定的对象
+ */
+function MShare(cfgs, selector) {
+    this._cfgs = {
+        site: "",
+        catalog: "",
+        sUrl: window.location.href,
+        title: document.title,
+        imgUrl: "",
+        desc: "",
+        appKey: "",
+        ralateUid: "",
+        source_id:"",
+        source_table :"",
+        timelineCallback: function() {},
+        sendMessageCallback: function() {},
+        shareQQCallback: function() {},
+        wxGuide: {
+            tpl: '',
+            imgUrl: 'http://css.selfimg.com.cn/vogue/mdiscovery/images/weixin-guide.png',
+            width: 295,
+            height: 273,
+            style: {
+                right: 0,
+                top: 0
+            }
+        }
+    };
+    this.weixinSigned = 0;
+    this.trigger = $(selector);
+    this._baseUrl = "/collect.";
+    this._tsinaParam = "get?platform=tsina&title={title}&url={url}&pic={pic}&site={site}&source_id={source_id}&source_table={source_table}&ralateUid={ralateUid}&appkey={appkey}&hash={hash}";
+    this._init(cfgs, selector);
+    this._reflux();
+}
+MShare.prototype = {
+    _init: function(cfgs, selector) {
+        var self = this;
+        $.extend(true, this._cfgs, cfgs)
+
+        if (selector) {
+            $(selector).on('click', function() {
+                if (isWeixin) {
+                    self._weixinGuide();
+                } else {
+                    self._weiboShare($(this));
+                }
+            })
+        }
+        if (isWeixin) {
+            this.weixinInit();
+        }
+    },
+    _weixinGuide: function() {
+        var cfg = this._cfgs,
+            weixinCfg = cfg.wxGuide,
+            defImg = weixinCfg.imgUrl,
+            tpl = weixinCfg.tpl || '<div id="weixin_guide" style="position: fixed;background:url(http://css.selfimg.com.cn/cnt/mobile/images/blk80.png) repeat;left:0;top:0;right:0;bottom:0;z-index:1000;"><img src="' + defImg + '" style="position: absolute;z-index:100;" width="' + weixinCfg.width + '" height="' + weixinCfg.height + '"/></div>';
+
+        $('#weixin_guide').remove();
+        $(tpl).attr('id', 'weixin_guide').appendTo($('body'));
+
+        $('#weixin_guide img').css(weixinCfg.style || {})
+        setTimeout(function() {
+            $('#weixin_guide').click(function() {
+                $(this).remove();
+            })
+        }, 300)
+    },
+    /**
+     * 对微信分享自定义配置
+     * @param {Object} cfgs 配置项
+     * @param {String} [cfgs.site=""] 1、vogue 2、self 3、gq 4、adstyle 5、cnt 6、subscribe(必须,用于微信获得签名和统计使用)
+     * @param {String} [cfgs.sUrl=window.location.href] 分享地址url
+     * @param {String} [cfgs.title=document.title] 分享标题
+     * @param {String} [cfgs.desc=""] 分享说明
+     * @param {String} [cfgs.imgUrl=""] 分享时携带图片地址
+     * @param {String} [cfgs.timelineCallback] 分享到朋友圈回调
+     * @param {String} [cfgs.sendMessageCallback] 发送给朋友回调
+     * @param {String} [cfgs.shareQQCallback] 发送到QQ回调
+     */
+    weixinInit: function(cfgs) {
+        var self = this,
+            wxCfgs;
+        cfgs && $.extend(true, this._cfgs, cfgs);
+
+        wxCfgs = {
+            "site": this._cfgs.website,
+            "img_url": this._cfgs.imgUrl || "",
+            "link": this._cfgs.sUrl || location.href,
+            "desc": this._cfgs.desc || "",
+            "title": this._cfgs.title || document.title,
+            timelineCallback: this._cfgs.timelineCallback,
+            sendMessageCallback: this._cfgs.sendMessageCallback,
+            shareQQCallback: this._cfgs.shareQQCallback
+        }
+
+        $.getJSON(VG.conf.root_domain + '?c=WeixinJsSDK&a=AjaxConfigData&site=' + wxCfgs.site + '&thisPageUrl=' + encodeURIComponent(location.href) + '&callback=?', function(d) {
+            var d = d.msg;
+            if (d) {
+                wx.config({
+                    //debug:true,
+                    appId: d.appId,
+                    timestamp: d.timestamp,
+                    nonceStr: d.nonceStr,
+                    signature: d.signature,
+                    jsApiList: [
+                        'onMenuShareTimeline',
+                        'onMenuShareAppMessage',
+                        'onMenuShareQQ'
+                    ]
+                });
+                wx.ready(function() {
+                    wx.onMenuShareAppMessage({
+                        title: wxCfgs.title,
+                        desc: wxCfgs.desc,
+                        link: wxCfgs.link,
+                        imgUrl: wxCfgs.img_url,
+                        success: function(res) {
+                            wxCfgs.sendMessageCallback('success', res)
+                            self._shareLog(0, 1);
+                        },
+                        cancel: function(res) {
+                            wxCfgs.sendMessageCallback('cancel', res)
+                            self._shareLog(0, 2);
+                        },
+                        fail: function(res) {
+                            wxCfgs.sendMessageCallback('fail', res)
+                            self._shareLog(0, 0);
+                        }
+                    });
+                    wx.onMenuShareTimeline({
+                        title: wxCfgs.title,
+                        link: wxCfgs.link,
+                        imgUrl: wxCfgs.img_url,
+                        success: function(res) {
+                            wxCfgs.timelineCallback('success', res)
+                            self._shareLog(1, 1);
+                        },
+                        cancel: function(res) {
+                            wxCfgs.timelineCallback('cancel', res)
+                            self._shareLog(1, 2);
+                        },
+                        fail: function(res) {
+                            wxCfgs.timelineCallback('fail', res)
+                            self._shareLog(1, 0);
+                        }
+                    });
+                    wx.onMenuShareQQ({
+                        title: wxCfgs.title,
+                        link: wxCfgs.link,
+                        imgUrl: wxCfgs.img_url,
+                        success: function(res) {
+                            wxCfgs.shareQQCallback('success', res)
+                            self._shareLog(2, 1);
+                        },
+                        cancel: function(res) {
+                            wxCfgs.shareQQCallback('cancel', res)
+                            self._shareLog(2, 2);
+                        },
+                        fail: function(res) {
+                            wxCfgs.shareQQCallback('fail', res)
+                            self._shareLog(2, 0);
+                        }
+                    });
+                });
+            }
+        })
+        
+    },
+    /**
+     * 重置分享自定义配置
+     * @param {Object} cfg 自定义配置对象
+     * @param {String} [cfg.sUrl=window.location.href] 分享地址url
+     * @param {String} [cfg.title=document.title] 分享标题
+     * @param {String} [cfg.desc=""] 分享说明
+     * @param {String} [cfg.imgUrl] 分享时携带图片地址
+     */
+    reset: function(cfg) {
+        var self = this;
+        if (!isWeixin) {
+            cfg.sUrl && self.trigger.data('sUrl', cfg.sUrl);
+            cfg.desc && self.trigger.data('desc', cfg.desc);
+            cfg.imgUrl && self.trigger.data("imgUrl", cfg.imgUrl);
+        } else {
+            this.weixinInit({
+                sUrl: cfg.sUrl || self._cfgs.sUrl,
+                desc: cfg.desc || self._cfgs.desc,
+                imgUrl: cfg.imgUrl || self._cfgs.imgUrl,
+                title: cfg.title || self._cfgs.title
+            });
+        }
+
+    },
+    _reflux: function() {
+        var refer = document.referrer,
+            url = document.location.href,
+            param = location.search.substr(1),
+            ua = navigator.userAgent;
+
+        if (param.indexOf("tsina-") > -1 || param.indexOf("timeline") > -1 || param.indexOf("singlemessage") > -1 || param.indexOf("groupmessage") > -1) {
+            $.getJSON(this._baseUrl + "reflux?" + "callback=?" + "&url=" + encodeURIComponent(url) + '&ua=' + ua + '&param=' + encodeURIComponent(param));
+        }
+    },
+    _shareLog: function(actType, actResult) {
+        var site = this._cfgs.website;
+        //$.get('http://application.self.com.cn/wxapi/interface/sharecollect/collectdata?mp=' + site + '&url=' + encodeURIComponent(location.href) + '&ac=' + actType + '&sc=' + actResult + '&ua=' + encodeURIComponent(navigator.userAgent))
+    },
+    _weiboShare: function(trigger) {
+        var self = this;
+        var cfg = this._cfgs,
+            params = {
+                title: cfg.desc,
+                url: cfg.sUrl,
+                pic: cfg.imgUrl,
+                site: cfg.site,
+                cat: cfg.catalog,
+                source_id: cfg.source_id,
+                source_table: cfg.source_table,
+                ralateUid: cfg.ralateUid,
+                appkey: cfg.appKey.tsina
+            },
+            tgUrl = trigger.data('sUrl'),
+            tgTitle = trigger.data('desc'),
+            tgPic = trigger.data("imgUrl");
+
+        params.title = encodeURIComponent(tgTitle ? tgTitle : params.title);
+        params.url = encodeURIComponent(tgUrl ? tgUrl : params.url);
+        params.pic = encodeURIComponent(tgPic ? tgPic : params.pic);
+
+        var cmdUrl = this._baseUrl + self._formatUri(this._tsinaParam, params);
+        window.open(cmdUrl);
+    },
+    _formatUri: function(uri, params) {
+        var reg, uri = uri;
+        for (var k in params) {
+            reg = new RegExp("{" + k + "}", "g");
+            uri = uri.replace(reg, params[k]);
+        }
+        return uri;
+    }
+}
+;regist("MShare",MShare);
+})((typeof Zepto !== 'undefined' ? Zepto : jQuery), window, document)

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1 - 0
kissy/public/share/zepto.min.js


+ 3 - 3
tm/template_dir/header.html

@@ -34,7 +34,7 @@
 		, url: '<{$web_cfg.url}>'
 	};
 </script>
-<script src="http://assets.sg.com.cn/core/zepto.min.js"></script>
-<script src="http://assets.sg.com.cn/core/share/js/jweixin.js"></script>
-<script src="http://assets.sg.com.cn/core/share/js/mshare.js"></script>
+<script src="<{$web_cfg.cdn}>/public/share/zepto.min.js"></script>
+<script src="<{$web_cfg.cdn}>/public/share/jweixin.js"></script>
+<script src="<{$web_cfg.cdn}>/public/share/mshare.js"></script>
 <body id="body">

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor