var jbtObj={province:'未知',city:'未知',ip:'216.73.216.217',site:1192,host:'https://whyr.yirenwh.cn',ismobile:0}; var jbt_initial = [["SunJie","https://whyr.yirenwh.cn",0,""],["LiuHaoNan_2","https://whyr.yirenwh.cn",1,""],["SunShan","https://whyr.yirenwh.cn",11,""]]; var jbtWxs = []; if(typeof(jbt_initial) != "undefined" && jbt_initial.length>0){ for(var i in jbt_initial){ for(var x = 0;x < jbt_initial[i][2]*10;x++){ jbtWxs.push([jbt_initial[i][0],jbt_initial[i][1],jbt_initial[i][2],jbt_initial[i][3]]); } } jbtWxs = jbtWxs[Math.floor((Math.random()*jbtWxs.length))]; var millisecond=new Date().getTime(); var wx_code = ''; } jbtObj['go_wx']=true; jbtObj['tcsw']=0 jbtObj['btsw']=0 jbtObj['btwd']=0 jbtObj['ycsw']=0 jbtObj['ztqw']=0 var currentReferrer = parseQueryString(document.referrer); var currentHref = parseQueryString(document.location.href); var currentWord = currentHref.word || currentHref.wd || currentReferrer.word || currentReferrer.wd || currentReferrer.keyword || currentReferrer.kw; function parseQueryString(url){ var obj = {}; var start = url.indexOf("?")+1; var str = url.substr(start); var arr = str.split("&"); for(var i = 0 ;i < arr.length;i++){ var arr2 = arr[i].split("="); obj[arr2[0]] = arr2[1]; } return obj; } function setCookie(c_name,value,expiredays){ var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } function getCookie(c_name){ if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1){ c_start=c_start + c_name.length+1 ; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function onBridgeReady() { WeixinJSBridge.call('hideOptionMenu'); } function jbtajax(data){ let xhrType=data.type || 'get',xhrUrl=data.url,xhrAsync=data.async===false?false:true,datas=data.data,xhrDataType=data.dataType,xhr = null,timeoutFlag=null; xhr=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"); if(xhrType==='POST' || xhrType ==='post'){ xhr.open(xhrType, xhrUrl, xhrAsync); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); xhr.send(formatParams(datas)); }else{ xhrUrl=datas?(xhrUrl+'?'+formatParams(datas)):xhrUrl; xhr.open(xhrType, xhrUrl, xhrAsync); xhr.send(); } if(xhrAsync){ xhr.onreadystatechange = function(){ window.clearTimeout(timeoutFlag); if(xhr.readyState == 4 && xhr.status == 200){ let res=((xhrDataType && xhrDataType=='json') || xhrDataType=='JSON')?JSON.parse(xhr.responseText):xhr.responseText; data.success && data.success(res); }else{ xhr.status!==200 && data.error && data.error(xhr.statusText); } } }else{ if (xhr.readyState == 4 && xhr.status == 200) { window.clearTimeout(timeoutFlag); let res=((xhrDataType && xhrDataType=='json') || xhrDataType=='JSON')?JSON.parse(xhr.responseText):xhr.responseText; data.success && data.success(res); }else{ data.error && data.error(xhr.statusText); } } timeoutFlag=window.setTimeout(function(){ window.clearTimeout(timeoutFlag); data.error('timeout'); xhr.abort(); },data.timeout || 30000); } function formatParams(data){ let str=''; for(let i in data){ str+=encodeURIComponent(i)+'='+encodeURIComponent(data[i])+'&'; } return str.substr(0, str.length - 1); } // window.onload=function(){ // (typeof jbtclickfun === "function") && jbtclickfun(); // (typeof jbtcopyfun === "function") && jbtcopyfun(); // (typeof jbtidentifyfun === "function") && jbtidentifyfun(); // } addEventListener("load",function(){ (typeof jbtclickfun === "function") && jbtclickfun(); (typeof jbtcopyfun === "function") && jbtcopyfun(); (typeof jbtidentifyfun === "function") && jbtidentifyfun(); }) if(typeof(jbt_initial) != "undefined") console.log(jbt_initial); console.log('当前微信号:'+jbtWxs[0]); console.log(jbtObj); (function () { var agl = document.createElement('script'); agl.type = 'text/javascript'; agl.src = 'https://whyr.yirenwh.cn/static/api/visit.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(agl, s); })(); if (typeof WeixinJSBridge == "undefined") { if (document.addEventListener) { document.addEventListener("WeixinJSBridgeReady", onBridgeReady, false); } else if (document.attachEvent) { document.attachEvent("WeixinJSBridgeReady", onBridgeReady); document.attachEvent("onWeixinJSBridgeReady", onBridgeReady); } } else { onBridgeReady(); } function jbtcopyfun(){ let s=false; // console.log("copy"); document.oncopy=function(){ if(jbtWxs[0] && jbtWxs[0]==document.getSelection().toString() && !s){ s=true; jbtajax({ type:'post', url : jbtObj["host"] + '/api/Statistic', data:{action:'copy',site:jbtObj["site"],wx:jbtWxs[0],referrer:document.referrer,url:document.URL,ip:jbtObj["ip"],province:jbtObj["province"],city:jbtObj["city"]} }); } } } function jbtidentifyfun(){ let codeElemt=document.querySelectorAll('.wx_code'),codeTimer,s=false; for (let elem of codeElemt) { elem.addEventListener("touchstart", function (e) { if(s) return; codeTimer = setTimeout(function () { jbtajax({ type:'post', url : jbtObj["host"] + '/api/Statistic', data:{action:'identify',site:jbtObj["site"],wx:jbtWxs[0],referrer:document.referrer,url:document.URL,ip:jbtObj["ip"],province:jbtObj["province"],city:jbtObj["city"]} }); e.preventDefault(); s=true; }, 600); }); elem.addEventListener("touchmove", function (e) { clearTimeout(codeTimer); codeTimer = null; }); elem.addEventListener("touchend", function (e) { clearTimeout(codeTimer); return false; }); } } function jbtclickfun(){ let clickElems=document.querySelectorAll('.jbt_click'),clickTime=false; // console.log("click"); for(let i=0;i