saved_resource(4) 1.7 KB

1
  1. !function(e,n,t){var i={appId:"wx8fe524b6bb404c30",title:"CSDN-专业IT技术社区",desc:"CSDN-专业IT技术社区",link:location.href.split("#")[0],imgUrl:"https://g.csdnimg.cn/static/logo/logo-200.jpg",getToken:!1,isWeiXin:function(){return"micromessenger"==e.navigator.userAgent.toLowerCase().match(/MicroMessenger/i)},getConfig:function(e){var n=this;if(e||(e=n.appId),wx){var i="https://wcp.csdn.net/api/wechat/share/id/"+e;t.ajax({type:"get",async:!1,timeout:5e3,url:i,dataType:"json",success:function(n){if(200==n.code){n=n.data.sign;var t={debug:!1,appId:e||n.appId,timestamp:n.timestamp,nonceStr:n.nonceStr,signature:n.signature,jsApiList:["onMenuShareAppMessage","onMenuShareTimeline"]};wx.config(t)}},error:function(e,n,i){t.get("https://statistic.csdn.net/sharewx?error=wechatapi")}})}},onMenuShare:function(n){var t=this;wx.ready(function(){wx.onMenuShareTimeline({title:n.title||t.title,desc:n.desc||t.desc,link:n.link||t.link,imgUrl:n.imgUrl||t.imgUrl,success:function(n){e.location.href="https://www.csdn.net/apps/download/share.html"},error:function(e){}}),wx.onMenuShareAppMessage({title:n.title||t.title,desc:n.desc||t.desc,link:n.link||t.link,imgUrl:n.imgUrl||t.imgUrl,success:function(n){e.location.href="https://www.csdn.net/apps/download/share.html"},error:function(e){}}),wx.error(function(e){console.log(JSON.stringify(e))})})}};if(void 0===e.csdn&&(e.csdn={}),!jQuery)return!1;e.csdn.sharewx=i}(window,document,jQuery),jQuery(function(){if(document.getElementsByTagName("meta")["csdn-share-wx"]&&window.csdn.sharewx.isWeiXin()){var e={},n="";e=JSON.parse(document.getElementsByTagName("meta")["csdn-share-wx"].content),e.appId&&(n=e.appId),window.csdn.sharewx.getConfig(n),window.csdn.sharewx.onMenuShare(e)}});