e132f54e05fb989f79b203f3615878e613d792fa260fdea74190aa92623570f3

Source Code:

(function(g){var d=false,b=true,l="i-mobile.co.jp";if(!("SPDemographic" in g))return;var c={defaultXid:"00000000-0000-0000-0000-000000000000",serverName:"spdmg-backend.i-mobile.co.jp",handler_tk_adv:"tr_adv.ashx",handler_tk_idgenerator:"tr_xid.ashx",scheme:"https",siteIdKey:"sid",xIdKey:"xid",visitedKeyPrefix:"visited_",trafficCheckAdSiteIDs:"2919,2292,3139,3441,2745,1357,4608".split(","),histryDateKeyIndex:0,maxLimitReferrerLength:250};c.url_tk_adv=c.scheme+"://"+c.serverName+"/"+c.handler_tk_adv;c.url_tk_idgenerator=c.scheme+"://"+c.serverName+"/"+c.handler_tk_idgenerator;c.url_sync=c.scheme+"://"+c.serverName+"/script/sync.js";var a={INIT:1001,CHECK_OPTOUT:1002,IS_GENERATABLE_XID:1003,IS_EXIST_XID:1004,REQUEST_NO_STORAGE_ADV:1005,REQUEST_NO_XID_ADV:1006,REQUEST_ADV:1007,CHECK_SITE_TRAFFIC:1008,MANAGE_SITE_TRAFFIC:1009,END:2001,IDLE:2002,RESUME:2003},h={ERROR:1e4,TRAFFIC_NO_REQUEST:10001,GENERATE_XID_WAIT:10002,XID_ADSITE_VISIT:10003,XID_OPTOUT:10004},f=g.SPDemographic.createStorageInstance(l,parseInt("730",10)),k=g.SPDemographic.createStorageInstance(l,parseInt("1",10)),j=g.SPDemographic.createHttpConnectionInstance(),e=new n;function i(){}i.prototype=g.SPDemographic.createHttpConnectionCallbackInstance();i.prototype.onSuccess=function(b){var c=b.replace(/["'{}\s]/g,""),a=c.split(":");a.length==2&&f.setItem(a[0],a[1]);e.userAdSiteVisit();e.requestSync()};function n(){var a=null,e=this;e.initialize=function(d,e,c){var b=this;b.siteId=d;b.cq=e;b.referrer=c;b.xid=a};e.getXid=function(){var b=this.xid;if(b==a)this.xid=f.getItem(c.xIdKey);return this.xid};e.setXid=function(a){this.xid=a};e.getVisitedStorageKey=function(){return c.visitedKeyPrefix+this.siteId};e.setVisitedHistory=function(c){var a=[];a.push(c.dateKey);for(var d=c.cqs.length,b=0;b<d;b++)a.push(c.cqs[b]);k.setItem(this.getVisitedStorageKey(),a.join(","))};e.getVisitedHistory=function(){var d={dateKey:-1,cqs:[]};try{var f=k.getItem(this.getVisitedStorageKey());if(f==a)return d;for(var e=f.split(","),g=e.length,b=0;b<g;b++){if(b===c.histryDateKeyIndex){d.dateKey=e[b];continue}d.cqs.push(e[b])}}catch(h){}return d};e.executeTrafficManage=function(){var e=this;try{var c=e.getVisitedHistory(),i=new Date,h=i.getMonth()+1+"-"+i.getDate(),f=e.getCustomQuery();if(f==a)f="(null)";if(c.dateKey!==h){c.dateKey=h;c.cqs=[f];e.setVisitedHistory(c);return b}for(var j=c.cqs.length,g=0;g<j;g++)if(c.cqs[g]===e.getCustomQuery())return d;c.cqs.push(f);e.setVisitedHistory(c)}catch(k){}return b};e.isTrafficCheckSite=function(){var e=c.trafficCheckAdSiteIDs,f=e.length;if(f===0)return d;if(e[0]==="*")return b;for(var a=0;a<f;a++)if(e[a]===this.getSiteId())return b;return d};e.getSiteId=function(){return this.siteId};e.getCustomQuery=function(){return this.cq};e.getReferrer=function(){if(!this.referrer)return a;return this.referrer.substring(0,c.maxLimitReferrerLength)};e.storageEnable=function(){return f.available()};e.requestXidGenerate=function(){var d=new i,e=this.getSiteId(),b=c.url_tk_idgenerator,a=c.siteIdKey+"="+e;j.connectToServerAsync(b+"?"+a,d);return b+"?"+a};e.userAdSiteVisit=function(){return this._requestAdSiteVisit(this.getXid())};e._requestAdSiteVisit=function(h){var g=this.getSiteId(),f=this.getCustomQuery(),d=this.getReferrer(),b=c.siteIdKey+"="+g+"&"+c.xIdKey+"="+h;if(f)b+="&cq="+encodeURIComponent(f);if(d)b+="&referrer="+d;var e=c.url_tk_adv;j.connectToServerAsync(e+"?"+b,a);return e+"?"+b};e.requestSync=function(){f.needSync(c.xIdKey)&&setTimeout(function(){var a=document.createElement("script");a.type="text/javascript";a.src=c.url_sync;document.body.appendChild(a)},0)};e.getResponseText=function(){return j.getResponseText()};e.isExistXid=function(){if(f.getItem(c.xIdKey)==a)return d;else return b};e.isOptOut=function(a){var c=g.SPDemographic.isOptOut(a);if(c==b)return b;else return d}}function m(){var g=this;g.execute=function(c,b,a){e.initialize(c,b,a);this.execAllTask()};g.getResultCode=function(){return this.resultCode};g.initialize=function(){this.currentState=a.INIT;this.resultCode=h.ERROR};g.execAllTask=function(){var b=this;b.initialize();while(b.currentState!=a.END){b.execStateTask();if(b.currentState==a.IDLE)break}b.currentState=a.INIT};g.execStateTask=function(){var g=this;switch(g.currentState){case a.INIT:g.currentState=a.CHECK_OPTOUT;break;case a.CHECK_OPTOUT:if(e.isOptOut(f)==b){g.currentState=a.END;g.resultCode=h.XID_OPTOUT;break}else{g.currentState=a.IS_GENERATABLE_XID;break}case a.IS_GENERATABLE_XID:if(e.storageEnable()==b)g.currentState=a.IS_EXIST_XID;else g.currentState=a.REQUEST_NO_STORAGE_ADV;break;case a.IS_EXIST_XID:if(e.isExistXid()==d)g.currentState=a.REQUEST_NO_XID_ADV;else{f.innerSync(c.xIdKey);g.currentState=a.CHECK_SITE_TRAFFIC}break;case a.REQUEST_NO_STORAGE_ADV:e.setXid(c.defaultXid);g.currentState=a.CHECK_SITE_TRAFFIC;break;case a.REQUEST_NO_XID_ADV:e.requestXidGenerate();g.currentState=a.END;g.resultCode=h.GENERATE_XID_WAIT;break;case a.CHECK_SITE_TRAFFIC:if(e.isTrafficCheckSite())g.currentState=a.MANAGE_SITE_TRAFFIC;else g.currentState=a.REQUEST_ADV;break;case a.MANAGE_SITE_TRAFFIC:if(e.executeTrafficManage())g.currentState=a.REQUEST_ADV;else{g.resultCode=h.TRAFFIC_NO_REQUEST;g.currentState=a.END}break;case a.REQUEST_ADV:e.userAdSiteVisit();g.currentState=a.END;g.resultCode=h.XID_ADSITE_VISIT;break;case a.RESUME:g.currentState=a.REQUEST_ADV}};g.resumeTask=function(){while(this.currentState!=a.END){this.execTask();if(this.currentState==a.IDLE)break}}}g.SPDemographic.createAdSiteVisitInstance=function(){return new m}})(window)