1/** 2 * @license Angulartics v0.17.2 3 * (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics 4 * License: MIT 5 */ 6!function (a) { 7 "use strict"; 8 var b = window.angulartics || (window.angulartics = {}); 9 b.waitForVendorCount = 0, 10 b.waitForVendorApi = function (a, c, d, e, f) { 11 f || b.waitForVendorCount++, 12 e || (e = d, d = void 0), 13 !Object.prototype.hasOwnProperty.call(window, a) || void 0 !== d && void 0 === window[a][d] ? setTimeout(function () { 14 b.waitForVendorApi(a, c, d, e, !0) 15 }, c) : (b.waitForVendorCount--, e(window[a])) 16 }, 17 a.module("angulartics", []).provider("$analytics", function () { 18 var c = { 19 pageTracking : { 20 autoTrackFirstPage : !0, 21 autoTrackVirtualPages : !0, 22 trackRelativePath : !1, 23 autoBasePath : !1, 24 basePath : "" 25 }, 26 eventTracking : {}, 27 bufferFlushDelay : 1e3, 28 developerMode : !1 29 }, 30 d = ["pageTrack", "eventTrack", "addTrans", "addItem", "trackTrans", "setAlias", "setUsername", "setAlias", "setUserProperties", "setUserPropertiesOnce", "setSuperProperties", "setSuperPropertiesOnce"], 31 e = {}, 32 f = {}, 33 g = function (a) { 34 return function () { 35 b.waitForVendorCount && (e[a] || (e[a] = []), e[a].push(arguments)) 36 } 37 }, 38 h = function (b, c) { 39 return f[b] || (f[b] = []), 40 f[b].push(c), 41 function () { 42 var c = arguments; 43 a.forEach(f[b], function (a) { 44 a.apply(this, c) 45 }, this) 46 } 47 }, 48 i = { 49 settings : c 50 }, 51 j = function (a, b) { 52 b ? setTimeout(a, b) : a() 53 }, 54 k = { 55 $get : function () { 56 return i 57 }, 58 api : i, 59 settings : c, 60 virtualPageviews : function (a) { 61 this.settings.pageTracking.autoTrackVirtualPages = a 62 }, 63 firstPageview : function (a) { 64 this.settings.pageTracking.autoTrackFirstPage = a 65 }, 66 withBase : function (b) { 67 this.settings.pageTracking.basePath = b ? a.element("base").attr("href").slice(0, -1) : "" 68 }, 69 withAutoBase : function (a) { 70 this.settings.pageTracking.autoBasePath = a 71 }, 72 developerMode : function (a) { 73 this.settings.developerMode = a 74 } 75 }, 76 l = function (b, d) { 77 i[b] = h(b, d); 78 var f = c[b], 79 g = f ? f.bufferFlushDelay : null, 80 k = null !== g ? g : c.bufferFlushDelay; 81 a.forEach(e[b], function (a, b) { 82 j(function () { 83 d.apply(this, a) 84 }, b * k) 85 }) 86 }, 87 m = function (a) { 88 return a.replace(/^./, function (a) { 89 return a.toUpperCase() 90 }) 91 }, 92 n = function (a) { 93 var b = "register" + m(a); 94 k[b] = function (b) { 95 l(a, b) 96 }, 97 i[a] = h(a, g(a)) 98 }; 99 return a.forEach(d, n), 100 k 101 }).run(["$rootScope", "$window", "$analytics", "$injector", function (b, c, d, e) { 102 d.settings.pageTracking.autoTrackFirstPage && e.invoke(["$location", function (a) { 103 var b = !0; 104 if (e.has("$route")) { 105 var f = e.get("$route"); 106 for (var g in f.routes) { 107 b = !1; 108 break 109 } 110 } else if (e.has("$state")) { 111 var h = e.get("$state"); 112 for (var i in h.get()) { 113 b = !1; 114 break 115 } 116 } 117 if (b) 118 if (d.settings.pageTracking.autoBasePath && (d.settings.pageTracking.basePath = c.location.pathname), d.settings.trackRelativePath) { 119 var j = d.settings.pageTracking.basePath + a.url(); 120 d.pageTrack(j, a) 121 } else 122 d.pageTrack(a.absUrl(), a) 123 } 124 ]), 125 d.settings.pageTracking.autoTrackVirtualPages && e.invoke(["$location", function (a) { 126 d.settings.pageTracking.autoBasePath && (d.settings.pageTracking.basePath = c.location.pathname + "#"), 127 e.has("$route") && b.$on("$routeChangeSuccess", function (b, c) { 128 if (!c || !(c.$$route || c).redirectTo) { 129 var e = d.settings.pageTracking.basePath + a.url(); 130 d.pageTrack(e, a) 131 } 132 }), 133 e.has("$state") && b.$on("$stateChangeSuccess", function () { 134 var b = d.settings.pageTracking.basePath + a.url(); 135 d.pageTrack(b, a) 136 }) 137 } 138 ]), 139 d.settings.developerMode && a.forEach(d, function (a, b) { 140 "function" == typeof a && (d[b] = function () {}) 141 }) 142 } 143 ]).directive("analyticsOn", ["$analytics", function (b) { 144 function c(a) { 145 return ["a:", "button:", "button:button", "button:submit", "input:button", "input:submit"].indexOf(a.tagName.toLowerCase() + ":" + (a.type || "")) >= 0 146 } 147 function d(a) { 148 return c(a) ? "click" : "click" 149 } 150 function e(a) { 151 return c(a) ? a.innerText || a.value : a.id || a.name || a.tagName 152 } 153 function f(a) { 154 return "analytics" === a.substr(0, 9) && -1 === ["On", "Event", "If", "Properties", "EventType"].indexOf(a.substr(9)) 155 }
156 function g(a) { 157 var b = a.slice(9); 158 return "undefined" != typeof b && null !== b && b.length > 0 ? b.substring(0, 1).toLowerCase() + b.substring(1) : b 159 } 160 return { 161 restrict : "A", 162 link : function (c, h, i) { 163 var j = i.analyticsOn || d(h[0]), 164 k = {}; 165 a.forEach(i.$attr, function (a, b) { 166 f(b) && (k[g(b)] = i[b], i.$observe(b, function (a) { 167 k[g(b)] = a 168 })) 169 }), 170 a.element(h[0]).bind(j, function (d) { 171 var f = i.analyticsEvent || e(h[0]); 172 k.eventType = d.type, 173 (!i.analyticsIf || c.$eval(i.analyticsIf)) && (i.analyticsProperties && a.extend(k, c.$eval(i.analyticsProperties)), b.eventTrack(f, k)) 174 }) 175 } 176 } 177 } 178 ]) 179} 180(angular);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.