yas.js
10.4 KB
!function(){var yohojson2_100_json2,yas_jssdk_1015_src_config,yas_jssdk_1015_src_cross,yas_jssdk_1015_src_event,yas_jssdk_1015_src_util,yas_jssdk_1015_src_cookie,yas_jssdk_1015_src_ya,yas_jssdk_1015_yas;yohojson2_100_json2=function(){"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,function(e){var n=meta[e];return"string"==typeof n?n:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,n){var t,r,o,a,i,s=gap,u=n[e];switch(u&&"object"==typeof u&&"function"==typeof u.toJSON&&(u=u.toJSON(e)),"function"==typeof rep&&(u=rep.call(n,e,u)),typeof u){case"string":return quote(u);case"number":return isFinite(u)?String(u):"null";case"boolean":case"null":return String(u);case"object":if(!u)return"null";if(gap+=indent,i=[],"[object Array]"===Object.prototype.toString.apply(u)){for(a=u.length,t=0;a>t;t+=1)i[t]=str(t,u)||"null";return o=0===i.length?"[]":gap?"[\n"+gap+i.join(",\n"+gap)+"\n"+s+"]":"["+i.join(",")+"]",gap=s,o}if(rep&&"object"==typeof rep)for(a=rep.length,t=0;a>t;t+=1)"string"==typeof rep[t]&&(r=rep[t],o=str(r,u),o&&i.push(quote(r)+(gap?": ":":")+o));else for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(o=str(r,u),o&&i.push(quote(r)+(gap?": ":":")+o));return o=0===i.length?"{}":gap?"{\n"+gap+i.join(",\n"+gap)+"\n"+s+"}":"{"+i.join(",")+"}",gap=s,o}}var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,n,t){var r;if(gap="",indent="","number"==typeof t)for(r=0;t>r;r+=1)indent+=" ";else"string"==typeof t&&(indent=t);if(rep=n,n&&"function"!=typeof n&&("object"!=typeof n||"number"!=typeof n.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,n){var t,r,o=e[n];if(o&&"object"==typeof o)for(t in o)Object.prototype.hasOwnProperty.call(o,t)&&(r=walk(o,t),void 0!==r?o[t]=r:delete o[t]);return reviver.call(e,n,o)}var j;if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()}(),yas_jssdk_1015_src_config=function(e){function n(){var e=document.domain.split("."),n=e.length;return n>1&&isNaN(e[n-1])?"."+e[n-2]+"."+e[n-1]:document.domain}return e={version:"1.0",yasPath:"/web/",yasDomain:n(),yasImgDomain:"http://analytics.m.yohobuy.com/yas.gif"}}(),yas_jssdk_1015_src_cross=function(e){var n=yas_jssdk_1015_src_config,t=n.yasPath,r=n.yasImgDomain;return e.imgSend=function(e,n){var o=new Image(1,1);o.src=r+t+"?"+e,o.onload=function(){o.onload=null,n&&n()}},e}({}),yas_jssdk_1015_src_event=function(e){return e.addEventHandler=function(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent?e.attachEvent("on"+n,t):e["on"+n]=t},e.removeEventHandler=function(e,n,t){e.removeEventListener?e.removeEventListener(n,t,!1):e.detachEvent?e.detachEvent("on"+n,t):delete e["on"+n]},e}({}),yas_jssdk_1015_src_util=function(e){{var n=yas_jssdk_1015_src_config;n.yaPath,n.yasDomain}return e.flashChecker=function(){var e=0,n=0,t=0,r=null;return t?(r=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),r&&(e=1,n=r.GetVariable("$version"))):navigator.plugins&&navigator.plugins.length>0&&(r=navigator.plugins["Shockwave Flash"],r&&(e=1,n=r.description.replace("Shockwave Flash",""))),{f:e,v:n}},e.Hash=function(e){var n,t=1,r=0;if(e)for(t=0,n=e.length-1;n>=0;n--)r=e.charCodeAt(n),t=(t<<6&268435455)+r+(r<<14),r=266338304&t,0!==r&&(t^=r>>21);return t},e.Random=function(){return Math.round(2147483647*Math.random())},e.hashClientInfo=function(){var n=window.navigator,t=window.history.length,r=[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=r.join("");for(var o=n.length;t>0;)n+=t--^o++;return e.Hash(n)},e.merge=function(e,n){var t={};for(var r in e)t[r]=e[r];for(var o in n)t[o]=n[o];return t},e.genParam=function(e){var n=[];for(var t in e)n.push(t+"="+e[t]);return n.join("&")},e.trim=function(e){if(String.prototype.trim)return null===e?"":String.prototype.trim.call(e);var n=/^\s+/,t=/\s+$/,r="";return e?(r=e.toString().replace(n,""),r=r.replace(t,"")):void 0},e.getGeo=function(e){function n(n){var t=n.coords.longitude,r=n.coords.latitude;e(r,t)}function t(){e(!1)}if(window.navigator.geolocation){var r={enableHighAccuracy:!0};window.navigator.geolocation.getCurrentPosition(n,t,r)}else e(!1)},e}({}),yas_jssdk_1015_src_cookie=function(e){var n=yas_jssdk_1015_src_util;return e=function(e,t,r){if("undefined"==typeof t){var o=null;if(document.cookie)for(var a=document.cookie.split(";"),i=0;i<a.length;i++){var s=n.trim(a[i]);if(s.substring(0,e.length+1)==e+"="){o=decodeURIComponent(s.substring(e.length+1));break}}return o}r=r||{},null===t&&(t="",r.expires=-1);var u="";if(r.expires&&("number"==typeof r.expires||r.expires.toUTCString)){var c;"number"==typeof r.expires?(c=new Date,c.setTime(c.getTime()+24*r.expires*60*60*1e3)):c=r.expires,u="; expires="+c.toUTCString()}var f=r.path?"; path="+r.path:"",d=r.domain?"; domain="+r.domain:"",l=r.secure?"; secure":"";document.cookie=[e,"=",encodeURIComponent(t),u,f,d,l].join("")}}(),yas_jssdk_1015_src_ya=function(e){function n(e){var n=i.merge(l,g);n=i.merge(n,v);var t=r();t&&(n=i.merge(n,t),s("_yasmp",null,{path:"/",domain:f.yasDomain,expires:73e3}));var o=s("_yascustjson");if(o){var a=JSON.parse(o);n=i.merge(n,a),s("_yascustjson",null,{path:"/",domain:f.yasDomain,expires:73e3})}var c=s("_yaserror");if(c){var d=JSON.parse(c);n=i.merge(n,d),s("_yaserror",null,{path:"/",domain:f.yasDomain,expires:73e3})}var p=i.genParam(n);e=e?e:function(){},u.imgSend(p,e);var _=s("_yasev");_&&u.imgSend(_,function(){s("_yasev",null,{path:"/",domain:f.yasDomain,expires:73e3})})}function t(){var e=s("_yasvd");return e?{cid:e,isNew:"N"}:(e=i.Random()^2147483647&i.hashClientInfo(),s("_yasvd",e,{path:"/",domain:d,expires:73e3}),{cid:e,isNew:"Y"})}function r(){var e=s("_yasmp");if(e){var n=e.split(",");if(3===n.length)return{x:n[0],y:n[1],et:n[2]};if(4===n.length)return{x:n[0],y:n[1],et:n[2],ix:n[3]}}return null}function o(e){var n=0,t=0;return e.pageX||e.pageY?(n=e.pageX,t=e.pageY):(e.clientX||e.clientY)&&(n=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,t=e.clientY+document.body.scrollTop+document.documentElement.scrollTop),n-=window.screen.width/2,t=window.screen.height/2-t,{x:n,y:t}}function a(e,n,t,r,o){var a=s("_yasev");a?a+="&":a="",s("_yasev",a+"vd="+g.vd+"&t="+e+"&i="+n+"&l="+r+"&v="+o,{path:"/",domain:d,expires:73e3}),m++}var i=yas_jssdk_1015_src_util,s=yas_jssdk_1015_src_cookie,u=yas_jssdk_1015_src_cross,c=yas_jssdk_1015_src_event,f=yas_jssdk_1015_src_config,d=(f.version,f.yaPath,f.yasDomain),l={h:document.domain,p:window.location.port,u:window.location.pathname,ft:0,fst:0,sv:"",ab:s("ab_5")||""},p=t(),g={ak:"",cd:p.cid,vd:(new Date).getTime()+p.cid,ud:"",rf:document.referrer,ckf:p.isNew},_=i.flashChecker(),v={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:_.f?_.v:0},y=function(e,t,r,a,u,p){function _(e,n,t){j="This page contains error! \n\n",j+="Error message is\uff1a"+e+"\n",j+="URL is: "+n+"\n",j+="Line is\uff1a"+t+"\n\n";var r=JSON.stringify({er:j});return s("_yaserror",r,{path:"/",domain:d,expires:73e3}),!1}if(g.ak=r,l.sv=t,g.ud=a?a:"",s("_yasgeo")){var v=s("_yasgeo").split(",");g.la=v[0],g.lo=v[1],s("_yasgeo",null,{path:"/",domain:f.yasDomain,expires:73e3})}var y=(new Date).getTime(),m=null,h=!1;if(l.ft=y-e,c.addEventHandler(window,"load",function(){var t=(new Date).getTime();l.fst=t-e,c.removeEventHandler(window,"load",arguments.callee),window.clearTimeout(m),h||n()}),m=window.setTimeout(function(){l.fst=0,l.fse=">3s",h=!0,n()},3e3),u&&i.getGeo(function(e,n){e&&s("_yasgeo",e+","+n,{path:"/",domain:d,expires:73e3})}),p&&p[0])for(var w=0,x=p.length;x>w;w++)p[w].setAttribute("yoho_index",w+1);else c.addEventHandler(document,"click",function(e){e=e||window.event;var n=e.target||e.srcElement;if(n&&("A"===n.nodeName||"IMG"===n.nodeName&&"A"===n.parentNode.nodeName)){var t=o(e),r=t.x+","+t.y+","+e.type,a=n.getAttribute("yoho_index")||n.parentNode.getAttribute("yoho_index");a&&(r+=","+a),s("_yasmp",r,{path:"/",domain:d,expires:73e3})}ix=0});onerror=_;var j=""},m=0;return y.add=function(e,n,t,r,o){m>3?u.imgSend(s("_yasev"),function(){s("_yasev",null,{path:"/",domain:f.yasDomain,expires:73e3}),m=0,a(e,n,t,r,o)}):a(e,n,t,r,o)},y.sendMouseEvent=function(e,n){e=e||window.event;var t=o(e);if(n){var r={x:t.x,y:t.y,et:e.type},a=i.merge(l,g);a=i.merge(a,v),a=i.merge(a,r);var c=i.genParam(a);u.imgSend(c,function(){})}else s("_yasmp",t.x+","+t.y+","+e.type,{path:"/",domain:d,expires:73e3})},y.sendCustomInfo=function(e,n){if(n){var t=i.merge(l,g);t=i.merge(t,v),t=i.merge(t,e);var r=i.genParam(t);u.imgSend(r,function(){})}else{var o=JSON.stringify(e);s("_yascustjson",o,{path:"/",domain:d,expires:73e3})}},e=y}(),yas_jssdk_1015_yas=function(e){var n=yas_jssdk_1015_src_ya;if(window.YohoAcquisitionObject){var t=window.YohoAcquisitionObject;window[t].p&&(n.apply(this,window[t].p),window[t]=n)}return e=n}()}();