1function DOMReady(callback) { 2 // in case the document is already rendered 3 if (document.readyState !== "loading") { 4 callback(); 5 } 6 document.addEventListener("DOMContentLoaded", callback); 7} 8function $c(classname) { 9 var els = document.getElementsByClassName(classname); 10 return Array.prototype.slice.call(els); 11} 12function $q(q) { 13 var els = document.querySelectorAll ? document.querySelectorAll(q) : []; 14 return Array.prototype.slice.call(els); 15} 16function hasClass(el, className) { 17 if (el.classList) { 18 return el.classList.contains(className); 19 } 20 else { 21 return !!el.className.match(new RegExp("(\\s|^)" + className + "(\\s|$)")); 22 } 23} 24function addClass(el, className) { 25 if (el.classList) { 26 el.classList.add(className); 27 } 28 else if (!hasClass(el, className)) { 29 el.className += " " + className; 30 } 31} 32function removeClass(el, className) { 33 if (el.classList) { 34 el.classList.remove(className); 35 } 36 else if (hasClass(el, className)) { 37 var reg = new RegExp("(\\s|^)" + className + "(\\s|$)"); 38 el.className = el.className.replace(reg, " "); 39 } 40} 41function toggleClass(el, className) { 42 var isToggled = hasClass(el, className); 43 if (isToggled) { 44 removeClass(el, className); 45 } 46 else { 47 addClass(el, className); 48 } 49 var eventInfo = el.getAttribute("data-event"); 50 if (eventInfo) { 51 trackEventInfo(eventInfo, isToggled ? "collapse" : "expand"); 52 } 53} 54function findAncestor(el, cls) { 55 while ((el = el.parentElement) && !hasClass(el, cls)) { } 56 return el; 57} 58function showModal(el) { 59 addClass(document.body, "modal-open"); 60 removeClass(el, "hidden"); 61 var eventInfo = el.getAttribute("data-event"); 62 if (eventInfo) { 63 trackEventInfo(eventInfo, "modal-open"); 64 } 65} 66function hideModal(el) { 67 removeClass(document.body, "modal-open"); 68 addClass(el, "hidden"); 69 var eventInfo = el.getAttribute("data-event"); 70 if (eventInfo) { 71 trackEventInfo(eventInfo, "modal-close"); 72 } 73} 74function trackEventInfo(eventInfo, action) { 75 if (eventInfo) { 76 try { 77 var parts = eventInfo.split("|"); 78 trackEventServices(parts[0] || undefined, action, parts[1] || undefined, parts[2] || undefined, parts[3] || undefined); 79 } 80 catch (e) { 81 console.error(e); 82 } 83 } 84} 85// https://stackoverflow.com/questions/2090551/parse-query-string-in-javascript 86function deparam(qs) { 87 // remove any preceding url and split 88 var querystring = qs.substring(qs.indexOf("?") + 1).split("&"); 89 var params = {}; 90 var pair; 91 var d = decodeURIComponent; 92 // march and parse 93 for (var i = querystring.length - 1; i >= 0; i--) { 94 pair = querystring[i].split("="); 95 params[d(pair[0])] = d(pair[1] || ""); 96 } 97 return params; 98} 99function trackVirtualPageviewElement(el) { 100 var info = el.getAttribute("href"); 101 if (!info) { 102 info = el.getAttribute("data-vhref"); 103 } 104 info += info.indexOf("?") === -1 ? "?" : "&"; 105 info += "virtual=true"; 106 try { 107 trackVirtualPageview(info); 108 } 109 catch (e) { 110 console.error(e); 111 } 112} 113DOMReady(function () { 114 $c("modal").forEach(function (el) { 115 el.addEventListener("click", function () { 116 hideModal(el); 117 $c("modal").forEach(function (elem) { 118 hideModal(elem); 119 }); 120 $c("btn-hamburger").forEach(function (elem) { 121 removeClass(elem, "active"); 122 }); 123 }); 124 }); 125 $c("modal-content").forEach(function (el) { 126 el.addEventListener("click", function (evt) { 127 evt.stopPropagation(); 128 }); 129 }); 130 $q(".modal-close, .modal-close-button").forEach(function (el) { 131 el.addEventListener("click", function (evt) { 132 var modal = findAncestor(el, "modal"); 133 if (modal) { 134 hideModal(modal); 135 evt.preventDefault(); 136 } 137 }); 138 }); 139 $c("btn-login-modal").forEach(function (el) { 140 el.addEventListener("click", function (evt) { 141 var modal = $c("login-modal")[0]; 142 if (modal) { 143 showModal(modal); 144 evt.preventDefault(); 145 trackVirtualPageviewElement(el); 146 } 147 }); 148 }); 149 $c("btn-pricing-modal").forEach(function (el) { 150 el.addEventListener("click", function (evt) { 151 var modal = $c("pricing-modal")[0]; 152 if (modal) { 153 showModal(modal); 154 evt.preventDefault(); 155 trackVirtualPageviewElement(el); 156 } 157 }); 158 }); 159 $c("btn-cancel-premium-modal").forEach(function (el) { 160 el.addEventListener("click", function (evt) { 161 var modal = $c("cancel-premium-modal")[0]; 162 if (modal) { 163 showModal(modal); 164 evt.preventDefault(); 165 trackVirtualPageviewElement(el); 166 } 167 }); 168 }); 169 $c("btn-disable-on-click").forEach(function (el) { 170 el.addEventListener("click", function (evt) { 171 if (hasClass(el, "disabled")) { 172 evt.preventDefault(); 173 } 174 else { 175 addClass(el, "disabled"); 176 } 177 }); 178 }); 179 $c("btn-hamburger").forEach(function (el) { 180 el.addEventListener("click", function (evt) { 181 var modal = $c("hamburger-modal")[0]; 182 if (modal) { 183 if (!hasClass(el, "active")) { 184 showModal(modal); 185 $c("btn-hamburger").forEach(function (elem) { 186 addClass(elem, "active"); 187 }); 188 evt.preventDefault(); 189 } 190 else { 191 hideModal(modal); 192 $c("btn-hamburger").forEach(function (elem) { 193 removeClass(elem, "active"); 194 }); 195 evt.preventDefault(); 196 } 197 } 198 }); 199 }); 200 $c("toggler").forEach(function (el) { 201 el.addEventListener("click", function (evt) {
202 $c(el.getAttribute("data-toggle-target")).forEach(function (tgt) { 203 toggleClass(tgt, el.getAttribute("data-toggle-class")); 204 }); 205 evt.preventDefault(); 206 }); 207 }); 208 $c("parent-toggler").forEach(function (el) { 209 el.addEventListener("click", function (evt) { 210 var className = el.getAttribute("data-toggle-class"); 211 toggleClass(el.parentElement, className); 212 // close sub sections on parent close 213 if (className === "expanded") { 214 $c("sub-expandable-block").forEach(function (e) { 215 if (hasClass(e, "sub-expanded")) { 216 removeClass(e, "sub-expanded"); 217 } 218 }); 219 } 220 evt.preventDefault(); 221 }); 222 }); 223 $q("[data-tclick]").forEach(function (el) { 224 el.addEventListener("click", function (evt) { 225 var info = el.getAttribute("data-tclick"); // category|action|label|element|value 226 var parts = info.split("|"); 227 try { 228 trackEventServices(parts[0] || undefined, parts[1] || undefined, parts[2] || undefined, parts[3] || undefined, parts[4] || undefined); 229 } 230 catch (e) { 231 console.error(e); 232 } 233 }); 234 }); 235 $q("[data-tpv]").forEach(function (el) { 236 el.addEventListener("click", function (evt) { 237 trackVirtualPageviewElement(el); 238 }); 239 }); 240 $c("try-again-link").forEach(function (el) { 241 el.addEventListener("click", function () { 242 $c("email-output").forEach(function (el1) { 243 el1.classList.add("hidden"); 244 }); 245 $c("email-input").forEach(function (el1) { 246 el1.classList.remove("hidden"); 247 }); 248 }); 249 }); 250 $c("apple-sign-in-btn").forEach(function (el) { 251 el.addEventListener("click", function () { 252 var currentPage = window.location.href; 253 window.AppleID.auth.init({ 254 clientId: document.querySelector('meta[name="appleid-signin-client-id"]').content, 255 scope: document.querySelector('meta[name="appleid-signin-scope"]') 256 .content, 257 redirectURI: document.querySelector('meta[name="appleid-signin-redirect-uri"]').content, 258 state: JSON.stringify({ redirect_to: currentPage }) 259 }); 260 window.AppleID.auth.signIn(); 261 }); 262 }); 263}); 264if (window.location.href.indexOf("referral") > -1) { 265 var params = deparam(window.location.href); 266 if (createCookie && params.referralCode) { 267 createCookie("vl-referralCode", params.referralCode, 7); 268 createCookie("vl-refSource", params.refSource, 7); 269 } 270} 271//# sourceMappingURL=main.js.map
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.