(function() { var hxsdEventLogJS_1 = function(options) { var _this = this; this.params = []; this.callback = null; this.stime = ""; this.events = { event_cate: "", event_action: "", event_value: "", event_remark: "" }; this._option = { url_host: "https://rzsj.hxsd.tv" }; this.init = function() { _this.stime = new Date; _this.initLogObj(); _this.initSession(); var logUserId = 0; if(typeof(currUserId) != "undefined"){ logUserId = encodeURIComponent(currUserId || '0'); } if(!logUserId){ var cookieUser = this.getCookie('login_userinfo'); if(cookieUser){ cookieUser = decodeURIComponent(cookieUser); var user = JSON.parse(cookieUser); if(user && user.id){ logUserId = user.id; } } } _this.params.push("userid=" + logUserId); _this.bindEvent('beforeunload', function() { if (_this.stime != "") { var etime = new Date; _hxsd_log_m.push(['page', 'unload', etime.getTime() - _this.stime.getTime(), _this.getDateTime(_this.stime)]); } }); if (document) { _this.params.push("domain=" + encodeURIComponent(document.domain || '')); _this.params.push("url=" + encodeURIComponent(document.URL || '')); _this.params.push("title=" + encodeURIComponent(document.title || '')); _this.params.push("referrer=" + encodeURIComponent(document.referrer || '')); } if (window && window.screen) { _this.params.push("sh=" + encodeURIComponent(window.screen.height || 0)); _this.params.push("sw=" + window.screen.width || 0); _this.params.push("cd=" + window.screen.colorDepth || 0); } if (navigator) { _this.params.push("lang=" + encodeURIComponent(navigator.language || '')); _this.params.push("java_enabled=" + encodeURIComponent(navigator.javaEnabled() || 'false')); _this.params.push("cookie=" + encodeURIComponent(navigator.cookieEnabled || '')); _this.params.push("flash=" + encodeURIComponent(_this.flashSwitch())); } else { _this.params.push("lang="); _this.params.push("javaEnabled="); _this.params.push("cookie="); _this.params.push("flash="); } _this.events.event_cate = 'page'; _this.events.event_action = 'view'; _this.events.event_value = '0'; _this.events.event_remark = ''; _this.log(); }; this.initSession = function() { var sessNum = _this.getCookie("_u_sess_num"); if(!sessNum){ sessNum = 0; } _this.setCookie("_u_sess_num", ++sessNum, null, '/'); }; this.initLogObj = function() { var _map = window._hxsd_log_m || []; if (_map) { for (var i in _map) { switch (_map[i][0]) { case '_setAccount': _this.params.push("account=" + encodeURIComponent(_map[i][1])); break; case '_setCallback': _this.callback = _map[i][1] break; default: break; } } } window._hxsd_log_m = { push: function() { if (arguments.length > 1 || arguments.length < 1) { return false; } else { if (arguments[0]) { _this.events.event_cate = ''; _this.events.event_action = ''; _this.events.event_value = '0'; _this.events.event_remark = ''; if (arguments[0][0]) { _this.events.event_cate = arguments[0][0]; } if (arguments[0][1]) { _this.events.event_action = arguments[0][1]; } if (arguments[0][2]) { _this.events.event_value = arguments[0][2]; } if (arguments[0][3]) { _this.events.event_remark = arguments[0][3]; } _this.log(); } } } } }; this.setCookie = function (name, value, expires, path, domain, secure) { // 设置 cookie 值 document.cookie = name + "=" + encodeURIComponent(value) + // 设置过期时间 (expires ? "; expires=" + expires.toGMTString() : "") + // 设置路径 (path ? "; path=" + path : "") + // 设置域名 (domain ? "; domain=" + domain : "") + // 通过 secure 属性,设置只有 HTTPS 环境下才能访问该 cookie (secure ? "; secure" : ""); }; this.flashSwitch = function() { var a = ""; if (navigator.plugins && navigator.mimeTypes.length) { var b = navigator.plugins["Shockwave Flash"]; b && b.description && (a = b.description.replace(/^.*\s+(\S+)\s+\S+$/, "$1")) } else if (window.ActiveXObject) try { if (b = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))(a = b.GetVariable("$version")) && (a = a.replace(/^.*\s+(\d+),(\d+).*$/, "$1.$2")) } catch(d) {} return a }; this.getDateTime = function(myDate) { if (!myDate) { var myDate = new Date(); } var str = ""; str += myDate.getFullYear(); str += "-" + (myDate.getMonth() >= 9 ? (myDate.getMonth() + 1).toString() : '0' + (myDate.getMonth() + 1)); str += "-" + (myDate.getDate() >= 9 ? (myDate.getDate()).toString() : '0' + (myDate.getDate())); str += " " + (myDate.getHours() > 9 ? myDate.getHours().toString() : '0' + myDate.getHours()); str += ":" + (myDate.getMinutes() > 9 ? myDate.getMinutes().toString() : '0' + myDate.getMinutes()); str += ":" + (myDate.getSeconds() > 9 ? myDate.getSeconds().toString() : '0' + myDate.getSeconds()); return str; }; this.bindEvent = function(eventName, func){ if (typeof window.addEventListener != "undefined") { window.addEventListener(eventName, func, false); } else { window.attachEvent("on"+eventName, func); } }; this.getCookie = function(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i