$(function () { setTimeout("$_statnew.onstat()", 10000); console.log("stat load"); }); let isapp2 = 0; console.oldLog = console.log; console.log = function (str) { console.oldLog(str); if (isapp2 == 1) return; if (typeof str != "string") return; if (str.indexOf('FBNav') > -1) { isapp2 = 1; console.log = console.oldLog; } } var $_statnew = new (function () { var state = false; this.onstat = function (n) { if (!state) { state = true; console.log("stat invoke"); var ccname = encodeURIComponent(location.href); if (this.gcc(ccname) == "1") { console.log("stat ignore"); return; } this.scc(ccname, "1"); try { var datestr = Date.parse(new Date())+""; var token = this.jia(datestr, 'asdfasdf'); var isapp1 = typeof (window.FbQuoteShareJSInterface) == "object" ? 1 : 0; var ms = location.hash.match(new RegExp('token=([^&|#]*)')); $.ajax({ url: "//twstat.animefans21.com/stat/in", data: { ds: screen.width + "," + screen.height, ref: (document.referrer ? document.referrer : ""), hash: ms != null ? ms[1] : "", arturl: location.href, token: token, isapp1: isapp1, isapp2: isapp2 }, cache: false, dataType: "script" }); } catch (e) { console.log(e); } } }; this.jia = function (deseninstr, keystr, ivstr = keystr) { if (typeof CryptoJS == "undefined") return ""; var keybyte = CryptoJS.enc.Utf8.parse(keystr); var ivbyte = CryptoJS.enc.Utf8.parse(ivstr); let afterEncrypt = CryptoJS.DES.encrypt(deseninstr, keybyte, { iv: ivbyte, mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).ciphertext.toString() console.log(afterEncrypt) return afterEncrypt } this.scc = function (name, value) { var exp = new Date(); exp.setTime(exp.getTime() + 24 * 60 * 60 * 1000); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/"; }; this.gcc = function (name) { var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)")); if (arr != null) return unescape(arr[2]); return null; }; })();