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(/ /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;t0&&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=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\/\\*":]*)+(\?[^#]*)?(#.*)?)?$/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.length99?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;tt?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;a1&&(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;st)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