PageSourceSearch

https://www.zgwhfe.com/content/_common/base/js/power-weixinshare.j…X5H2_jE-DjZHVC4tS4FOe_vVTit9zpdkFNxfI5hgxZI

js zgwhfe.com collected 2026-10-06 19:07:12 UTC 4,967 bytes, 152 lines download raw bytes

1(function ($) {
2    var appId,
3        timeStamp,
4        nonceStr,
5        signature,
6        imgUrl,
7        title,
8        desc;
9
10    if (isWeiXinBrowser() && checkWeixinShareEnable()) {
11        if (typeof window.WeixinJSBridge == "undefined") {
12            $(document).on('WeixinJSBridgeReady', function () {
13                getWeixinShareParameters();
14            });
15        }
16        else {
17            getWeixinShareParameters();
18        }
19    }
20
21    function setImgUrl() {
22        imgUrl = $('meta[name="Image"]').attr("content");
23    }
24
25    function setTitle() {
26        title = $('meta[name="ArticleTitle"]').attr('content') || $('meta[name="ColumnName"]').attr('content');
27    }
28
29    function setDesc() {
30        desc = $('meta[name="Description"]').attr('content');
31    }
32
33    function getWeixinShareParameters() {
34        setImgUrl();
35        setTitle();
36        setDesc();
37        if (imgUrl || title || desc) {
38            var currentsiteinfoData = $("#currentsiteinfo").data();
39            var siteHomeUrl = currentsiteinfoData.siteajaxrequestprefix;
40            $.ajax({
41                type: "get",
42                url: siteHomeUrl + "weixin/home/AjaxGetWeixinShareParameters",
43                dataType: 'json',
44                async: false,
45                data: { currentUrl: getSharedUrl() },
46                success: function (data) {
47                    if (data !== false) {
48                        appId = data.appId;
49                        timeStamp = data.timestamp;
50                        nonceStr = data.nonceStr;
51                        signature = data.signature;
52                        setWxConfig();
53                    }
54                }
55            });
56        }
57    }
58
59    function setWxConfig() {
60        wx.config({
61            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
62            appId: appId, // 必填,公众号的唯一标识
63            timestamp: timeStamp, // 必填,生成签名的时间戳
64            nonceStr: nonceStr, // 必填,生成签名的随机串
65            signature: signature, // 必填,签名
66            jsApiList: [
67                'checkJsApi',
68                'updateAppMessageShareData',
69                'updateTimelineShareData',
70                'onMenuShareTimeline',
71                'onMenuShareAppMessage',
72                'onMenuShareQQ',
73                'onMenuShareWeibo',
74                'hideMenuItems',
75                'showMenuItems',
76                'hideAllNonBaseMenuItem',
77                'showAllNonBaseMenuItem',
78                'translateVoice',
79                'startRecord',
80                'stopRecord',
81                'onRecordEnd',
82                'playVoice',
83                'pauseVoice',
84                'stopVoice',
85                'uploadVoice',
86                'downloadVoice',
87                'chooseImage',
88                'previewImage',
89                'uploadImage',
90                'downloadImage',
91                'getNetworkType',
92                'openLocation',
93                'getLocation',
94                'hideOptionMenu',
95                'showOptionMenu',
96                'closeWindow',
97                'scanQRCode',
98                'chooseWXPay',
99                'openProductSpecificView',
100                'addCard',
101                'chooseCard',
102                'openCard'
103            ]
104        });
105
106        wx.error(function (res) {
107            console.log(res);
108            console.warn('微信验证失败,分享功能无法正常使用!');
109        });
110
111        wx.ready(function () {
112            wx.updateAppMessageShareData({
113                title: title,
114                desc: desc,
115                imgUrl: imgUrl,
116                link: window.location.href
117            });
118
119            wx.updateTimelineShareData({
120                title: title,
121                desc: desc,
122                imgUrl: imgUrl,
123                link: window.location.href
124            });
125        });
126    }
127
128    function isWeiXinBrowser() {
129        var userAgent = window.navigator.userAgent.toLowerCase();
130        if (userAgent.match(/MicroMessenger/i) == 'micromessenger') {
131            return true;
132        } else {
133            return false;
134        }
135    }
136    function checkWeixinShareEnable() {
137        var siteId = $("meta[name=SiteId]").attr("content");
138        var weixinShareItem = window.POWER_WEIXINSHARE_CONFIG && window.POWER_WEIXINSHARE_CONFIG.WeixinShareItems && window.POWER_WEIXINSHARE_CONFIG.WeixinShareItems[siteId];
139        return weixinShareItem;
140    }
141
142    function getSharedUrl() {
143        var hrefUrl = location.href;
144        var query = location.search;
145        if (query) {
146            if (query.indexOf('SessionVerify=') > -1) {
147                return location.origin + location.pathname;
148            }
149        }
150        return hrefUrl;
151    }
152})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.