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.