var param={}; var link = window.location.href; var host = window.location.host; var referrer = trim(document.referrer); var titleName = document.title; var selfsrc = document.scripts[document.scripts.length - 1].src; param["host"]=host; param["rf"]=encodeUrl(referrer); param["rfk"]=getKeyword(referrer); param["url"]=encodeUrl(link); param["title"]=encodeURIComponent(titleName); param["br"]=getBr(); param["scr"]=screen.width+"x"+screen.height; param["sys"]=getOS(); param["lang"]=encodeURIComponent(getLan()); param["cid"]=req(selfsrc,"cid"); param["coid"]=req(selfsrc,"coid"); param["sid"]=req(selfsrc,"sid"); var dest = selfsrc.substring(0,selfsrc.indexOf("/common/stat.js")); dest = dest+"/stat?" //stat(); function stat(){ var s = document.createElement("script"); s.src = dest+mergeParam(param); (document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(s); } function onOut(){ stat(); } var loadtime = new Date().getTime(); function KeepAlive(){ var t = new Date().getTime(); // console.log(t-loadtime); if(t-loadtime>60000){ loadtime = t; stat(); } } if(!window.name) {//绗竴娆℃墦寮€ stat(); window.name = "shtml"; localStorage.clear(); } else if(window.attachEvent){ window.attachEvent("onbeforeunload",onOut); document.attachEvent("onmousemove",KeepAlive); window.attachEvent("onscroll",KeepAlive); }else if(window.addEventListener){ window.addEventListener('beforeunload',onOut,false); document.addEventListener("mousemove",KeepAlive,false); window.addEventListener("scroll",KeepAlive,false); } function encodeUrl(str){ return encodeURI(str).replace(/=/g,"%3D").replace(/\+/g,"%2B").replace(/\?/g,"%3F").replace(/\&/g,"%26").replace(/\#/g,"%23"); } function mergeParam(map){ var sb = []; for(var prop in map){ if(map[prop]){ sb.push(prop+"="+trim(map[prop])); } } return sb.join("&"); } function trim(str){ return str.replace(/(^\s*)|(\s*$)/g,""); } function req(url, paras) { var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&"); var paraObj = {} for (i = 0; j = paraString[i]; i++) { paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length); } var returnValue = paraObj[paras.toLowerCase()]; if (typeof (returnValue) == "undefined") { return ""; } else { return returnValue; } } function getOS() { var ua = navigator.userAgent.toLowerCase(); isWin8 = ua.indexOf("nt 6.2") > -1 isWin7 = ua.indexOf("nt 6.1") > -1 isVista = ua.indexOf("nt 6.0") > -1 isWin2003 = ua.indexOf("nt 5.2") > -1 isWinXp = ua.indexOf("nt 5.1") > -1 isWin2000 = ua.indexOf("nt 5.0") > -1 isWindows = (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) isMac = (ua.indexOf("macintosh") != -1 || ua.indexOf("mac os x") != -1) isAir = (ua.indexOf("adobeair") != -1) isLinux = (ua.indexOf("linux") != -1) isAndroid = ua.match(/android/i) === "android" isIpad = ua.match(/ipad/i) === "ipad" isIphoneOs = ua.match(/iphone os/i) === "iphone os" var broser = ""; if (isWin7) { sys = "Windows 7"; } else if (isWin8) { sys = "Windows 8"; } else if (isVista) { sys = "Vista"; } else if (isWinXp) { sys = "Windows XP"; } else if (isWin2003) { sys = "Windows 2003"; } else if (isWin2000) { sys = "Windows 2000"; } else if (isWindows) { sys = "Windows"; } else if (isMac) { sys = "Macintosh"; } else if (isAir) { sys = "Adobeair"; } else if (isLinux) { sys = "Linux"; } else if (isAndroid) { sys = "Android"; } else if (isIpad) { sys = "IPad"; } else if (isIphoneOs) { sys = "Iphone"; } else { sys = "鍏朵粬"; } return sys; } function getBr() { var userAgent = navigator.userAgent, rMsie = /(msie\s|trident.*rv:)([\w.]+)/, rFirefox = /(firefox)\/([\w.]+)/, rOpera = /(opera).+version\/([\w.]+)/, rChrome = /(chrome)\/([\w.]+)/, rSafari = /version\/([\w.]+).*(safari)/; var browser; var version; var ua = userAgent.toLowerCase(); function uaMatch(ua){ var match = rMsie.exec(ua); if(match != null){ return { browser : "IE", version : match[2] || "0" }; } var match = rFirefox.exec(ua); if (match != null) { return { browser : match[1] || "", version : match[2] || "0" }; } var match = rOpera.exec(ua); if (match != null) { return { browser : match[1] || "", version : match[2] || "0" }; } var match = rChrome.exec(ua); if (match != null) { //chrome杩斿洖浠e彿 return { browser : 'chrome' || "", version : "" }; } var match = rSafari.exec(ua); if (match != null) { return { browser : match[2] || "", version : match[1] || "0" }; } if (match != null) { return { browser : "", version : "0" }; } } var browserMatch = uaMatch(userAgent.toLowerCase()); if (browserMatch.browser){ browser = browserMatch.browser; version = browserMatch.version; } return (browser+version); } function getLan() { var lan = ''; if (navigator.systemLanguage != "undefined" && navigator.systemLanguage != null) { lan = navigator.systemLanguage; } else { lan = navigator.language; } var lang = lan.substr(0,2); if(lang == "zh"){ return "涓枃"; }else if(lang == "af"){ return "鑽峰叞璇?; }else if(lang == "sq"){ return "闃垮皵宸村凹浜氳"; }else if(lang == "er"){ return "闃挎媺浼"; }else if(lang == "hy"){ return "浜氱編灏间簹璇?; }else if(lang == "az"){ return "闃垮鎷滅枂璇?; }else if(lang == "eu"){ return "宸存柉鍏嬭"; }else if(lang == "bg"){ return "淇濆姞鍒╀簹璇?; }else if(lang == "hr"){ return "鍏嬬綏鍩冭タ浜氳"; }else if(lang == "cs"){ return "鎹峰厠璇?; }else if(lang == "en"){ return "鑻辫"; }else if(lang == "et"){ return "鐖辨矙灏间簹璇?; }else if(lang == "fr"){ return "娉曡"; }else if(lang == "de"){ return "寰疯"; }else if(lang == "it"){ return "鎰忓ぇ鍒╄"; }else if(lang == "ja"){ return "鏃ヨ"; }else if(lang == "ko"){ return "闊╄"; }else if(lang == "no"){ return "钂欒"; }else if(lang == "ru"){ return "淇勮"; }else if(lang == "es"){ return "瑗跨彮鐗欒"; }else if(lang == "th"){ return "娉拌"; }else if(lang == "vi"){ return "瓒婂崡璇?; }else{ return lan.toLowerCase(); } } // 鑾峰彇鏉ヨ嚜鎼滅储寮曟搸鐨勫叧閿瘝 function getKeyword(url) { if (url.toString().indexOf(".baidu.com") > 0) { return req(url, "wd"); } else if (url.toString().indexOf(".so.com") > 0 || url.toString().indexOf(".haosou.com") > 0 || url.toString().indexOf(".chinaso.com") > 0 || url.toString().indexOf(".youdao.com") > 0) { return req(url, "q"); } else if (url.toString().indexOf("google") > 0) { return req(url, "q"); } else if (url.toString().indexOf(".zhongsou.com") > 0) { return req(url, "w"); } else if (url.toString().indexOf(".sogou.com") > 0) { return req(url, "query"); } else if (url.toString().indexOf(".soso.com") > 0) { return req(url, "query"); } else { return ""; } }