-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.js
8 lines (7 loc) · 26.4 KB
/
index.js
1
2
3
4
5
6
7
8
module.exports = {
initMonitor: function (param) {
window.webfunnyDomain = param.webfunnyDomain;
window.sessionStorage.CUSTOMER_WEB_MONITOR_ID = param.webfunnyMonitorId;
!function(n){var o={};function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}r.m=n,r.c=o,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"wfDefault",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.wfDefault}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){var o,w,r,i,a;!function(O){sessionStorage||(O.sessionStorage={}),localStorage||(O.localStorage={}),O.webfunnyRequests||(O.webfunnyRequests=[]);var T=O.localStorage,a="object"==typeof navigator&&"Microsoft Internet Explorer"==navigator.appName&&parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g,"").replace("MSIE",""))<=9,S=T.WF_CONFIG?JSON.parse(T.WF_CONFIG):{s:!0,ia:[""],wc:40,pv:{s:"webfunny-pageview-switch",ia:[""]},je:{s:"webfunny-jserror-switch",ia:[""]},hl:{s:"webfunny-http-switch",ia:[""],uh:!1,rl:2e3,sl:2e3},rl:{s:"webfunny-resource-switch",ia:[""]},bl:{s:"webfunny-behavior-switch"},lc:{s:"webfunny-location-switch"},sc:{r:100,c:3}},i=O.location.href.split("?")[0],b=O.performance?O.performance.timing:{},E=O.performance&&"function"==typeof O.performance.getEntries?O.performance.getEntries():null,e="webfunnyVersionFlag",t=-1===O.location.href.indexOf("https")?"http://":"https://",s=O.location.href,I=encodeURIComponent(O.location.pathname),n=O.webfunnyDomain||"&&&www.webfunny.cn&&&",o=t+n,C="/server/upLog",x="/server/upDLog",c=o+C,f=o+x,_="CUSTOMER_PV",r="STAY_TIME",u="CUS_LEAVE",N="PAGE_LOAD",M="HTTP_LOG",l="JS_ERROR",p="SCREEN_SHOT",d="ELE_BEHAVIOR",k="RESOURCE_LOAD",h="CUSTOMIZE_BEHAVIOR",g="VIDEOS_EVENT",L="LAST_BROWSE_DATE",$="WM_PAGE_ENTRY_TIME",D="WM_VISIT_PAGE_COUNT",R=new function(){this.checkIgnore=function(t,n){if(!n)return!0;try{for(var e=n.replace(/ /g,""),o=S[t].ia||[],r=!0,i=0;i<o.length;i++){var a=o[i].replace(/ /g,"");if(a&&-1!=e.indexOf(a)){r=!1;break}}return r}catch(e){console.error("checkIgnore异常,key: "+t+";str:"+n)}},this.checkHttpReqResLen=function(e,t){var n=S.hl,o=parseInt(n.rl,10)||2e3,r=parseInt(n.sl,10)||2e3,i="req"===t?o:r,a="";if(e&&e.length<i)try{a=e}catch(e){a=""}else a="内容太长";return a},this.getIp=function(n){if("1"!=R.getWfCookie("wf_cj_status"))if(R.getWfCookie("wf_ip"))"function"==typeof n&&n();else{var o=(new Date).getTime()+864e5;R.loadJs(t+"pv.sohu.com/cityjson?ie=utf-8",function(){if(O.returnCitySN){var e=O.returnCitySN?O.returnCitySN.cip:"",t=encodeURIComponent(O.returnCitySN?O.returnCitySN.cname:"");R.setWfCookie("wf_ip",e,o),R.setWfCookie("wf_prov",t,o),"function"==typeof n&&n()}},function(){R.setWfCookie("wf_cj_status",1,o),"function"==typeof n&&n()})}else"function"==typeof n&&n()},this.getUuid=function(){var e=R.formatDate((new Date).getTime(),"yMdhms");return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})+"-"+e},this.getCustomerKey=function(){var e=this.getUuid(),t=R.getWfCookie("monitorCustomerKey");if(!t){var n=(new Date).getTime()+31104e7;R.setWfCookie("monitorCustomerKey",e,n),t=e}return t},this.setWfCookie=function(e,t,n){var o={data:t,expires:n};if(T.WEBFUNNY_COOKIE){var r=JSON.parse(T.WEBFUNNY_COOKIE);r[e]=o,T.WEBFUNNY_COOKIE=JSON.stringify(r)}else{var i={};i[e]=o,T.WEBFUNNY_COOKIE=JSON.stringify(i)}},this.getWfCookie=function(e){var t=null;if(T.WEBFUNNY_COOKIE){var n=(t=JSON.parse(T.WEBFUNNY_COOKIE))[e];return n?parseInt(n.expires,10)<(new Date).getTime()?(delete t[e],T.WEBFUNNY_COOKIE=JSON.stringify(t),""):n.data:""}return""},this.getCusInfo=function(e){if(!e)return"";var t=(T.wmUserInfo?JSON.parse(T.wmUserInfo):{})[e];return t||""},this.getWebMonitorId=function(){var e="jeffery_webmonitor",t=sessionStorage.CUSTOMER_WEB_MONITOR_ID||e;if(/^webfunny\d*(_\d{8}_\d{6}_[a-z]+)?$/.test(t)||(t=e),-1!==t.indexOf("_pro")){var n=R.getCusInfo("env");n&&(t=t.replace("_pro","_"+n))}return t},this.isTodayBrowse=function(e){var t=T[e],n=(new Date).getFullYear()+"-"+((new Date).getMonth()+1)+"-"+(new Date).getDate();return t&&n==t?!(!t||n!=t):(T[e]=n,!1)},this.formatDate=function(e,t){var n=new Date(e).getFullYear(),o=new Date(e).getMonth()+1,r=new Date(e).getDate(),i=new Date(e).getHours(),a=new Date(e).getMinutes(),s=new Date(e).getSeconds();return o=9<o?o:"0"+o,r=9<r?r:"0"+r,i=9<i?i:"0"+i,a=9<a?a:"0"+a,s=9<s?s:"0"+s,t.replace("y",n).replace("M",o).replace("d",r).replace("h",i).replace("m",a).replace("s",s)},this.getPageKey=function(){var e=this.getUuid();return T.monitorPageKey&&/^[0-9a-z]{8}(-[0-9a-z]{4}){3}-[0-9a-z]{12}-\d{13}$/.test(T.monitorPageKey)||(T.monitorPageKey=e),T.monitorPageKey},this.setPageKey=function(){T.monitorPageKey=this.getUuid()},this.addLoadEvent=function(e){var t=O.onload;"function"!=typeof O.onload?O.onload=e:O.onload=function(){t(),e()}},this.addOnBeforeUnloadEvent=function(e){var t=O.onbeforeunload;"function"!=typeof O.onbeforeunload?O.onbeforeunload=e:O.onbeforeunload=function(){t(),e()}},this.addOnclickForDocument=function(t){var n=document.onclick;"function"!=typeof document.onclick?document.onclick=t:document.onclick=function(e){n(),t(e)}},this.ajax=function(e,t,n,o,r){try{var i=O.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");i.open(e,t,!0),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.onreadystatechange=function(){if(4==i.readyState){var t={};try{t=i.responseText?JSON.parse(i.responseText):{}}catch(e){t={}}"function"==typeof o&&o(t)}},i.onerror=function(e){console.warn("【【 "+t+" 上报接口不通,请处理。】】",e),"function"==typeof r&&r()};var a=JSON.stringify(n||{});i.send("data="+a)}catch(e){console.log(e)}},this.upLog=function(e,i){if(e&&"undefined"!=e)if(a){(new Image).src=c+"?logInfo="+e;for(var t=0;t<W.length;t++)T[W[t]]=""}else R.ajax("POST",c,{logInfo:e},function(e){if(e&&e.data&&e.data.d){T.ds="c"==e.data.d?"connected":"disconnect";var t=e.data.c;if(t){T.setItem("WF_CONFIG",e.data.c);var n=JSON.parse(t);if(0==(S=n).s){var o=(new Date).getTime()+6e5;R.setWfCookie("webfunnyStart","p",o)}}}if(!0===i)for(var r=0;r<W.length;r++)T[W[r]]=""},function(){if(!0===i)for(var e=0;e<W.length;e++)T[W[e]]=""})},this.initDebugTool=function(){var a=R.getCusInfo("userId");function t(e){for(var t=[],n=e.length,o=0;o<n;o++)t.push(e[o]);var r={};r.log=t,r.userId=a,r.happenTime=(new Date).getTime();var i="";try{i=R.b64Code(JSON.stringify(r))}catch(e){i="convert fail"}return i}var n=console.log,o=console.warn;console.log=function(){var e=t(arguments);return"connected"===T.ds&&R.ajax("POST",f,{consoleInfo:e},function(){}),n.apply(console,arguments)},console.warn=function(){var e=t(arguments);return"connected"===T.ds&&R.ajax("POST",f,{warnInfo:e},function(){}),o.apply(console,arguments)}},this.uploadLocalInfo=function(){var e=R.getCusInfo("userId"),t={};for(var n in T)"function"==typeof T[n]||-1!=W.indexOf(n)||1e3<T[n].length||(t[n]=T[n]);try{t=R.b64Code(JSON.stringify(t))}catch(e){t=""}var o={};for(var n in sessionStorage)"function"==typeof sessionStorage[n]||-1!=W.indexOf(n)||1e3<sessionStorage[n].length||(o[n]=sessionStorage[n]);try{o=R.b64Code(JSON.stringify(o))}catch(e){o=""}var r=R.b64Code(document.cookie);R.ajax("POST",f,{localInfo:t,sessionInfo:o,cookieInfo:r,userId:e||"userId"},function(e){if((setTimeout(function(){R.uploadLocalInfo()},2e4),e.data)&&1==e.data.clear){var t=T.wmUserInfo;localStorage.clear(),localStorage.wmUserInfo=t,sessionStorage.clear(),T.WEBFUNNY_COOKIE=""}})},this.encryptObj=function(e){if(e instanceof Array){for(var t=[],n=0;n<e.length;++n)t[n]=this.encryptObj(e[n]);return t}if(e instanceof Object){t={};for(var n in e)t[n]=this.encryptObj(e[n]);return t}return 50<(e+="").length&&(e=e.substring(0,10)+"****"+e.substring(e.length-9,e.length)),e},this.getDevice=function(){var e={},t=navigator.userAgent,n=t.match(/(Android);?[\s\/]+([\d.]+)?/),o=t.match(/(iPad).*OS\s([\d_]+)/),r=!o&&t.match(/(iPhone\sOS)\s([\d_]+)/),i=t.match(/Android\s[\S\s]+Build\//),a=O.screen.width,s=O.screen.height;if(e.ios=e.android=e.iphone=e.ipad=e.androidChrome=!1,e.isWeixin=/MicroMessenger/i.test(t),e.os="web",e.deviceName="PC",e.deviceSize=a+"×"+s,n&&(e.os="android",e.osVersion=n[2],e.android=!0,e.androidChrome=0<=t.toLowerCase().indexOf("chrome")),(o||r)&&(e.os="ios",e.ios=!0),r&&(e.osVersion=r[2].replace(/_/g,"."),e.iphone=!0),o&&(e.osVersion=o[2].replace(/_/g,"."),e.ipad=!0),e.ios&&e.osVersion&&0<=t.indexOf("Version/")&&"10"===e.osVersion.split(".")[0]&&(e.osVersion=t.toLowerCase().split("version/")[1].split(" ")[0]),e.iphone){var c="iphone";320===a&&480===s?c="4":320===a&&568===s?c="5/SE":375===a&&667===s?c="6/7/8":414===a&&736===s?c="6/7/8 Plus":375===a&&812===s?c="X/S/Max":414===a&&896===s?c="11/Pro-Max":375===a&&812===s?c="11-Pro/mini":390===a&&844===s?c="12/Pro":428===a&&926===s&&(c="12-Pro-Max"),e.deviceName="iphone "+c}else if(e.ipad)e.deviceName="ipad";else if(i){for(var f=i[0].split(";"),u="",l=0;l<f.length;l++)-1!=f[l].indexOf("Build")&&(u=f[l].replace(/Build\//g,""));""==u&&(u=f[1]),e.deviceName=u.replace(/(^\s*)|(\s*$)/g,"")}if(-1==t.indexOf("Mobile")){var p=navigator.userAgent.toLowerCase();if(e.browserName="其他",0<p.indexOf("msie")){var d=p.match(/msie [\d.]+;/gi)[0];e.browserName="ie",e.browserVersion=d.split("/")[1]}else if(0<p.indexOf("edg")){d=p.match(/edg\/[\d.]+/gi)[0];e.browserName="edge",e.browserVersion=d.split("/")[1]}else if(0<p.indexOf("firefox")){d=p.match(/firefox\/[\d.]+/gi)[0];e.browserName="firefox",e.browserVersion=d.split("/")[1]}else if(0<p.indexOf("safari")&&p.indexOf("chrome")<0){d=p.match(/safari\/[\d.]+/gi)[0];e.browserName="safari",e.browserVersion=d.split("/")[1]}else if(0<p.indexOf("chrome")){d=p.match(/chrome\/[\d.]+/gi)[0];e.browserName="chrome",e.browserVersion=d.split("/")[1],0<p.indexOf("360se")&&(e.browserName="360")}}return e.webView=(r||o)&&t.match(/.*AppleWebKit(?!.*Safari)/i),e},this.loadJs=function(e,t,n){var o=document.createElement("script");o.async=1,o.src=e,o.onload=t,"function"==typeof n&&(o.onerror=n);var r=document.getElementsByTagName("script")[0];return r.parentNode.insertBefore(o,r),r},this.b64Code=function(e){var t=encodeURIComponent(e);try{return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}catch(e){return t}}},A=(new Date).getTime()+6048e5,v=R.getDevice(),w=T.wmUserInfo?JSON.parse(T.wmUserInfo):{},W=[d,l,M,p,_,N,k,h,g],j={ACTIVE_TIME:{}},V=[];function m(){this.handleLogInfo=function(e,t){if(t){var n=T[e]?T[e]:"";switch(e){case d:T[d]=n+JSON.stringify(t)+"$$$";break;case l:T[l]=n+JSON.stringify(t)+"$$$";break;case M:T[M]=n+JSON.stringify(t)+"$$$";break;case p:T[p]=n+JSON.stringify(t)+"$$$";break;case _:T[_]=n+JSON.stringify(t)+"$$$";break;case N:T[N]=n+JSON.stringify(t)+"$$$";break;case k:T[k]=n+JSON.stringify(t)+"$$$";break;case h:T[h]=n+JSON.stringify(t)+"$$$";break;case g:T[g]=n+JSON.stringify(t)+"$$$"}}}}function y(){this.wmVersion=e,this.h=(new Date).getTime(),this.a=R.getWebMonitorId(),this.g=O.location.href.split("?")[0],this.f=R.b64Code(O.location.href),this.b=R.getCustomerKey(),this.c=w.userId,this.j=R.b64Code(w.projectVersion||""),this.d=R.b64Code(w.userTag||""),this.e=R.b64Code(w.secondUserParam||"")}function P(e,t,n,o,r){y.apply(this),this.i=e,this.k=R.getPageKey(),this.l=v.deviceName,this.deviceSize=v.deviceSize,this.m=v.os+(v.osVersion?" "+v.osVersion:""),this.n=v.browserName,this.o=v.browserVersion,this.p=R.getWfCookie("wf_ip"),this.q="",this.r=R.getWfCookie("wf_prov"),this.s="",this.t=t,this.u=n,this.newStatus=o,this.referrer=(r||"").split("?")[0]}function U(e){this.i=u,this.a=R.getWebMonitorId(),this.leaveType=e,this.h=(new Date).getTime(),this.g=O.location.href.split("?")[0],this.b=R.getCustomerKey()}function J(e,t){y.apply(this),this.i=r,this.h=(new Date).getTime(),this.a=R.getWebMonitorId(),this.g=O.location.href.split("?")[0],this.b=R.getCustomerKey(),this.stayTime=e,this.activeTime=t}function F(e,t,n,o,r,i,a,s,c,f,u,l,p){y.apply(this),this.i=e,this.t=t,this.firstByte=n,this.w=o,this.pageCompleteLoaded=r,this.dns=i,this.tcp=a,this.ssl=s,this.response=c,this.conTrans=f,this.domAnalysis=u,this.resourceLoaded=l,this.effectiveType=p,this.m=v.os}function H(e,t,n,o,r,i,a){y.apply(this),this.i=e,this.da=t,this.G=R.b64Code(n),this.H=R.b64Code(o),this.I=R.b64Code(r),this.L=i,this.M=R.b64Code(a)}function B(e,t,n,o,r){y.apply(this),this.i=e,this.O=t,this.k=R.getPageKey(),this.l=v.deviceName,this.m=v.os+(v.osVersion?" "+v.osVersion:""),this.n=v.browserName,this.o=v.browserVersion,this.p=R.getWfCookie("wf_ip"),this.q="",this.r=R.getWfCookie("wf_prov"),this.s="",this.simpleErrorMessage=R.b64Code(n),this.P=R.b64Code(o),this.Q=R.b64Code(r),this.R=R.b64Code(navigator.userAgent)}function K(e,t,n,o,r,i,a,s,c,f,u,l){y.apply(this),this.i=e,this.method=t,this.g=o,this.S=R.b64Code(r),this.T=i,this.U=a,this.V=s,this.headerText=R.b64Code(n),this.W=R.b64Code(c),this.X=R.b64Code(f),this.h=u,this.u=l}function q(e,t,n,o){y.apply(this),this.i=e,this.Y=R.b64Code(t),this.Z=n,this.aa=o||"jpeg"}function Y(e,t,n,o){y.apply(this),this.i=e,this.ba=n,this.ca=R.b64Code(t),this.T=o}function z(e,t,n,o,r){this.c=e,this.a=R.getWebMonitorId(),this.da=t,this.ea=n,this.i=o,this.Y=r,this.h=(new Date).getTime()}function G(){var e=parseInt(T[$],10),t=(new Date).getTime()-e,n=R.getWfCookie("ACTIVE_TIME_INFO")||{},o=n.ACTIVE_TIME?1*n.ACTIVE_TIME[I]:t;0===o&&t<=1e4&&(o=t);var r=JSON.stringify(new J(t,o));navigator&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon(c,r)}function X(){j.ACTIVE_TIME[I]=0,R.setWfCookie("ACTIVE_TIME_INFO",j,A);var h=new Date,g=h.getFullYear(),v=h.getMonth(),w=h.getDate();try{var e=S.pv,t=S.je,n=S.hl,o=S.rl,r=S.bl;e.s&&(Z(),R.addLoadEvent(function(){setTimeout(function(){if(E){var e="load";e=E[0]&&"navigate"===E[0].type?"load":"reload";var t=b,n=t.fetchStart,o=t.responseStart-n,r=t.domContentLoadedEventEnd-n,i=t.loadEventStart-n,a=t.domainLookupEnd-t.domainLookupStart,s=t.connectEnd-t.connectStart,c=t.connectEnd-t.secureConnectionStart,f=t.responseStart-t.requestStart,u=t.responseEnd-t.responseStart,l=t.domInteractive-t.responseEnd,p=t.loadEventStart-t.domContentLoadedEventEnd,d=navigator&&navigator.connection&&navigator.connection.effectiveType||"unknown",h=new F(N,e,o,r,i,a,s,c,f,u,l,p,d);h.handleLogInfo(N,h)}},1e3)}),!1===a&&function(){if(O.Event&&"function"==typeof O.Event){function e(e){var t=history[e],n=new Event(e);return function(){var e=t.apply(this,arguments);return n.arguments=arguments,O.dispatchEvent(n),e}}history.pushState=e("pushState"),history.replaceState=e("replaceState")}O.addEventListener("hashchange",function(){Z(1)}),O.addEventListener("popstate",function(){var e=O.location.href.split("?")[0].split("#")[0];i!=e&&(Z(0),i=e)}),O.addEventListener("pushState",function(e){Z(0)}),O.addEventListener("replaceState",function(e){Z(0)})}()),t.s&&function(){if(O.onerror=function(e,t,n,o,r){Q("on_error",e,t,n,o,r?r.stack:null)},!0===a)return;var o=console.error;console.error=function(e){var t=e&&e.message||e,n=e&&e.stack;if(n)Q("on_error",t,s,0,0,n);else{if("object"==typeof t)try{t=JSON.stringify(t)}catch(e){t="错误无法解析"}Q("console_error",t,s,0,0,"CustomizeError: "+t)}return o.apply(console,arguments)},O.onunhandledrejection=function(e){var t="",n="";n="object"==typeof e.reason?(t=e.reason.message,e.reason.stack):(t=e.reason,""),": "===t&&(t=n),Q("on_error",t,s,0,0,"UncaughtInPromiseError: "+n)}}(),n.s&&!1===a&&function(){var i={};function a(e){var t=new CustomEvent(e,{detail:this});O.dispatchEvent(t)}var s=O.XMLHttpRequest;function r(e,t){if(g[e]&&!0!==g[e].uploadFlag){var n=R.checkHttpReqResLen(t,"res"),o=g[e].simpleUrl,r=(new Date).getTime(),i=g[e].event.detail.responseURL,a=g[e].event.detail.status,s=g[e].event.detail.statusText,c=r-g[e].timeStamp;if(i&&-1==i.indexOf(C)&&-1==i.indexOf(x)&&R.checkIgnore("hl",i)){var f=g[e].event.detail.wfHttpRecord,u=R.checkHttpReqResLen(f.requestBody,"req"),l=f.method||"",p=JSON.stringify(f.header||{}),d=new K(M,l,"",o,i,a,s,"request","","",g[e].timeStamp,0),h=new K(M,l,p,o,i,a,s,"response",u,n,r,c);V.push(d,h),g[e].uploadFlag=!0}}}var g=[];O.XMLHttpRequest=function(){var o=new s;o.wfTraceId=R.getUuid(),i[o.wfTraceId]={method:"",url:"",async:"",header:{},requestBody:""};var e=o.onreadystatechange;o.onreadystatechange=e&&"function"==typeof e?function(){return e.apply(o,arguments)}:function(){if(4===this.readyState&&!1===this.wfHttpRecord.async){var e=this.wfHttpRecord.sendTime,t=this.wfHttpRecord.method,n=this.wfHttpRecord.url,o=n.split("?")[0],r=JSON.stringify(this.wfHttpRecord.header||{}),i=R.checkHttpReqResLen(this.wfHttpRecord.requestBody||"","req"),a=R.checkHttpReqResLen(this.responseText||"","res"),s=(new Date).getTime(),c=this.status,f=this.statusText,u=s-e,l=new K(M,t,"",o,n,c,f,"request","","",e,0),p=new K(M,t,r,o,n,c,f,"response",i,a,s,u);V.push(l,p)}};var n=o.setRequestHeader;o.setRequestHeader=function(){if(arguments.length&&o.wfTraceId&&i[o.wfTraceId]){var e=arguments[0],t=arguments[1];i[o.wfTraceId].header[e]=t}return n.apply(o,arguments)};var r=o.open;r&&(o.open=function(){if(arguments.length&&o.wfTraceId&&i[o.wfTraceId]){var e=arguments[0],t=arguments[1],n=arguments[2];i[o.wfTraceId].method=e,i[o.wfTraceId].url=t,i[o.wfTraceId].async=n}return r.apply(o,arguments)});var t=o.send;return t&&(o.send=function(){if(arguments.length&&o.wfTraceId&&i[o.wfTraceId]){var e=arguments[0];i[o.wfTraceId].requestBody=e}return this.wfHttpRecord=i[o.wfTraceId]||{},this.wfHttpRecord&&(this.wfHttpRecord.sendTime=(new Date).getTime()),delete i[o.wfTraceId],t.apply(o,arguments)}),o.addEventListener("loadstart",function(){a.call(this,"ajaxLoadStart")},!1),o.addEventListener("loadend",function(){a.call(this,"ajaxLoadEnd")},!1),o},O.addEventListener("ajaxLoadStart",function(e){var t={timeStamp:(new Date).getTime(),event:e,simpleUrl:O.location.href.split("?")[0],uploadFlag:!1};g.push(t)}),O.addEventListener("ajaxLoadEnd",function(){for(var o=0;o<g.length;o++){if(!0!==g[o].uploadFlag)if(0<g[o].event.detail.status)if("blob"===(g[o].event.detail.responseType+"").toLowerCase())!function(t){var n=new FileReader;n.onload=function(){var e=n.result;r(t,e)};try{n.readAsText(g[o].event.detail.response,"utf-8")}catch(e){r(t,g[o].event.detail.response+"")}}(o);else try{var e=g[o]&&g[o].event&&g[o].event.detail;if(!e)return;var t=e.responseType,n="";""!==t&&"text"!==t||(n=e.responseText),"json"===t&&(n=JSON.stringify(e.response)),r(o,n)}catch(e){}}})}(),o.s&&!1===a&&O.addEventListener("error",function(e){var t=e.target.localName,n="";if("link"===t?n=e.target.href:"script"===t&&(n=e.target.src),n=n?n.split("?")[0]:"",R.checkIgnore("rl",n)&&-1==n.indexOf("pv.sohu.com/cityjson")){var o=new Y(k,n,t,"0");o.handleLogInfo(k,o)}},!0),r.s&&!0===a&&R.addOnclickForDocument(function(e){if(e){var t="",n="",o="",r=e.target.tagName,i="";"svg"!=e.target.tagName&&"use"!=e.target.tagName&&(t=e.target.className,n=e.target.placeholder||"",o=e.target.value||"",100<(i=e.target.innerText?e.target.innerText.replace(/\s*/g,""):"").length&&(i=i.substring(0,50)+" ... "+i.substring(i.length-49,i.length-1)),i=i.replace(/\s/g,""));var a=new H(d,"click",t,n,o,r,i);a.handleLogInfo(d,a)}}),R.addOnBeforeUnloadEvent(function(){G()});var m=0,y=W;setInterval(function(){var e=parseInt(S.wc||"40",10);if(e="connected"==T.ds?5:e,0<m&&m%5==0){if(10<=V.length){for(var t="",n=0;n<V.length;n++){var o=V[n];o&&(t+=JSON.stringify(o)+"$$$")}R.upLog(t,!1)}else{var r="";for(n=0;n<V.length;n++){var i=V[n];i&&(r+=JSON.stringify(i)+"$$$")}T[M]+=r,3e4<=T[M].length&&(R.upLog(T[M],!1),T[M]="")}V=[]}if(e<=m){var a="";for(n=0;n<y.length;n++)a+=T[y[n]]||"";0<a.length&&R.upLog(a,!0),m=0;var s=R.getWfCookie("ACTIVE_TIME_INFO")||{},c={};s.ACTIVE_TIME?c=s.ACTIVE_TIME:s.ACTIVE_TIME={};var f=c[I]||0;0<a.length&&(s.ACTIVE_TIME[I]=1*f+200*e),R.setWfCookie("ACTIVE_TIME_INFO",s,A);var u=new Date((new Date).getTime()+1e4),l=u.getFullYear(),p=u.getMonth(),d=u.getDate();(g<l||v<p||w<d)&&(G(),T[$]=(new Date).getTime(),h=new Date,g=h.getFullYear(),v=h.getMonth(),w=h.getDate())}m++},200)}catch(e){console.error("监控代码异常,捕获",e)}}function Z(e){var t=S.lc;t&&!0===t.s&&R.getIp(),R.setPageKey();var n=R.isTodayBrowse(L),o=(new Date).getTime();T[$]=o;var r=null,i=R.formatDate(o,"y-M-d"),a=encodeURIComponent(O.location.href.split("?")[0]),s=T[D];if(s){var c=s.split("$$$"),f=c[0],u=c[1],l=parseInt(c[2],10);i==u?a!=f&&1==l&&(T[D]=a+"$$$"+i+"$$$2",r=new U(2)):(T[D]=a+"$$$"+i+"$$$1",r=new U(1))}else T[D]=a+"$$$"+i+"$$$1",r=new U(1);var p="";E&&(p=E[0]&&"navigate"===E[0].type?"load":"reload");var d=R.getWfCookie("monitorCustomerKey");if(d){var h="",g=d?d.match(/\d{14}/g):[];if(g&&0<g.length){var v=g[0].match(/\d{2}/g),w=v[0]+v[1]+"-"+v[2]+"-"+v[3]+" "+v[4]+":"+v[5]+":"+v[6],m=new Date(w).getTime(),y=(new Date).getTime();h=2e3<y-m?0==n?"o_uv":"o":"n_uv"}}else h="n_uv";var b=R.b64Code(document.referrer);function I(n){var e=O.location.href;function t(){var e=new P(_,p,0,h,b),t=JSON.stringify(e)+"$$$";r&&(t+=JSON.stringify(r)+"$$$"),n?e.handleLogInfo(_,e):R.upLog(t,!1)}R.checkIgnore("pv",e)&&(R.getCusInfo("userId")?t():setTimeout(function(){t()},3e3))}var C=T.ds;C||!0!==t.s?("connected"===C&&R.initDebugTool(),setTimeout(function(){"connected"===C&&R.uploadLocalInfo()},2e3),I(e)):R.getIp(function(){I()})}function Q(e,t,n,o,r,i){var a=t||"",s=i||"",c="",f="";if((0!==a.length||0!==s.length)&&(1e3<=a.length&&(a=a.substring(0,999)),3e3<=s.length&&(s=s.substring(0,2999)),80<=a.length?f=a.substring(0,80):0<a.length&&a.length<80&&(f=a),R.checkIgnore("je",a))){if(a)if("string"==typeof s)c=s.split(": ")[0].replace('"',"");else c=JSON.stringify(s).split(": ")[0].replace('"',"");var u=new B(l,e,c+": "+f,c+": "+a,s);u.handleLogInfo(l,u)}}P.prototype=new m,U.prototype=new m,J.prototype=new m,F.prototype=new m,H.prototype=new m,B.prototype=new m,K.prototype=new m,q.prototype=new m,Y.prototype=new m,z.prototype=new m,new m;for(var ee=S.ia||[],te=!1,ne=0;ne<ee.length;ne++){var oe=ee[ne].replace(/ /g,"");if(oe&&-1!=(O.location.href+O.location.hash).indexOf(oe)){te=!0;break}}var re=R.getWfCookie("webfunnyStart")||S.s;if(re&&"p"!=re&&!te){var ie=R.getWfCookie("samplingChoose");if(2===ie)return;if(1===ie)X();else{var ae=S.sc||{r:100,c:3},se=ae.r,ce=1*ae.c;if(se<100){var fe=Math.ceil(100*Math.random()),ue=(new Date).getTime()+24*ce*3600*1e3;fe<=se?(R.setWfCookie("samplingChoose",1,ue),X()):R.setWfCookie("samplingChoose",2,ue)}else X()}}O.webfunny={getCustomerKey:function(){return R.getCustomerKey()},wm_upload_picture:function(e,t,n){var o=new q(p,t,e,n||"jpeg");o.handleLogInfo(p,o)},wm_upload_extend_log:function(e,t,n,o,r){var i=new z(e,t,n,o,r);i.handleLogInfo(h,i)}},function(){if("function"==typeof O.CustomEvent)return;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=O.Event.prototype,O.CustomEvent=e}()}(window),window.LZString=(w=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",i={},a={compressToEncodedURIComponent:function(e){return null==e?"":a._compress(e,6,function(e){return r.charAt(e)})},decompressFromEncodedURIComponent:function(t){return null==t?"":""==t?null:(t=t.replace(/ /g,"+"),a._decompress(t.length,32,function(e){return function(e,t){if(!i[e]){i[e]={};for(var n=0;n<e.length;n++)i[e][e.charAt(n)]=n}return i[e][t]}(r,t.charAt(e))}))},_compress:function(e,t,n){if(null==e)return"";var o,r,i,a={},s={},c="",f="",u="",l=2,p=3,d=2,h=[],g=0,v=0;for(i=0;i<e.length;i+=1)if(c=e.charAt(i),Object.prototype.hasOwnProperty.call(a,c)||(a[c]=p++,s[c]=!0),f=u+c,Object.prototype.hasOwnProperty.call(a,f))u=f;else{if(Object.prototype.hasOwnProperty.call(s,u)){if(u.charCodeAt(0)<256){for(o=0;o<d;o++)g<<=1,v==t-1?(v=0,h.push(n(g)),g=0):v++;for(r=u.charCodeAt(0),o=0;o<8;o++)g=g<<1|1&r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r>>=1}else{for(r=1,o=0;o<d;o++)g=g<<1|r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r=0;for(r=u.charCodeAt(0),o=0;o<16;o++)g=g<<1|1&r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r>>=1}0==--l&&(l=Math.pow(2,d),d++),delete s[u]}else for(r=a[u],o=0;o<d;o++)g=g<<1|1&r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r>>=1;0==--l&&(l=Math.pow(2,d),d++),a[f]=p++,u=String(c)}if(""!==u){if(Object.prototype.hasOwnProperty.call(s,u)){if(u.charCodeAt(0)<256){for(o=0;o<d;o++)g<<=1,v==t-1?(v=0,h.push(n(g)),g=0):v++;for(r=u.charCodeAt(0),o=0;o<8;o++)g=g<<1|1&r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r>>=1}else{for(r=1,o=0;o<d;o++)g=g<<1|r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r=0;for(r=u.charCodeAt(0),o=0;o<16;o++)g=g<<1|1&r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r>>=1}0==--l&&(l=Math.pow(2,d),d++),delete s[u]}else for(r=a[u],o=0;o<d;o++)g=g<<1|1&r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r>>=1;0==--l&&(l=Math.pow(2,d),d++)}for(r=2,o=0;o<d;o++)g=g<<1|1&r,v==t-1?(v=0,h.push(n(g)),g=0):v++,r>>=1;for(;;){if(g<<=1,v==t-1){h.push(n(g));break}v++}return h.join("")},_decompress:function(e,t,n){var o,r,i,a,s,c,f,u=[],l=4,p=4,d=3,h="",g=[],v={val:n(0),position:t,index:1};for(o=0;o<3;o+=1)u[o]=o;for(i=0,s=Math.pow(2,2),c=1;c!=s;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=t,v.val=n(v.index++)),i|=(0<a?1:0)*c,c<<=1;switch(i){case 0:for(i=0,s=Math.pow(2,8),c=1;c!=s;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=t,v.val=n(v.index++)),i|=(0<a?1:0)*c,c<<=1;f=w(i);break;case 1:for(i=0,s=Math.pow(2,16),c=1;c!=s;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=t,v.val=n(v.index++)),i|=(0<a?1:0)*c,c<<=1;f=w(i);break;case 2:return""}for(r=u[3]=f,g.push(f);;){if(v.index>e)return"";for(i=0,s=Math.pow(2,d),c=1;c!=s;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=t,v.val=n(v.index++)),i|=(0<a?1:0)*c,c<<=1;switch(f=i){case 0:for(i=0,s=Math.pow(2,8),c=1;c!=s;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=t,v.val=n(v.index++)),i|=(0<a?1:0)*c,c<<=1;u[p++]=w(i),f=p-1,l--;break;case 1:for(i=0,s=Math.pow(2,16),c=1;c!=s;)a=v.val&v.position,v.position>>=1,0==v.position&&(v.position=t,v.val=n(v.index++)),i|=(0<a?1:0)*c,c<<=1;u[p++]=w(i),f=p-1,l--;break;case 2:return g.join("")}if(0==l&&(l=Math.pow(2,d),d++),u[f])h=u[f];else{if(f!==p)return null;h=r+r.charAt(0)}g.push(h),u[p++]=r+h.charAt(0),r=h,0==--l&&(l=Math.pow(2,d),d++)}}}),void 0===(o=function(){return window.LZString}.call(t,n,t,e))||(e.exports=o)}]);
}
}