yas.js
4.65 KB
!function(){var n,e,o,a,t,i,r;n=function(n){return n={version:"1.0",yasPath:"/web/",yasDomain:document.domain,yasImgDomain:"http://analytics.yhurl.com"}}(),e=function(e){var o=n,a=o.yasPath,t=o.yasImgDomain;return e.imgSend=function(n,e){var o=new Image(1,1);o.src=t+a+"?"+n,o.onload=function(){o.onload=null,e&&e()}},e}({}),o=function(n){return n.addEventHandler=function(n,e,o){n.addEventListener?n.addEventListener(e,o,!1):n.attachEvent?n.attachEvent("on"+e,o):n["on"+e]=o},n.removeEventHandler=function(n,e,o){n.removeEventListener?n.removeEventListener(e,o,!1):n.detachEvent?n.detachEvent("on"+e,o):delete n["on"+e]},n}({}),a=function(e){{var o=n;o.yaPath,o.yasDomain}return e.flashChecker=function(){var n=0,e=0,o=0,a=null;return o?(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),a&&(n=1,e=a.GetVariable("$version"))):navigator.plugins&&navigator.plugins.length>0&&(a=navigator.plugins["Shockwave Flash"],a&&(n=1,e=a.description.replace("Shockwave Flash",""))),{f:n,v:e}},e.Hash=function(n){var e,o=1,a=0;if(n)for(o=0,e=n.length-1;e>=0;e--)a=n.charCodeAt(e),o=(o<<6&268435455)+a+(a<<14),a=266338304&o,0!==a&&(o^=a>>21);return o},e.Random=function(){return Math.round(2147483647*Math.random())},e.hashClientInfo=function(){var n=window.navigator,o=window.history.length,a=[n.appName,n.version,n.language,n.platform,n.userAgent,n.javaEnabled(),window.screen,window.screen.colorDepth,window.document.cookie?window.document.cookie:"",window.document.referrer?window.document.referrer:""];n=a.join("");for(var t=n.length;o>0;)n+=o--^t++;return e.Hash(n)},e.merge=function(n,e){var o={};for(var a in n)o[a]=n[a];for(var t in e)o[t]=e[t];return o},e.genParam=function(n){var e=[];for(var o in n)e.push(o+"="+n[o]);return e.join("&")},e.trim=function(n){if(String.prototype.trim)return null===n?"":String.prototype.trim.call(n);var e=/^\s+/,o=/\s+$/,a="";return n?(a=n.toString().replace(e,""),a=a.replace(o,"")):void 0},e.getGeo=function(n){function e(e){var o=e.coords.longitude,a=e.coords.latitude;n(a,o)}function o(){n(!1)}if(window.navigator.geolocation){var a={enableHighAccuracy:!0};window.navigator.geolocation.getCurrentPosition(e,o,a)}else n(!1)},e}({}),t=function(n){var e=a;return n=function(n,o,a){if("undefined"==typeof o){var t=null;if(document.cookie)for(var i=document.cookie.split(";"),r=0;r<i.length;r++){var d=e.trim(i[r]);if(d.substring(0,n.length+1)==n+"="){t=decodeURIComponent(d.substring(n.length+1));break}}return t}a=a||{},null===o&&(o="",a.expires=-1);var c="";if(a.expires&&("number"==typeof a.expires||a.expires.toUTCString)){var s;"number"==typeof a.expires?(s=new Date,s.setTime(s.getTime()+24*a.expires*60*60*1e3)):s=a.expires,c="; expires="+s.toUTCString()}var u=a.path?"; path="+a.path:"",v=a.domain?"; domain="+a.domain:"",l=a.secure?"; secure":"";document.cookie=[n,"=",encodeURIComponent(o),c,u,v,l].join("")}}(),i=function(i){function r(n){var e=s.merge(m,h);e=s.merge(e,y);var o=s.genParam(e);n=n?n:function(){},v.imgSend(o,n);var a=u("_yasev");a&&v.imgSend(a,function(){u("_yasev",null,{path:"/",domain:w.yasDomain,expires:73e3})})}function d(){var n=u("_yasv");return n?n:(n=s.Random()^2147483647&s.hashClientInfo(),u("_yasv",n,{path:"/",domain:f,expires:73e3}),n)}function c(n,e,o,a,t){var i=u("_yasev");i?i+="&":i="",u("_yasev",i+"vd="+h.vd+"&t="+n+"&i="+e+"&l="+a+"&v="+t,{path:"/",domain:f,expires:73e3}),k++}var s=a,u=t,v=e,l=o,w=n,f=(w.version,w.yaPath,w.yasDomain),m={h:document.domain,p:window.location.port,u:window.location.pathname,ft:0,fst:0,sv:""},g=d(),h={ak:"",cd:g,vd:(new Date).getTime()+g,ud:"",rf:document.referrer},p=s.flashChecker(),y={sr:window.screen.width+"x"+window.screen.height,wr:window.screen.availWidth+"x"+window.screen.availHeight,sd:window.screen.colorDepth,ln:window.navigator.language?window.navigator.language:window.navigator.browserLanguage,sy:window.navigator.platform,ce:window.navigator.cookieEnabled,fv:p.f?p.v:0},x=function(n,e,o,a,t){if(h.ak=o,m.sv=e,h.ud=a?a:"",u("_yasgeo")){var i=u("_yasgeo").split(",");h.la=i[0],h.lo=i[1],u("_yasgeo",null,{path:"/",domain:w.yasDomain,expires:73e3})}var d=(new Date).getTime(),c=null;m.ft=d-n,l.addEventHandler(window,"load",function(){var e=(new Date).getTime();m.fst=e-n,l.removeEventHandler(window,"load",arguments.callee),window.clearTimeout(c),r()}),c=window.setTimeout(function(){m.fst=0,m.fse=">3s",r()},3e3),t&&s.getGeo(function(n,e){n&&u("_yasgeo",n+","+e,{path:"/",domain:f,expires:73e3})})},k=0;return x.add=function(n,e,o,a,t){k>3?v.imgSend(u("_yasev"),function(){u("_yasev",null,{path:"/",domain:w.yasDomain,expires:73e3}),k=0,c(n,e,o,a,t)}):c(n,e,o,a,t)},i=x}(),r=function(n){var e=i;if(window.YohoAcquisitionObject){var o=window.YohoAcquisitionObject;window[o].p&&(e.apply(this,window[o].p),window[o]=e)}return n=e}()}();