ya.js 23 KB

1
  1. if(String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")},String.prototype.replaceBlank=function(){return s=this.toString(),s=s.replace(/ /g,""),s=s.replace(/&nbsp;/g,""),s=s.replace(/&/g,"|||"),s=s.replace(/r/g,"")},String.prototype.isNotBlank=function(){var t=this.toString();return""!==t.trim()},String.prototype.isBlank=function(){return""===this.trim()},String.prototype.contains=function(t){return this.indexOf(t)>-1},String.prototype.startWith=function(t){return!t||0===this.length||t.length>this.length?!1:this.substring(0,t.length)===t?!0:!1},"undefined"==typeof YA||!YA)var YA={};YA.namespace=function(){var t,e,a,i=arguments,n=null;for(t=0;t<i.length;t+=1)for(a=i[t].split("."),n=YA,e="YA"==a[0]?1:0;e<a.length;e+=1)n[a[e]]=n[a[e]]||{},n=n[a[e]];return n},YA.namespace("YA.utils","YA.config","YA.report","YA.tools"),YA.namespace("YA.utils"),YA.utils.Class={create:function(){return function(){this.initialize.apply(this,arguments)}},end:""},YA.namespace("YA.config"),YA.config.Config={ap:navigator.appName,av:navigator.appVersion,ua:navigator.userAgent.toLowerCase(),cen:navigator.cookieEnabled?1:0,jen:navigator.javaEnabled()?1:0,lla:navigator.language?navigator.language:navigator.browserLanguage,sre:screen.width+"."+screen.height,sco:parseInt(screen.colorDepth)||parseInt(screen.pixelDepth),__yaParamPrex:"__ya",__yaOnerrorRetry:!0,__debug:!1,enableSplitSessionData:!1,_yaDataCollectUrl:"https:"==document.location.protocol?"https://stat-game.duowan.com/data.do":"http://stat-game.duowan.com/data.do",initConfig:function(){this._constant=YA.utils.Constant,this.referrer=document.referrer,this.refrerrerParam=this._constant.getQueryParam(this.referrer),this.yaLocation=window.location,this.locationParam=this._constant.getQueryParam(this.yaLocation)},getYaParam:function(){return this._constant.getYaParamByPrefix(this.locationParam,this.__yaParamPrex)},getBaseClientInfo:function(){if(this.baseParam)return this.baseParam;var t=new YA.utils.Parameter;return t.add("mid",this.getYamid(this.locationParam.get("mid"))),t.add("bve",this._constant.getBrowerVersion()),t.add("lla",this.lla),t.add("os",this._constant.getOS()),t.add("sco",this.sco),t.add("sre",this.sre),t.add("fve",this._constant.getFlashVersion()),t.add("jav",this.jen),t.add("coo",this.cen),t.add("domain",this._constant.getUrlDomain()),t.add("fla","Y"),t.add("sdk_ver","js-ya-1.3.0"),this.getYaParam().size>0&&t.addAll(this.getYaParam()),this.yaConfigParam.size>0&&t.addAll(this.yaConfigParam),this.baseParam=t,this.baseParam},setYaConfigParam:function(t){var e=new YA.utils.Parameter;if(t)for(var a in t)e.add(a,t[a]);var i=e.get("mid");i&&this.getYamid(i)!=i&&this.setYaMidCookie(i),e.containsKey("error_retry")&&(this.__yaOnerrorRetry=e.get("error_retry")),this.yaConfigParam=e},_yaMidCookieKey:"__yamid",_yaMidCookieTimeout:63072e6,setYaMidCookie:function(t){t&&YA.utils.Cookie.setCookie(this._yaMidCookieKey,t,this._yaMidCookieTimeout)},getYamid:function(t){var e=YA.utils.Cookie,a=e.getCookie(this._yaMidCookieKey);return a?a:(a=t?t:YA.utils.UUID.generate32(),this.setYaMidCookie(a),a)},end:""},YA.namespace("YA.utils"),YA.utils.Constant={encode:function(t){return encodeURIComponent(t)},decode:function(t){return decodeURIComponent(t)},parseToInt:function(t){return isNaN(parseInt(t))?0:parseInt(t)},getOS:function(){var t=navigator.userAgent.toLowerCase(),e=navigator.platform,a="Win32"===e||"Windows"===e,i="Mac68K"===e||"MacPPC"===e||"Macintosh"===e||"MacIntel"===e,n=("ipad"===t.match(/ipad/i),"iphone os"===t.match(/iphone os/i),"X11"===e&&!a&&!i),r=String(e).indexOf("Linux")>-1,s="android"===t.match(/android/i);if(i)return"Mac";if(n)return"Unix";if(r)return s?"Android":"Linux";if(a){var o={ce:"WindowsMobile",mobile:"WindowsMobile","nt 5.0":"Windows2000","nt 5.1":"WindowsXP","nt 5.2":"Windows2003","nt 6.0":"WindowsVista","nt 6.1":"Windows7","nt 6.2":"Windows8",2000:"Windows2000",xp:"WindowsXP",2003:"Windows2003",vista:"WindowsVista",7:"Windows7",8:"Windows8"};for(var d in o)if(t.indexOf("windows "+d)>-1)return o[d]}return"unknown"},getBrowerVersion:function(){var t,e="unknown",a=navigator.userAgent.toLowerCase();return(t=a.match(/msie ([\d.]+)/))?e=t[0]:(t=a.match(/firefox\/([\d.]+)/))?e=t[0]:(t=a.match(/yye\/([\d.]+)/))?e=t[0]:(t=a.match(/chrome\/([\d.]+)/))?e=t[0]:(t=a.match(/opera.([\d.]+)/))?e=t[0]:(t=a.match(/version\/([\d.]+).*safari/))?e=t[0]:0,e},getFlashVersion:function(){var f="0",n=navigator;if(n.plugins&&n.plugins.length){for(var ii=0;ii<n.plugins.length;ii++)if(-1!=n.plugins[ii].name.indexOf("Shockwave Flash")){f=n.plugins[ii].description.split("Shockwave Flash ")[1];break}}else if(window.ActiveXObject)for(var ii=10;ii>=2;ii--)try{var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");if(fl){f=ii+".0";break}}catch(e){}return f.replaceBlank()},getQueryParam:function(t){var e=new YA.utils.Parameter;if(!t)return e;for(s=this.decode(t).replace("?","?&").split("&"),i=0;i<s.length;i++){var a=s[i].split("=");!a||a.length<2||e.add(a[0],a[1])}return e},getUrlDomain:function(t){if(!t)return document.domain;var e=/.*\:\/\/([^\/]*).*/,a=t.match(e),i="";return"undefined"!=typeof a&&null!=a&&(i=a[1]),i},getURILocation:function(t){return this.isURL(t)?t.replace(/(.*\.[\w-]+\/){0,}([^\?]+).*/gi,"$2"):""},isURL:function(t){var e=/^((http|https|ftp):\/\/)?(\w(\:\w)?@)?([0-9a-z_-]+\.)*?([a-z0-9-]+\.[a-z]{2,6}(\.[a-z]{2})?(\:[0-9]{2,6})?)((\/[^?#<>\/\\*":]*)+(\?[^#]*)?(#.*)?)?$/i;return e.test(t)},extractByCutPrefix:function(t,e){return!t instanceof String||!t.startWith(e)?t:t.substring(e.length,t.length)},getYaParamByPrefix:function(t,e,a){var i=new YA.utils.Parameter;if(t)for(var n in t.data)n.startWith(e)?i.add(this.extractByCutPrefix(n,e),t.get(n)):a&&i.add(n,t.get(n));return i},consoleLog:function(t){try{YA.config.Config.__debug&&console.log((new Date).format("yyyy-mm-dd HH:MM:ss")+" - "+t)}catch(e){}},initToolbar:function(){var t=this;if(1==t.enableDeveloperToolbar){if(!jQuery)return void t.consoleLog("the dev toolbar depend on jQuery! but jQuery="+jQuery);var e="https://sz.duowan.com/s/ya/DeveloperToolbar.js";YA.tools.Devtool||jQuery.ajax({url:e,async:!0,dataType:"script"}),YA.tools.Devtool||this.consoleLog("please wait for Devtool init,and try click again! YA.tools.Devtool="+YA.tools.Devtool)}},log2Toolbar:function(t){var e=this;try{if(!jQuery)return void e.consoleLog("the dev toolbar depend on jQuery! but jQuery="+jQuery+",queryStirng="+t);e.initToolbar(),1==e.enableDeveloperToolbar&&YA.tools.Devtool&&jQuery&&YA.tools.Devtool.callDatacheckLog(t),e.consoleLog("call datacheck and show result error! YA.tools.Devtool="+YA.tools.Devtool+",and !jQuery="+(void 0==jQuery))}catch(a){e.consoleLog("do log to toolbar error! e="+a)}},isTestUser:function(t){var e=",bimoziyan0,data_qianduan1,data_qianduan2,data_qianduan3,data_chanpin1,data_chanpin2,data_chanpin3,data_yunying1,data_yunying2,data_yunying3,data_test1,data_test2,data_test3,";return e.indexOf(","+t+",")>-1?!0:!1},end:""},YA.namespace("YA.utils"),YA.utils.Cookie={init:"",getCookieValue:function(t){var e=document.cookie.indexOf(";",t);return-1==e&&(e=document.cookie.length),YA.utils.Constant.decode(document.cookie.substring(t,e))},getCookie:function(t){for(var e=t+"=",a=e.length,i=document.cookie.length,n=0;i>n;){var r=n+a;if(document.cookie.substring(n,r)==e)return this.getCookieValue(r);if(n=document.cookie.indexOf(" ",n)+1,0==n)break}return null},getExpires:function(t){var e=new Date;return e.setTime(e.getTime()+t),e},deleteCookie:function(t){this.setCookie(t,"",0)},setCookie:function(t,e,a){var i=document.domain,e=t+"="+YA.utils.Constant.encode(e)+"; domain="+i+";";a>0&&(e+=" expires="+this.getExpires(a).toGMTString()),document.cookie=e}},YA.namespace("YA.utils"),YA.utils.DateFormat={dateFormat:function(t,e,a){var i=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,n=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,r=/[^-+\dA-Z]/g,s=function(t,e){for(t=String(t),e=e||2;t.length<e;)t="0"+t;return t},o=YA.utils.DateFormat;if(1!=arguments.length||"[object String]"!=Object.prototype.toString.call(t)||/\d/.test(t)||(e=t,t=void 0),t=t?new Date(t):new Date,isNaN(t))throw SyntaxError("invalid date");e=String(o.masks[e]||e||o.masks["default"]),"UTC:"==e.slice(0,4)&&(e=e.slice(4),a=!0);var d=a?"getUTC":"get",u=t[d+"Date"](),l=t[d+"Day"](),c=t[d+"Month"](),h=t[d+"FullYear"](),g=t[d+"Hours"](),m=t[d+"Minutes"](),f=t[d+"Seconds"](),p=t[d+"Milliseconds"](),A=a?0:t.getTimezoneOffset(),v={d:u,dd:s(u),ddd:o.i18n.dayNames[l],dddd:o.i18n.dayNames[l+7],m:c+1,mm:s(c+1),mmm:o.i18n.monthNames[c],mmmm:o.i18n.monthNames[c+12],yy:String(h).slice(2),yyyy:h,h:g%12||12,hh:s(g%12||12),H:g,HH:s(g),M:m,MM:s(m),s:f,ss:s(f),l:s(p,3),L:s(p>99?Math.round(p/10):p),t:12>g?"a":"p",tt:12>g?"am":"pm",T:12>g?"A":"P",TT:12>g?"AM":"PM",Z:a?"UTC":(String(t).match(n)||[""]).pop().replace(r,""),o:(A>0?"-":"+")+s(100*Math.floor(Math.abs(A)/60)+Math.abs(A)%60,4),S:["th","st","nd","rd"][u%10>3?0:(u%100-u%10!=10)*u%10]};return e.replace(i,function(t){return t in v?v[t]:t.slice(1,t.length-1)})},masks:{"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},i18n:{dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},parse:function(t){return"string"==typeof t&&t.isNotBlank()?new Date(Date.parse(t.replace(/-/g,"/"))):null}},Date.prototype.format=function(t,e){return YA.utils.DateFormat.dateFormat(this,t,e)},Date.prototype.yaTimestamp=function(){return this.format("yyyymmddHHMMss")},YA.namespace("YA.utils"),YA.utils.Parameter=YA.utils.Class.create(),YA.utils.Parameter.prototype={initialize:function(){this.data={},this.size=0},data:{},add:function(t,e){t in this.data||this.size++,this.data[t]=e},get:function(t){return this.data[t]},remove:function(t){t in this.data&&(delete this.data[t],this.size--)},addAll:function(t){if(t instanceof YA.utils.Parameter)for(var e in t.data)this.add(e,t.get(e))},addAllIfNoExist:function(t){if(t instanceof YA.utils.Parameter)for(var e in t.data)e in this.data||this.add(e,t.get(e))},containsKey:function(t){return t in this.data},containsValue:function(t){for(var e in this.data)if(this.get(e)===t)return!0;return!1},removeAll:function(t){if(t instanceof YA.utils.Parameter)for(var e in t.data)this.remove(e)},toString:function(){var t="";for(var e in this.data)""!=t&&(t+="&"),t+=e+"="+this.data[e];return t}},YA.namespace("YA.core"),YA.core.Queue={separator:"",defaultLen:10,queueEnable:!1,initialize:function(){this.queue||(this.queue=new Array)},push:function(t,e){var a=this;a.initialize(),a.queueEnable?a.queue.push(t):YA.core.ReportSender.sendData(t),e||(e=a.callback),e(t)},pushAll:function(){this.initialize();for(var t=0;t<arguments.length;t++)this.push(arguments[t])},shift:function(t){this.initialize(),t||(t=this.defaultLen);for(var e=this.queue,a=e.length>t?t:e.length,i=new Array,n=0;a>n;n++)i.push(e.shift());return i.length<1?null:i.join(this.separator)},callback:function(){},end:""},YA.namespace("YA.core"),YA.core.SessionData={defaultSessionIdKey:"product",_yasdatas:"_yasdatas_",_yasids:"_yasids",sessionIds:new YA.utils.Parameter,sDataQueue:new Array,add:function(t,e,a){var i={pro:"",cha:"",rso:""},n=YA.utils.Constant.getQueryParam(e),r=new YA.utils.Parameter;for(var s in i)r.add(s,n.get(s));var o=new YA.utils.Parameter;o.add(t,e),this.sDataQueue.push(o),1==a&&YA.utils.Cookie.setCookie(this._yasdatas+t,r.toString(),-1)},get:function(t){for(var e=null,a=0;a<this.sDataQueue.length;a++)this.sDataQueue[a]instanceof YA.utils.Parameter&&this.sDataQueue[a].containsKey(t)&&(e=this.sDataQueue[a]);if(e instanceof YA.utils.Parameter)return e.get(t);if(null==e){var i=this.getCCParam(this._yasdatas+t);i&&i.size>1&&(i.add("act","/session_data"),i.add("session_id",t),i.addAll(YA.config.Config.getBaseClientInfo()),this.add(t,i.toString()),e=i.toString())}return e},list:function(){var t=new Array,e=new Array,a=YA.core.Queue.separator,n=new YA.utils.Parameter;n.addAll(this.sessionIds),n.addAll(this.getCCParam(this._yasids)),defaultLen=5;for(var r in n.data){var s=this.get(n.get(r));s&&e.push(s),i%defaultLen==0&&(t.push(e.join(a)),e=[])}return t.push(e.join(a)),t},getCCParam:function(t){return YA.utils.Constant.getQueryParam(this.getCCValue(t))},getCCValue:function(t){return YA.utils.Cookie.getCookie(t)},generateSessionId:function(t,e){var a=t?t.toLowerCase():this.defaultSessionIdKey,i=YA.utils.UUID.generate32();if(this.sessionIds.add(a,i),1==e){var n=this.getCCParam(this._yasids);if(!n)var n=new YA.utils.Parameter;n.add(a,i),YA.utils.Cookie.setCookie(this._yasids,n.toString(),-1)}return i},getSessionId:function(t){var e=t?t.toLowerCase():this.defaultSessionIdKey,a=this.sessionIds.get(e);if(!a){var i=this.getCCParam(this._yasids);a=i.get(e),a&&this.sessionIds.add(e,a)}return a},getSessionIdAndGenIfNotExist:function(t,e){var a=this.getSessionId(t);return a||(a=this.generateSessionId(t,e)),a},end:""},YA.namespace("YA.utils"),YA.utils.Timer=YA.utils.Class.create(),YA.utils.Timer.prototype={periodTime:3e5,intervalCouter:0,initialize:function(t){this.startTime=new Date;var e=/^[1-9]+[0-9]*$/;t&&e.test(t)&&(this.periodTime=t)},doInterval:function(t){var e=this;e.sh||(e.sh=setInterval(t,e.periodTime))},clearRefresh:function(){var t=this.sh;clearInterval(t)},end:null},YA.namespace("YA.utils"),YA.utils.UUID={generate32:function(){var t=new Date(1582,10,15,0,0,0,0),e=new Date,a=e.getTime()-t.getTime(),i="",n=YA.utils.UUID,r=n.generateBits(a,0,31),s=n.generateBits(a,32,47),o=n.generateBits(a,48,59)+"1",d=n.generateBits(n.rand(4095),0,7),u=n.generateBits(n.rand(4095),0,7),l=n.generateBits(n.rand(8191),0,7)+n.generateBits(n.rand(8191),8,15)+n.generateBits(n.rand(8191),0,7)+n.generateBits(n.rand(8191),8,15)+n.generateBits(n.rand(8191),0,15);return r+i+s+i+o+i+d+u+i+l},generate:function(t){if(!t)var t=5;var e=(new Date).getTime(),a=YA.utils.UUID,i=a.generateBits(a.rand(8191*t),0,7)+a.generateBits(a.rand(8191*t),8,15)+a.generateBits(a.rand(8191*t),0,3);return i+e},generateBits:function(t,e,a){var i=this.returnBase(t,16),n=new Array,r="",s=0;for(s=0;s<i.length;s++)n.push(i.substring(s,s+1));for(s=Math.floor(e/4);s<=Math.floor(a/4);s++)r+=n[s]&&""!=n[s]?n[s]:"0";return r},returnBase:function(t,e){var a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];if(e>t)var i=a[t];else{var n=""+Math.floor(t/e),r=t-n*e;if(n>=e)var i=this.returnBase(n,e)+a[r];else var i=a[n]+a[r]}return i},rand:function(t){return Math.floor(Math.random()*t)}},YA.config.Config.initConfig(),YA.namespace("YA.core"),YA.core.ReportSender=YA.utils.Class.create(),YA.core.ReportSender={initialize:function(){1==YA.config.Config.enableSplitSessionData&&this.startReportSdata()},reportTimerPeriod:1e3,reportSDataTimerPeriod:144e5,startReport:function(){var t=this;t.reportTimer||(t.reportTimer=new YA.utils.Timer(this.reportTimerPeriod));var e=t.reportTimer,a=YA.core.Queue,i=0;e.doInterval(function(){try{var e=a.shift();i++,e&&t.sendData(e),YA.utils.Constant.consoleLog("reporting reportCount="+i+" queryString="+e)}catch(n){YA.utils.Constant.consoleLog("reporting reportCount="+i+" ,send with exception="+n)}})},startReportSdata:function(){this.reportSdTimer||(this.reportSdTimer=new YA.utils.Timer(this.reportSDataTimerPeriod));var t=this.reportSdTimer,e=this,a=YA.core.SessionData,i=0;t.doInterval(function(){try{var t=a.list();if(i++,t instanceof Array&&t.length>=1)for(var n=0;n<=t.length-1;n++){var r=t[n];r&&r.length>=1&&e.sendData(t[n])}YA.utils.Constant.consoleLog("reporting sessionData reportCount="+i+" queryStrings="+t)}catch(s){YA.utils.Constant.consoleLog("reporting sessionData reportCount="+i+" ,send with exception="+s)}})},sendData:function(t,e,a){return this.doSendData(YA.config.Config._yaDataCollectUrl+"?",t,e,a)},doSendData:function(t,e,a,i){var n=YA.utils.Constant.encode(e.toString())+"&__yafm=i&ati="+(new Date).yaTimestamp(),r=t+n,s=this;a||(a=s.callback);var o=s.newImage(r);o.onload=function(){o.onload=null,a(n)},i||(i=s.errorCallback),o.onerror=function(){o.onerror=null,0!=YA.config.Config.__yaOnerrorRetry&&(this.src=r+"&ati="+(new Date).yaTimestamp(),i(r))}},newImage:function(t){var e=new Image(1,1);return e.src=t,e},callback:function(t){1==YA.utils.Constant.enableDeveloperToolbar&&YA.utils.Constant.log2Toolbar(t)},errorCallback:function(){},end:""},YA.namespace("YA.report"),YA.report.PAS=YA.utils.Class.create(),YA.report.PAS.prototype={initialize:function(t,e){this._queue=YA.core.Queue;var a=new YA.utils.Parameter;t&&a.add("pro",t),e&&a.add("pas",e),a.add("dty","pas"),this.param=a},getSidKey:function(){var t=this.param;return t.get("pro")+"-"+t.get("pas")},setParam:function(t,e){this.param&&this.param.add(t,e)},setExtParam:function(t){if(t){var e=YA.utils.Constant,a=e.getYaParamByPrefix(e.getQueryParam(t),YA.config.Config.__yaParamPrex,!0);this.param.addAll(a)}},getPasParam:function(t,e){var a=new YA.utils.Parameter;if(a.addAll(this.param),t)for(var i in t)a.add(i,t[i]);return a.addAll(YA.utils.Constant.getQueryParam(e)),a},reportSessionData:function(t,e){var a=this.getSessionData(t,e),i=a.get("session_id");YA.core.SessionData.add(i,a.toString(),!0),this._queue.push(a.toString())},getSessionData:function(t,e){var a=new YA.utils.Parameter;a.add("act","/session_data");var i=YA.core.SessionData.getSessionIdAndGenIfNotExist(this.getSidKey(),!0);return a.add("session_id",i),a.addAll(YA.config.Config.getBaseClientInfo()),a.addAll(this.getPasParam(t,e)),a},reportEvent:function(t,e){return this.reportEventBase(this.getPasParam(t,e))},reportEventBase:function(t){var e=this.getSessionData();e.remove("act"),e.add("act","/event"),e.addAll(this.getTransmitParam()),e.addAll(t),this._queue.push(e.toString())},getTransmitParam:function(){var t=YA.core.SessionData.getSessionIdAndGenIfNotExist(this.getSidKey()),e=YA.core.SessionData.get(t),a=YA.utils.Constant.getQueryParam(e),i=new YA.utils.Parameter,n={pro:"",session_id:""};for(var r in a.data)r in n&&i.add(r,a.get(r));return i},reportStartUp:function(t,e){1==YA.config.Config.enableSplitSessionData&&this.reportSessionData(t,e);var a=this.getPasParam(t,e);a.add("eid","startup"),this.reportEventBase(a)},startHeartbeat:function(t,e){var a=this.getPasParam(t,e);a.add("eid","heartbeat");var i=YA.utils.Timer.periodTime;t&&t.hbPeriodTime&&(i=t.hbPeriodTime);var n=new YA.utils.Timer(i);this.heartbeatTimer=n;var r=this,s=0;n.doInterval(function(){try{a.add("dur",(s+1)*n.periodTime/1e3),r.reportEventBase(a),s++,n.intervalCouter=s,YA.utils.Constant.consoleLog("pas heartbeating heartbeatCount="+s+", _param="+a)}catch(t){YA.utils.Constant.consoleLog("pas heartbeating heartbeatCount="+s+" ,send with exception="+t)}})},reportEndUp:function(t,e){var a=this.getPasParam(t,e);a.add("eid","endup");var i=this.heartbeatTimer;if(i){a.add("dur",parseInt((new Date).getTime()-i.startTime.getTime())),this.reportEventBase(a),YA.utils.Constant.consoleLog("endup endUp.intervalCouter="+i.intervalCouter+", _param:"+a);var n=YA.core.SessionData.getSessionIdAndGenIfNotExist(this.getSidKey()),r=YA.core.SessionData.get(n);this._queue.push(r.toString())}},end:""},YA.config.Config.initConfig(),YA.namespace("YA.report"),YA.report.GAS=YA.utils.Class.create(),YA.report.GAS.prototype={initialize:function(t,e){this.queue=YA.core.Queue,this.config=YA.config.Config,this.sessionData=YA.core.SessionData;var a=new YA.utils.Parameter;t&&a.add("pro",t),e&&a.add("pas",e),a.add("dty","gas"),this.param=a},setParam:function(t,e){this.param&&this.param.add(t,e)},setExtParam:function(t){if(t){var e=YA.utils.Constant,a=e.getYaParamByPrefix(e.getQueryParam(t),YA.config.Config.__yaParamPrex,!0);this.param.addAll(a)}},reportGlobalSessionData:function(t,e){var a=this.sessionData.getSessionIdAndGenIfNotExist(this.param.get("pro")+"_"+this.param.get("pas"),!0),i=this.initParam(t,e,!0);i.add("act","/session_data"),i.add("session_id",a),i.add("session_type","global");var n=i.toString();this.queue.push(n),this.sessionData.add(a,n,!0)},reportGlobalEvent:function(t,e){var a=this.initParam(t,e,!1);a.add("act","/event"),a.add("session_id",this.sessionData.getSessionIdAndGenIfNotExist(this.param.get("pro")+"_"+this.param.get("pas"),!0)),this.queue.push(a.toString())},reportStartUp:function(t,e){var a=this.reportGameSessionData(t,e),i=this.initParam(t,e,!1);i.add("act","/event"),i.add("session_id",a),i.add("eid","startup"),this.queue.push(i.toString())},reportGameSessionData:function(t,e){var a=this.sessionData.generateSessionId(t.gam+"_"+t.gse,!1),i=this.initParam(t,e,!0);i.add("act","/session_data"),i.add("session_id",a),i.add("session_type","game");var n=i.toString();return this.queue.push(n),this.sessionData.add(a,n,!1),a},startHeartbeat:function(t,e){var a=this.initParam(t,e,!1);a.add("act","/event"),a.add("eid","heartbeat");var i=new YA.utils.Timer(t.hbPeriodTime);this.heartbeatTimer=i;var n=this,r=0;i.doInterval(function(){try{a.add("session_id",n.sessionData.getSessionIdAndGenIfNotExist(t.gam+"_"+t.gse,!1)),a.add("dur",(r+1)*i.periodTime),n.queue.push(a.toString()),r++,i.intervalCouter=r}catch(e){YA.utils.Constant.consoleLog("gas heartbeating heartbeatCount="+r+" ,send with exception="+e)}})},reportGameEvent:function(t,e){var a=this.sessionData.getSessionId(t.gam+"_"+t.gse);a||(a=this.reportGameSessionData(t,e),t.special_game_event="1");var i=this.initParam(t,e,!1);i.add("act","/event"),i.add("session_id",a),this.queue.push(i.toString())},reportEndUp:function(t,e){var a=this.sessionData.getSessionId(t.gam+"_"+t.gse),i=this.initParam(t,e,!1);i.add("act","/event"),i.add("eid","endup"),i.add("session_id",a);var n=this.heartbeatTimer;i.add("dur",n.intervalCouter*n.periodTime),this.queue.push(i.toString()),this.queue.push(this.sessionData.get(a))},initParam:function(t,e,a){var i=new YA.utils.Parameter;for(var n in t)i.add(n,t[n]);return i.addAll(YA.utils.Constant.getQueryParam(e)),i.addAll(this.param),1==a&&(i.addAll(this.config.getBaseClientInfo()),this.specialBusiness(i)),i},specialBusiness:function(t){for(var e=["pro","rso","ref","rso_desc","ref_desc"],a=0;a<e.length;a++){var i=this.config.locationParam.get(e[a]);!t.get(e[a])&&i&&t.add(e[a],i)}},end:""},YA.config.Config.initConfig(),YA.core.ReportSender.initialize(),YA.namespace("YA.report"),YA.report.YYAnalytics=YA.utils.Class.create(),YA.report.YYAnalytics.prototype={initialize:function(t,e,a){this.pas=new YA.report.PAS(t,e),this.gas=new YA.report.GAS(t,e),"http:"==document.location.protocol&&this.isInitTestToolbar(e),YA.config.Config.setYaConfigParam(a)},setParam:function(t,e){this.pas.setParam(t,e),this.gas.setParam(t,e)},setExtParam:function(t){this.pas.setExtParam(t),this.gas.setExtParam(t)},isInitTestToolbar:function(t){1==YA.utils.Constant.isTestUser(t)&&(YA.utils.Constant.enableDeveloperToolbar=!0,YA.utils.Constant.initToolbar())},reportProductStartUp:function(t,e){this.pas.reportStartUp(t,e)},startProductHeartbeat:function(t,e){this.pas.startHeartbeat(t,e)},reportProductEndUp:function(t,e){this.pas.reportEndUp(t,e)},reportProductEvent:function(t,e){var a=this;a.pas.reportEvent(t,e)},reportGameStartUp:function(t,e){this.gas.reportStartUp(t,e)},startGameHeartbeat:function(t,e){this.gas.startHeartbeat(t,e)},reportGameEvent:function(t,e){this.gas.reportGameEvent(t,e)},reportGameEndUp:function(t,e){this.gas.reportEndUp(t,e)},end:""};