Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
sdi_js_full_v2.js 28.06 KB
Copy Edit Raw Blame History
sallai authored 2021-05-06 15:47 . first commit
var _sdi=window._sdi=window._sdi||{};if("undefined"==typeof sdi_aid||!(sdi_aid>0)){var sdijs=document.getElementById("sdi_js");window.sdi_aid=sdijs.getAttribute("aid")}if("undefined"==typeof sdi_host)var sdi_host="//sdi.3g.qq.com";if(function(){"use strict";function e(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var i=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==i.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var t=(document,localStorage),n=location.href,i=_sdi;i.c=i.constant={p_sf:"sdi_from",p_sc:"sdi_sc",p_wf:"from",c_uid:"sdi_uid"},i.v=i.variable={env:0,debug:n.indexOf("debug=true")>0,dev:n.indexOf("dev=true")>0,assignNative:!0,ck_from:i.c.p_sf+"_"+sdi_aid,app:0},i.user={init:function(e){this.args=e||{},this.pick("imei"),this.pick("guid"),this.pick("idfa"),this.pick("gjid"),this.pick("phone"),this.pick("email"),this.pick("qq_openid"),this.pick("qq_unionid"),this.pick("wx_openid"),this.pick("wx_unionid"),this.pick("network"),this.pick("headimg")},pick:function(e){this[e]=void 0===this.args[e]?this[e]||"":this.args[e]}};var o=i.c,a=i.v,r=_sdi.v.debug;i.analytics||(i.analytics={}),i.analytics.report=function(e,t,n){"function"==typeof t&&(n=t,t={});var i,o="";for(i in t)o+="&"+i+"="+t[i];o+="&r="+parseInt(99999*Math.random()+1);var a=new Image;e+=(e.indexOf("?")>0?"":"?")+o,a.src=e,r&&alert(o+" send"),a.onload=function(){r&&alert(o+" success"),"function"==typeof n&&n()}},i.analytics.stat=function(e,n){void 0!=e&&"[object Object]"==e||(e={}),e.aid=sdi_aid,e.imei=i.user.imei,e.guid=i.user.guid,e.channel=0;var r=null;t&&(r=t.getItem(a.ck_from)),r&&(e.channel=r);var s=null;if(t&&(s=t.getItem(o.c_uid)),!s){s=i.tool.uuid();try{t.setItem(o.c_uid,s)}catch(e){console.log("localStorage set fail!")}}e.uid=s,i.analytics.report(sdi_host+"/stat",e,n);var c=(e.ptype+"").split(","),u=(e.stype+"").split(","),l=-1;c.indexOf("1")>=0?l=c.indexOf("1"):c.indexOf("7")>=0?l=c.indexOf("7"):c.indexOf("3")>=0&&(l=c.indexOf("3")),l>=0&&_sdi.api.behavior({ptype:c[l],stype:u[l]||0})},i.stat=function(e,t){i.analytics.stat(e,t)},i.statPlay=i.stat,i.analytics.doPV=function(e){var r=i.tool.url.getParam,s=i.tool.getEnv(),c=a.app,u=r(n,o.p_sf);(""==u||!i.tool.isInt(u))&&(u=0);var l=null;t&&(l=t.getItem(a.ck_from)),l=l>0?l:u,l!=u&&(0==u?u=l:l=u);var d=r(n,o.p_sc);if((""==d||!i.tool.isInt(d))&&(d=0),0==u){if(2==s){var p=r(n,o.p_wf);switch(p){case"timeline":0==d&&(d=1),u=1;break;case"singlemessage":0==d&&(d=1),u=2;break;case"groupmessage":0==d&&(d=1),u=3}}else 3==s?u=4:4==s&&(u=5);l=u}try{t.setItem(a.ck_from,u)}catch(e){console.log("localStorage set fail!")}var f={};f.ptype="1,108",f.stype=u+","+c,d>0&&(f.ptype+=",5",f.stype+=","+d),i.analytics.stat(f,e)},i.tool||(i.tool={}),i.tool.uuid=function(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+e()+e()+e()},i.tool.url={getParam:function(e,t){var n=i.tool.urlHelper(e),o=n.queryAndHash[t];return void 0==o?"":o},setParam:function(e,t){var n=[];for(var o in t)n.push(o);var a=i.tool.urlHelper(e);return a.remove(n),a.add(t),a.__url},delParam:function(e,t){"string"==typeof t&&(t=[t]);var n=i.tool.urlHelper(e);return n.remove(t),n.__url}},i.tool.isInt=function(e){var t=/^[1-9]+[0-9]*]*$/;return!!t.test(e)},i.tool.getEvn=function(){var e=navigator.userAgent.toLowerCase(),t=0,n=0;return e.indexOf("micromessenger")>-1?(t=2,n=2):e.indexOf("qq/")>-1?(t=3,n=3):e.indexOf("weibo")>-1?(t=4,n=4):e.indexOf("wesecure")>-1||e.indexOf("mqqsecure")>-1?(t=1,n=1):e.indexOf("com.tencent.wifimanager")>-1||e.indexOf("mqqwifimanager")>-1?(t=1,n=5):e.indexOf("qqpim")>-1?(t=1,n=6):e.indexOf("ep_kinguser")>-1?(t=1,n=7):e.indexOf("gamestickmanager")>-1?(t=1,n=8):e.indexOf("yyb_build")>-1?(t=11,n=11):e.indexOf("mqqbrowser")>-1?(t=10,n=10):e.indexOf("gallerymanager")>-1||e.indexOf("photogallery")>-1?(t=1,n=9):"object"==typeof TcsJSBridge&&"function"==typeof TcsJSBridge.invoke&&(t=1),a.env=t,a.app=n,t},i.tool.getEnv=function(){return i.tool.getEvn()},i.tool.getApp=function(){return i.tool.getEvn(),a.app},i.tool.getOs=function(){var e=navigator.userAgent,t=0;return t=e.indexOf("Android")>-1?1:/iP(ad|hone|od)/.test(e)?2:e.indexOf("Windows Phone")>=0?3:0},i.tool.urlHelper=function(e){function t(e){this.__url=e,this.__location(this.__url)}return t.prototype={__hasHashParam:function(e){var t=/^#?[^?]*\?.+/;return t.test(e)},queryToQueryString:function(e){var t=[];for(var n in e)t.push(n+"="+e[n]);return t.length?t.join("&"):""},queryStringToQuery:function(e){var t=e.split("?");e=1===t.length?t[0]:2===t.length?t[1]:"";for(var n=e.split("&"),i={},o=0,a=n.length;o<a;o++){var r=n[o].split("=");2===r.length?i[r[0]]=r[1]:1===r.length&&(i[r[0]]="")}return i},__location:function(e){var t="",n="",o="",a="",r={},s={},c=/([^#]*)(#.*)?$/.exec(e);a=c[2]||"",n=c[1]||"";var u=/([^?]*)(\?.*)?$/.exec(n);o=u[2]||"",t=u[1]||"",a&&(this.__hasHashParam(a)?s=this.queryStringToQuery(a):/^#?[^?]*\?$/.test(a)&&(a=a.substring(0,a.length-1))),o&&(r=this.queryStringToQuery(o));var l=i.tool.ObjectAssign({},r,s),d={url:e,path:t,queryString:o,query:r,hashString:a,hash:s,queryAndHash:l};for(var p in d)this[p]=d[p];return this.__url=e,this},modify:function(e,t){var n=void 0,i=void 0,o=void 0,a=void 0;if(t||(n=this.query,i=this.hash),t&&t.indexOf("query")!==-1&&(n=this[t]),t&&t.indexOf("hash")!==-1&&(i=this[t]),n){for(var r in n)e[r]&&(n[r]=e[r]);o=this.queryToQueryString(n),this.queryString="?"+o}if(i){for(var s in i)e[s]&&(i[s]=e[s]);a=this.queryToQueryString(i);var c=this.hashString.split("?");this.hashString=2===c.length?c[0]+"?"+a:"?"+a}return this.__url=""+this.path+this.queryString+this.hashString,this.__location(this.__url),this},add:function(e,t){t="hash"!==t?"query":"hash";for(var n in e)this[t][n]=e[n];var i=this.queryToQueryString(this[t]);if("hash"===t)if(this.__hasHashParam(this.hashString)){var o=this.hashString.split("?");this.hashString=2===o.length?o[0]+"?"+i:"?"+i}else this.hashString=this.hashString+"?"+i;else this.queryString="?"+i;return this.__url=""+this.path+this.queryString+this.hashString,this.__location(this.__url),this},remove:function(e){for(var t=i.tool.ObjectAssign({},this.query),n=i.tool.ObjectAssign({},this.hash),o=0,a=e.length;o<a;o++){var r=e[o];for(var s in t)r===s&&delete t[s];for(var c in n)r===c&&delete n[c]}var u=this.queryToQueryString(t),l=this.queryToQueryString(n);this.queryString=u?"?"+u:"";var d=this.hashString.split("?");return l?this.hashString=2===d.length?d[0]+"?"+l:"?"+l:this.hashString=this.__hasHashParam(l)?this.hashString:d[0],this.__url=""+this.path+this.queryString+this.hashString,this.__location(this.__url),this}},new t(e)},i.v.assignNative=e(),i.tool.ObjectAssign=i.v.assignNative?Object.assign:function(e,t){function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}for(var i,o,a=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,c=n(e),u=1;u<arguments.length;u++){i=Object(arguments[u]);for(var l in i)r.call(i,l)&&(c[l]=i[l]);if(a){o=a(i);for(var d=0;d<o.length;d++)s.call(i,o[d])&&(c[o[d]]=i[o[d]])}}return c},i.tool.addLoadListener=function(e,t){if("function"==typeof e&&(t=e,e="load"),window.addEventListener)window.addEventListener(e,t,!1);else if(window.attachEvent)window.attachEvent(e,t),window.attachEvent("on"+e,t);else{var n=window.onload;"function"!=typeof window.onload?window.onload=t:window.onload=function(){n(),t()}}},i.tool.doAsyn=function(e){var t="WeixinJSBridgeReady";if(2===i.tool.getEvn()){if("object"==typeof WeixinJSBridge&&"function"==typeof WeixinJSBridge.invoke)return void e()}else if(1===i.tool.getEvn()&&(t="TcsJSBridgeReady","object"==typeof TcsJSBridge&&"function"==typeof TcsJSBridge.invoke))return void e();document.addEventListener?document.addEventListener(t,e,!1):document.attachEvent&&(document.attachEvent(t,e),document.attachEvent("on"+t,e))},i.tool.WxJs=function(e,t,n){"function"==typeof t&&(n=t,t={}),i.tool.doAsyn(function(){console.log("doAsyn.WeixinJSBridge.invoke"),WeixinJSBridge.invoke(e,t,function(e){n(e)})})},i.tool.GjJs=function(e,t,n){var o="doAsyn.TcsJSBridge.invoke."+e;"function"==typeof t&&(n=t,t={}),i.tool.doAsyn(function(){console.log(o+": params="+JSON.stringify(t)),TcsJSBridge.invoke(e,t,function(e){console.log(o+": callback:"+JSON.stringify(e)),n(e)})})},i.share={inited:!1,pt:[3,6],st:[],opt:{img_url:"",link:n,desc:"",title:"",appNames:["wechat_contact","wechat_moment"]},callback:{f1:function(e){},f2:function(e){}},init:function(e,t,n){console.log("share.init");var o=i.tool.getEnv();i.share.setOpt(e),"function"==typeof t&&(i.share.callback.f1=t),"function"==typeof n&&(i.share.callback.f2=n),this.inited||(this.inited=!0,2==o?i.tool.doAsyn(function(){console.log("doAsyn.share.bindWx"),i.share.bindWx()}):1==o?i.tool.doAsyn(function(){console.log("doAsyn.share.bindGj"),i.share.bindGj()}):3==o&&i.share.qq2x())},run:function(e,t){"undefined"==typeof e&&(e={}),"function"==typeof e&&(t=e,e={}),1==i.tool.getEvn()?(i.share.callback.f1(i.share.opt),e.to?1===e.to?i.share.gj2WxTimeline():2===e.to?i.share.gj2WxMsg():i.share.gj2x():i.share.gj2x()):3==i.tool.getEvn()?mqq.ui.showShareMenu():"function"==typeof t&&t()},bindWx:function(){WeixinJSBridge.on("menu:share:appmessage",function(e){var t="sendAppMessage";"QQ"==e.scene?t="shareQQ":"QZone"==e.scene&&(t="shareQZone"),i.share.wx2x(t)}),WeixinJSBridge.on("menu:share:timeline",function(e){i.share.wx2x("shareTimeline")})},bindGj:function(){i.share.gjSetOpt(),TcsJSBridge.on("share2App",function(e){if(i.share.gjSetOpt(),"object"==typeof e)if("click"==e.action);else if("select"==e.action){switch(e.appName){case"weixinMessage":break;case"weixinTimeline":}i.stat({ptype:i.share.pt.join(","),stype:i.share.st.join(",")}),i.share.callback.f1(i.share.opt)}else if("finish"==e.action){var t={result:0};i.stat({ptype:106,stype:1}),i.share.callback.f2(t)}else"cancel"==e.action})},setOpt:function(e){e.img_url&&(i.share.opt.img_url=e.img_url),e.link&&(i.share.opt.link=e.link),e.desc&&(i.share.opt.desc=e.desc),e.title&&(i.share.opt.title=e.title),e.appid?i.share.opt.appid=e.appid:3==i.tool.getEvn()&&(i.share.opt.appid="200693527"),i.share.setLink(),1==i.tool.getEvn()&&i.share.gjSetOpt()},setLink:function(){var e=i.tool.url.getParam(n,o.p_sc),r=i.share.opt.link;(""==e||!i.tool.isInt(e))&&(e=0),e=+e+1,i.share.st=[a.env,e];var s=null;t&&(s=t.getItem(a.ck_from)),s&&!isNaN(s)||(s=0);var c={sdi_from:s,sdi_sc:e};i.share.opt.link=i.tool.url.setParam(r,c)},wx2x:function(e){WeixinJSBridge.invoke(e,i.share.opt,function(e){var t={result:-1,msg:e.err_msg};/\:(ok|confirm)/.test(e.err_msg)?(t.result=0,i.stat({ptype:106,stype:1})):i.stat({ptype:106,stype:2}),i.share.callback.f2(t)}),i.share.callback.f1(i.share.opt),i.stat({ptype:i.share.pt.join(","),stype:i.share.st.join(",")})},gj2x:function(){1==i.tool.getOs()&&i.stat({ptype:i.share.pt.join(","),stype:i.share.st.join(",")}),i.tool.GjJs("share2App",i.share.opt,function(e){if(1==i.tool.getOs()){if(6===a.app&&"-100"==e.ret)return void i.share.gj2WxTimeline();var t={result:-1,msg:e.err_msg};"0"==e.ret?(t.result=0,i.stat({ptype:106,stype:1})):i.stat({ptype:106,stype:2}),i.share.callback.f2(t)}})},qq2x:function(){"undefined"!=typeof mqq&&mqq.ui.setOnShareHandler(function(e){mqq.ui.shareMessage({title:i.share.opt.title,desc:i.share.opt.desc,share_type:e,share_url:i.share.opt.link,image_url:i.share.opt.img_url,back:!0,puin:i.share.opt.appid},function(e){var t={result:-1,msg:""};0==e.retCode?(t.result=0,i.stat({ptype:106,stype:1})):i.stat({ptype:106,stype:2}),i.share.callback.f2(t)}),i.share.callback.f1(i.share.opt),i.stat({ptype:i.share.pt.join(","),stype:i.share.st.join(",")})})},gjSetOpt:function(){var e=i.tool.getOs();2==e&&i.tool.GjJs("setShareInfo",i.share.opt,function(e){})},gj2WxTimeline:function(){i.tool.GjJs("shareTimeline",i.share.opt,function(e){var t={result:-1,msg:e.err_msg};"ok"==e.err_msg&&"0"==e.ret?(t.result=0,i.stat({ptype:106,stype:1})):i.stat({ptype:106,stype:2}),i.share.callback.f2(t)})},gj2WxMsg:function(){i.tool.GjJs("sendAppMessage",i.share.opt,function(e){var t={result:-1,msg:e.err_msg};"ok"==e.err_msg&&"0"==e.ret?(t.result=0,i.stat({ptype:106,stype:1})):i.stat({ptype:106,stype:2}),i.share.callback.f2(t)})}},i.api||(i.api={}),i.api.getNetwork=function(e){var t="unknown";1==i.tool.getEnv()?i.tool.GjJs("getNetworkType",{},function(n){"ok"==n.err_msg&&(t=n.networkType),e(t)}):2==i.tool.getEnv()?i.tool.WxJs("getNetworkType",{},function(n){(n.err_msg="network_type:wifi")?t="wifi":n.subtype&&(t=n.subtype),e(t)}):(navigator.connection&&(t=navigator.connection.type?navigator.connection.type:"unknown"),e(t))},i.api.GJInfo=function(e){function t(){if(o++,o>=6){var t={result:0,msg:"ok",data:n};e(t)}}var n={},o=0;i.tool.GjJs("getInfo",{key:"imei"},function(e){"ok"==e.err_msg&&void 0!=e.ret&&(n.imei=e.ret),t()}),i.tool.GjJs("getInfo",{key:"guid"},function(e){"ok"==e.err_msg&&void 0!=e.ret&&(n.guid=e.ret),t()}),i.tool.GjJs("getInfo",{key:"phone_number"},function(e){"ok"==e.err_msg&&void 0!=e.ret&&(n.phone=e.ret),t()}),i.tool.GjJs("getInfo",{key:"lc"},function(e){"ok"==e.err_msg&&void 0!=e.ret&&(n.lc=e.ret),t()}),i.tool.GjJs("getInfo",{key:"android_os_build_model"},function(e){"ok"==e.err_msg&&void 0!=e.ret&&(n.deviceModel=e.ret),t()}),i.tool.GjJs("getInfo",{key:"android_os_build_version_release"},function(e){"ok"==e.err_msg&&void 0!=e.ret&&(n.OSVersion=e.ret),t()})},i.api.ajax=function(e,t){e.type=e.type||"POST",e.data=e.data||{},e.contentType=e.contentType||"application/x-www-form-urlencoded";var n=e.data,i=e.url,o=new window.XMLHttpRequest,a=t;if(o.onreadystatechange=function(){if(4==o.readyState){if("function"!=typeof a)return;if(o.status>=200&&o.status<=307||304==o.status){var e={};try{e=JSON.parse(o.responseText)}catch(t){e=o.responseText}a(e)}else a({msg:"网络连接失败"})}},"application/json"==e.contentType)e.type="POST",n=JSON.stringify(e.data);else if("object"==typeof e.data){var r,s=[];for(r in e.data)s.push(r+"="+encodeURIComponent(e.data[r]));n=s.join("&")}return"GET"==e.type&&(i+=(i.indexOf("?")>0?"&":"?")+n,n=void 0),o.open(e.type,i,!0),o.setRequestHeader("Content-Type",e.contentType),o.send(n),o},i.api.websocket=function(e,t,n){var o=null,a=0,r=0,s={},c=!0,u=!1;"object"==typeof e&&(t=e,e="ws://mozi.m.qq.com");var l=null;"https:"===location.protocol?(e=e.replace(/ws:/,"wss:"),l=e.replace(/wss:/,"")):(e=e.replace(/wss:/,"ws:"),l=e.replace(/ws:/,"")),l=l.replace("mozi","asb"),"function"==typeof n&&(s.open=n);var d={send:function(e,n,a){"function"==typeof n&&(a=n,n={});var r=i.tool.uuid(),c={type:"message",evtid:e,reqid:r,message:n};!u&&o&&1===o.readyState?(o.send(JSON.stringify(c)),"function"==typeof a&&(s[r]=a)):(c.appid=t.appid,i.api.ajax({type:"POST",url:l+"/cgi",data:c,contentType:"application/json"},a))},open:function(){c=!0;var n=this,i=e;i.indexOf("?")<0&&(i+="?"),t.time=(new Date).getTime(),r=t.time;for(var u in t)i+="&"+u+"="+t[u];o=new WebSocket(i),o.onmessage=function(e){var t=JSON.parse(e.data);if("command"===t.type&&s.command){var n=s.command;n(t.message)}if("message"===t.type){if(s.message){var i=s.message;i(t.message)}if(t.reqid){var o=s[t.reqid];o&&(o(t.message),delete s[t.reqid])}}},o.onopen=function(e){a=(new Date).getTime();var t=a-r;if(console.log("connection use time: "+t),console.log("connected opened: "+a),s.open){var n=s.open;n(e)}},o.onerror=function(e){if(s.error){var t=s.error;t(e)}},o.onclose=function(e){var t=(new Date).getTime();console.log("connected closed: "+t);var i=t-a;if(console.log("connected keeped: "+i+" ms"),s.close){var o=s.close;o(e)}c&&i>18e4&&(console.log("wait to reconnect"),setTimeout(function(){console.log("try to reconnect"),n.open()},6e3))}},close:function(){c=!1,o.close()},report:function(e){var n=e.reportType||"",a=e.isSuccess||!1,r=e.duration||0,c=e.ext1||"",u=e.ext2||"",d=e.ext3||"",p={type:"report",message:{reportType:n,isSuccess:a,duration:r,ext1:c,ext2:u,ext3:d}};o&&1===o.readyState?(o.send(JSON.stringify(p)),"function"==typeof callback&&(s[reqid]=callback)):(p.appid=t.appid,i.api.ajax({type:"POST",url:l+"/cgi",data:p,contentType:"application/json"}))},onCommand:function(e){s.command=e},onMessage:function(e){s.message=e},onOpen:function(e){s.open=e},onError:function(e){s.error=e},onClose:function(e){s.close=e},setSendByHTTP:function(e){u=!!e}};return"WebSocket"in window&&d.open(),d}}(),"undefined"==typeof sdi_host_api)var sdi_host_api="//sdi.3g.qq.com";if("undefined"==typeof face_host_api)var face_host_api="//sdi.m.qq.com";if(function(e,t){"use strict";function n(e){var t,n,i,o="";for(e+="",t=0,n=e.length;t<n;t++)i=e.charCodeAt(t).toString(16),o+=i.length<2?"0"+i:i;return o}function i(e){var t=document.createElement("canvas"),i=t.getContext("2d"),o=e;i.textBaseline="top",i.font="14px 'Arial'",i.textBaseline="tencent",i.fillStyle="#f60",i.fillRect(125,1,62,20),i.fillStyle="#069",i.fillText(o,2,15),i.fillStyle="rgba(102, 204, 0, 0.7)",i.fillText(o,4,17);var a=t.toDataURL().replace("data:image/png;base64,",""),r=atob(a),s=n(r.slice(-16,-12));return s}var o=sdi_host_api+"/api.do";e.api||(e.api={}),e.api.OAuthLogin=function(e,t){var n=sdi_host_api+"/api/login.do?by="+e+"&aid="+sdi_aid+"&backurl="+encodeURIComponent(t);location.href=n},e.api.loginByWX=function(t,n){"function"==typeof t&&(n=t,t={}),t.backurl=t.backurl||location.href,"boolean"!=typeof t.retry&&(t.retry=!0);var i=e.tool.getEvn();if(1==i)_sdi.api.GJLoginWX(t,n);else if(2==i){var o=e.tool.url.getParam(location.href,"openid");if(""!=o)return void e.api.getLoginUser(o,function(i){void 0!=i.result&&0==i.result?n({result:0,msg:"ok",data:{name:i.data.nickname,unionid:i.data.unionid,openid:i.data.openid,headimgurl:i.data.headimgurl,token:i.data.token}}):t.retry?e.api.OAuthLogin("WX",t.backurl):n({result:-1,msg:"无法获取用户信息"})});e.api.OAuthLogin("WX",t.backurl)}},e.api.loginByQQ=function(t,n){"function"==typeof t&&(n=t,t={});var i=e.tool.getEvn();1==i?e.api.GJLoginQQ(t,n):2==i?n({result:-1,msg:"not support"}):3==i&&e.api.getQQUserInfo(n)},e.api.getQQUserInfo=function(e){mqq.data.getUserInfo(function(t){e({result:0,msg:"ok",data:{name:t.nick,uin:t.uin,skey:t.skey,sid:t.skey}})})},e.api.getQQProfile=function(t,n){"function"==typeof t&&(n=t,t={}),t.method="getQQProfile",e.api.ajax({type:"POST",url:o,data:t},n)},e.api.getQQByWXOpenId=function(t,n){"function"==typeof t&&(n=t,t={}),t.method="getQQByWXOpenId",e.api.ajax({type:"POST",url:o,data:t},n)},e.api.counter=function(t,n){"function"==typeof t&&(n=t,t={}),t.aid=t.aid||sdi_aid,t.method="counter",e.api.ajax({type:"POST",url:o,data:t},n)},e.api.getLoginUser=function(t,n){"function"==typeof t&&(n=t,t="");var i=e.tool.getEvn();if(3==i)e.api.getQQUserInfo(n);else if(2==i){var a={method:"getLoginUser",uid:t};e.api.ajax({type:"POST",url:o,data:a},n)}},e.api.getGJ3rdAccount=function(t,n){"function"==typeof t&&(n=t,t={}),t.method="getGJ3rdAccount",t.accountId=t.accountId||"",t.type=t.type||0,e.api.ajax({type:"POST",url:o,data:t},n)},e.api.lottery=function(t,n){"function"==typeof t&&(n=t,t={}),t.method="lottery",t.sign=t.sign||"",t.openid=t.openid||"",t.time=t.time||0,t.aid=t.aid||sdi_aid,t.prize=t.prize||"",e.api.ajax({type:"POST",url:o,data:t},n)},e.api.activate=function(t,n){var i=e.tool.getEvn();t.viewId=t.viewId||"1",t.iosViewId=t.iosViewId||1,t.iosUrl=t.iosUrl||"mqqsecure://mqqalbum",t.showId=t.showId||sdi_aid,t.showChannel=t.showChannel||i,t.str1=t.str1||"",t.str2=t.str2||"",t.int1=t.int1||0,t.int2=t.int2||0,t.signature=t.signature||"00B1208638DE0FCD3E920886D658DAF6",t.finishSelf=void 0!=t.finishSelf&&t.finishSelf,t.download=void 0!=t.download&&t.download,t.downloadAPK=t.downloadAPK||"http://m.qq.com",t.downloadIOS=t.downloadIOS||"https://itunes.apple.com/app/apple-store/id439638720?pt=69276&ct=qingchun&mt=8",e.api.getInstallState({pkgName:"com.tencent.qqpimsecure",iosUrl:"mqqsecure://"},function(o){if(0==o.result)2==i?e.api.launch3rdApp({pkgName:"com.tencent.qqpimsecure",signature:t.signature,param:"{'dest_view':"+t.viewId+",'show_id':'"+t.showId+"','show_channel':'"+t.showChannel+"'}",iosUrl:t.iosUrl},function(e){n(e)}):1==i&&e.tool.GjJs("gotoQQSecure",{viewId:t.viewId,viewId_ios:t.iosViewId,str1:t.str1,str2:t.str2,int1:t.int1,int2:t.int2,finishSelf:t.finishSelf},function(e){var t={result:-1,msg:e.err_msg};"ok"==e.err_msg?(t.result=0,n(t)):n(t)});else{var a={result:-1,msg:"no_install"};n(a);var r=t.downloadAPK;2==e.tool.getOs()&&(r=t.downloadIOS),t.download&&setTimeout(function(){window.location=r},500)}})},e.api.launch3rdApp=function(t,n){var i=e.tool.getEvn();if(1==i)1==e.tool.getOs()?e.tool.GjJs("launch3rdApp",{pkgName:t.pkgName||"",signature:t.signature||"",activity:t.activity||"",param:t.param||"",tipType:t.tipType||1,tipMsg:t.tipMsg||"启动第三方APP",tipTime:t.tipTime||0},function(e){var t={result:-1,msg:e.err_msg};e.ret&&"0"===e.ret&&(t.result=0),n(t)}):2==e.tool.getOs()&&e.tool.GjJs("launch3rdApp",{iosUrl:t.iosUrl||""},function(e){var t={result:-1,msg:e.err_msg};"boolean"==typeof e.ret?e.ret===!0&&(t.result=0):"string"==typeof e.ret?"0"===e.ret&&(t.result=0):"number"==typeof e.ret&&0===e.ret&&(t.result=0),n(t)});else if(2==i){if(1==e.tool.getOs())e.tool.WxJs("launch3rdApp",{packageName:t.pkgName||"",signature:t.signature||"",param:t.param||"",type:1},function(e){var t={result:-1,msg:e.err_msg};"launch_3rdApp:ok"==e.err_msg?(t.result=0,n(t)):n(t)});else if(2==e.tool.getOs()){var o=navigator.userAgent;if(+o.match(/MicroMessenger\/([\d.]+)/)[1].replace(/\./g,"")>=656)e.tool.WxJs("launchApplication",{schemeUrl:t.iosUrl||""},function(e){var t={result:-1,msg:e.err_msg};"launchApplication:ok"==e.err_msg?(t.result=0,n(t)):n(t)});else{var a=document.createElement("iframe");a.src=t.iosUrl||"",a.style.display="none",document.body.appendChild(a),a.parentNode.removeChild(a),a=null,n({result:-2,msg:"unknown"})}}}else{if(2==e.tool.getOs()){var a=document.createElement("iframe");a.src=t.iosUrl||"",a.style.display="none",document.body.appendChild(a),a.parentNode.removeChild(a),a=null}n({result:-2,msg:"unknown"})}},e.api.getInstallState=function(t,n){t.pkgName=t.pkgName||"",t.iosUrl=t.iosUrl||"";var i=e.tool.getEvn();1==i?e.tool.GjJs("isPkgInstalled",{pkgName:t.pkgName,iosUrl:t.iosUrl},function(e){var t={result:-1,msg:e.err_msg};"true"==e.ret||1==e.ret?(t.result=0,n(t)):n(t)}):2==i?e.tool.WxJs("getInstallState",{packageName:t.pkgName,packageUrl:t.iosUrl},function(e){var t={result:-1,msg:e.err_msg};e.err_msg.indexOf("get_install_state")>-1&&"get_install_state:no"!=e.err_msg?(t.result=0,n(t)):n(t)}):n({result:-2,msg:"unknown"})},e.api.GJGetQQLoginState=function(t){e.tool.GjJs("getQQLoginState",{uin:""},function(e){var n={result:-1,msg:e.err_msg};"ok"==e.err_msg&&0==e.ret?("online"==e.state?(n.result=0,n.data={uin:e.uin,name:e.name,token:e.token,openid:e.openid,accountid:e.accountid}):"offline"==e.state?(n.result=1,n.data={uin:e.uin,name:e.name,token:e.token,openid:e.openid,accountid:e.accountid}):n.result=2,t(n)):t(n)})},e.api.GJGetWXLoginState=function(t){e.tool.GjJs("getWXLoginState",{uin:""},function(e){var n={result:-1,msg:e.err_msg};"ok"==e.err_msg&&0==e.ret?("online"==e.state?(n.result=0,n.data={uin:e.uin,name:e.name,token:e.token,openid:e.openid,accountid:e.accountid}):"offline"==e.state?(n.result=1,n.data={uin:e.uin,name:e.name,token:e.token,openid:e.openid,accountid:e.accountid}):n.result=2,t(n)):t(n)})},e.api.GJLoginQQ=function(t,n){"function"==typeof t&&(n=t,t={}),t.asMain=void 0==t.asMain||t.asMain,t.uin=t.uin||"",e.tool.GjJs("loginQQ",{as_main_account:t.asMain,uin:t.uin,login_from:"webview"},function(e){var t={result:-1,msg:e.err_msg};"ok"==e.err_msg&&0==e.ret?(t.result=0,t.data={uin:e.uin,name:e.name,token:e.token,openid:e.openid,accountid:e.accountid},n(t)):n(t)})},e.api.GJLoginWX=function(t,n){"function"==typeof t&&(n=t,t={}),t.asMain=void 0==t.asMain||t.asMain,t.uin=t.uin||"",e.tool.GjJs("loginWX",{as_main_account:t.asMain,uin:t.uin,login_from:"webview"},function(e){var t={result:-1,msg:e.err_msg};"ok"==e.err_msg&&0==e.ret?(t.result=0,t.data={unionid:e.uin,name:e.name,openid:e.openid},n(t)):(t.result=-1,n(t))})},e.api.GJGetQQLoginKey=function(t,n){function i(){if(r++,r>=5){var e={result:0,msg:"ok",data:a};n(e)}}"function"==typeof t&&(n=t,t={}),t.uin=t.uin||"";var o=t.uin,a={};a.uin=o;var r=0;e.tool.GjJs("getQQLoginKey",{uin:o,keytype:"sid"},function(e){"ok"==e.err_msg&&0==e.ret&&(a.sid=e.key,a.uin=e.uin),i()}),e.tool.GjJs("getQQLoginKey",{uin:o,keytype:"skey"},function(e){"ok"==e.err_msg&&0==e.ret&&(a.skey=e.key),i()}),e.tool.GjJs("getQQLoginKey",{uin:o,keytype:"vkey"},function(e){"ok"==e.err_msg&&0==e.ret&&(a.vkey=e.key),i()}),e.tool.GjJs("getQQLoginKey",{uin:o,keytype:"a2key"},function(e){"ok"==e.err_msg&&0==e.ret&&(a.a2key=e.key),i()}),e.tool.GjJs("getQQLoginKey",{uin:o,keytype:"stwebkey"},function(e){"ok"==e.err_msg&&0==e.ret&&(a.stwebkey=e.key),i()})},e.api.GJGetVersionInfo=function(t){function n(){if(o++,o>=3){var e={result:0,msg:"ok",data:i};t(e)}}var i={},o=0;e.tool.GjJs("getQQSecureBuildNo",null,function(e){"ok"==e.err_msg&&(i.buildNo=e.ret),n()}),e.tool.GjJs("getQQSecureVersionName",null,function(e){"ok"==e.err_msg&&(i.versionName=e.ret),n()}),e.tool.GjJs("getQQSecureVersionCode",null,function(e){"ok"==e.err_msg&&(i.versionCode=e.ret),n()})},e.api.GJGetAccountInfo=function(t){e.tool.GjJs("getMainAccountInfo",{},function(e){var n={result:-1,msg:e.err_msg};"ok"==e.err_msg&&0==e.ret?("online"==e.state?(n.result=0,n.data={token:e.token,accountid:e.accountid}):"offline"==e.state?(n.result=1,n.data={token:e.token,accountid:e.accountid}):n.result=2,t(n)):t(n)})},e.api.behavior=function(t){for(var n=navigator,o=t.aid||sdi_aid,a=[],r=0;r<n.plugins.length;r++)a.push(n.plugins[r].name);var s=_sdi.user,c={aid:o,uid:t.uid||"",ptype:t.ptype,stype:t.stype,ua:n.userAgent,platform:n.platform,screen:window.screen.width*window.devicePixelRatio+"*"+window.screen.height*window.devicePixelRatio,browserCode:n.appCodeName,browserName:n.appName,browserVer:n.appVersion,cookieEnabled:n.cookieEnabled?1:0,browserLang:n.language,cpu:n.cpuClass||"",canvas:i("wwww.tencent.com"),webgl:"",css3:e.api.supportCss3("animation-play-state")?1:0,timezone:(new Date).getTimezoneOffset()/60,track:n.doNotTrack?1:0,product:n.product,vendor:n.vendor,plugins:a.join(","),cpuCore:n.hardwareConcurrency,colorDepth:window.screen.colorDepth,network:s.network,app:e.tool.getEvn(),imei:s.imei,guid:s.guid,idfa:s.idfa,gjid:s.gjid,phone_num:s.phone,email:s.email,qq_openid:s.qq_openid,qq_unionid:s.qq_unionid,wx_openid:s.wx_openid,wx_unionid:s.wx_unionid,headimg:s.headimg,osversion:e.tool.getOs()+""};_sdi.v.debug&&alert("behavior:"+JSON.stringify(c)),e.api.ajax({url:face_host_api+"/stat/behavior",data:c,contentType:"application/json"})},e.api.supportCss3=function(e){var t,n=["webkit","Moz","ms","o"],i=[],o=document.documentElement.style,a=function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})};for(t in n)i.push(a(n[t]+"-"+e));i.push(a(e));for(t in i)if(i[t]in o)return!0;return!1}}(_sdi,document),window._sdi){_sdi.init=function(){function e(){console.log("doAsyn.init.gj"),_sdi.tool.doAsyn(function(){_sdi.api.GJInfo(function(e){if(e.data){var t=e.data;t.guid&&_sdi.user.init({guid:t.guid,imei:t.imei||t.guid})}})})}function t(){if(console.log("doAsyn.init.wx"),"object"==typeof sdi_wx_user){var e=sdi_wx_user;_sdi.user.init({gjid:e.account,wx_openid:e.openid,wx_unionid:e.unionid,headimg:e.headimgurl})}}function n(){console.log("doAsyn.init.qq");var e=document.createElement("script"),t=document.getElementsByTagName("head")[0];if(e.src="//open.mobile.qq.com/sdk/qqapi.js?_bid=152",t.appendChild(e),e.onload=function(){_sdi.share.qq2x()},"object"==typeof sdi_wx_user){var n=sdi_wx_user;_sdi.user.init({gjid:n.account,qq_openid:n.openid,qq_unionid:n.unionid,headimg:n.headimgurl})}}var i=null;if(localStorage&&(i=localStorage.getItem(_sdi.c.c_uid)),!i)try{localStorage.setItem(_sdi.c.c_uid,_sdi.tool.uuid())}catch(e){console.log("localStorage set fail!")}var o=_sdi.tool.getEnv();1===o?e():2===o?t():3===o&&n(),_sdi.api.getNetwork(function(e){_sdi.user.init({network:e})}),"object"==typeof window.moziArgs&&moziArgs.enable&&moziArgs.appid&&(window._mozi=_sdi.api.websocket(moziArgs.host,{appid:moziArgs.appid}))},_sdi.user.init(),_sdi.init(),_sdi.analytics.doPV(),_sdi.tool.addLoadListener(function(){console.log("load:init")});var eruda="//cdn.jsdelivr.net/eruda/1.0.4/eruda.min.js";_sdi.v.dev&&(document.write('<script src="'+eruda+'"></script>'),document.write("<script>eruda.init();</script>"))}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化