-
Notifications
You must be signed in to change notification settings - Fork 98
/
alog.min.js
1 lines (1 loc) · 4.91 KB
/
alog.min.js
1
!function(e,t){function n(e){var t,r,a,o=arguments;if("define"===e||"require"===e){for(var s=1;s<o.length;s++)switch(typeof o[s]){case"string":t=o[s];break;case"object":r=o[s];break;case"function":a=o[s]}"require"===e&&(t&&!r&&(r=[t]),t=null),t=t?t:"#"+O++;var f;return k[t]?f=k[t]:(f={},k[t]=f),void(f.defined||(f.name=t,f.requires=r,f.creator=a,"define"===e&&(f.defining=!0),i(f)))}return"function"==typeof e?void e(n):void String(e).replace(/^(?:([\w$_]+)\.)?(\w+)$/,function(e,t,r){o[0]=r,l.apply(n.tracker(t),o)})}function r(e){var n=E.get("alias")||{},r=n[e]||e+".js";if(!j[r]){j[r]=!0;var i="script",a=t.createElement(i),o=t.getElementsByTagName(i)[0];a.async=!0,a.src=r,o.parentNode.insertBefore(a,o)}}function i(e){if(!e.defined){var t=!0,n=[],i=e.requires;if(i)for(var o=0;o<i.length;o++){var s=i[o],f=k[s]=k[s]||{};f.defined||f===e?n.push(f.instance):(t=!1,f.defining||r(s),f.waiting=f.waiting||{},f.waiting[e.name]=e)}t&&(e.defined=!0,e.creator&&(e.instance=e.creator.apply(e,n)),a(e))}}function a(e){for(var t in e.waiting)e.waiting.hasOwnProperty(t)&&i(e.waiting[t])}function o(e){return(e||new Date)-D}function s(e,t,r){if(e){"string"==typeof e&&(r=t,t=e,e=n);try{if(e===n)return q[t]=q[t]||[],void q[t].unshift(r);e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent&&e.attachEvent("on"+t,r)}catch(i){}}}function f(e,t,r){if(e){"string"==typeof e&&(r=t,t=e,e=n);try{if(e===n){var i=q[t];if(!i)return;for(var a=i.length;a--;)i[a]===r&&i.splice(a,1);return}e.removeEventListener?e.removeEventListener(t,r,!1):e.detachEvent&&e.detachEvent("on"+t,r)}catch(o){}}}function c(e){var t=q[e];if(t){for(var n=[],r=arguments,i=1,a=r.length;a>i;i++)n.push(r[i]);for(var o=0,s=t.length;s--;)t[s].apply(this,n)&&o++;return o}}function u(e,r){if(e&&r){var i=t.createElement("img"),a=[];for(var o in r)r[o]&&a.push(o+"="+encodeURIComponent(r[o]));var s="img_"+ +new Date;n[s]=i,i.onload=i.onerror=function(){n[s]=i=i.onload=i.onerror=null,delete n[s]},i.src=e+(e.indexOf("?")<0?"?":"&")+a.join("&")}}function p(e,t){if(!e)return t;var n={};for(var r in t)null!==e[r]&&(n[e[r]||r]=t[r]);return n}function l(){var e=arguments,t=e[0];if(this.created||/^(on|un|set|get|create)$/.test(t)){for(var n=h.prototype[t],r=[],i=1,a=e.length;a>i;i++)r.push(e[i]);"function"==typeof n&&n.apply(this,r)}else this.argsList.push(e)}function v(e,t){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);return n}function h(e){this.name=e,this.fields={protocolParameter:{postUrl:null,protocolParameter:null}},this.argsList=[],this.alog=n}function d(e){if(e=e||"default","*"===e){var t=[];for(var n in x)x.hasOwnProperty(n)&&t.push(x[n]);return t}return x[e]=x[e]||new h(e)}function g(){if(!(P&&new Date-w<50||b)){b=!0;var e=0;for(var t in x)if(x.hasOwnProperty(t)){var n=x[t];n.created&&(e+=n.fire("unload"))}if(e)for(var r=new Date;new Date-r<100;);}}var m=e.alogObjectName||"alog",y=e[m];if(!y||!y.defined){var w,b,E,P=e.attachEvent&&!window.opera,D=y&&y.l||+new Date,L=e.logId||(+new Date).toString(36)+Math.random().toString(36).substr(2,3),O=0,j={},k={alog:{name:"alog",defined:!0,instance:n}},q={},x={};if(h.prototype.create=function(e){if(!this.created){"object"==typeof e&&this.set(e),this.created=new Date,this.fire("create",this);for(var t;t=this.argsList.shift();)l.apply(this,t)}},h.prototype.send=function(e,t){var n=v({ts:o().toString(36),t:e,sid:L},this.fields);if("object"==typeof t)n=v(n,t);else{var r=arguments;switch(e){case"pageview":r[1]&&(n.page=r[1]),r[2]&&(n.title=r[2]);break;case"event":r[1]&&(n.eventCategory=r[1]),r[2]&&(n.eventAction=r[2]),r[3]&&(n.eventLabel=r[3]),r[4]&&(n.eventValue=r[4]);break;case"timing":r[1]&&(n.timingCategory=r[1]),r[2]&&(n.timingVar=r[2]),r[3]&&(n.timingValue=r[3]),r[4]&&(n.timingLabel=r[4]);break;case"exception":r[1]&&(n.exDescription=r[1]),r[2]&&(n.exFatal=r[2]);break;default:return}}this.fire("send",n),u(this.fields.postUrl,p(this.fields.protocolParameter,n))},h.prototype.set=function(e,t){if("string"==typeof e)"protocolParameter"===e&&(t=v({postUrl:null,protocolParameter:null},t)),this.fields[e]=t;else if("object"==typeof e)for(var n in e)e.hasOwnProperty(n)&&this.set(n,e[n])},h.prototype.get=function(e,t){var n=this.fields[e];return"function"==typeof t&&t(n),n},h.prototype.fire=function(e){for(var t=[this.name+"."+e],n=arguments,r=1,i=n.length;i>r;r++)t.push(n[r]);return c.apply(this,t)},h.prototype.on=function(e,t){n.on(this.name+"."+e,t)},h.prototype.un=function(e,t){n.un(this.name+"."+e,t)},n.name="alog",n.sid=L,n.defined=!0,n.timestamp=o,n.un=f,n.on=s,n.fire=c,n.tracker=d,n("init"),E=d(),E.set("protocolParameter",{modules:null}),y){var N=[].concat(y.p||[],y.q||[]);y.p=y.q=null;for(var S in n)n.hasOwnProperty(S)&&(y[S]=n[S]);n.p=n.q={push:function(e){n.apply(n,e)}};for(var U=0;U<N.length;U++)n.apply(n,N[U])}e[m]=n,P&&s(t,"mouseup",function(e){var t=e.target||e.srcElement;1===t.nodeType&&/^ajavascript:/i.test(t.tagName+t.href)&&(w=new Date)}),s(e,"beforeunload",g),s(e,"unload",g)}}(window,document);