1// Wizaly tag loader + $ThirdPartyMiddleware notifier. Moved out of inline <script> blocks 2// in Views/Shared/ThirdPartyIntegrationPartials/_WizalyPartial.cshtml AND 3// ClientSideApplications/Views/ThirdParty/WizalyIntegration.cshtml (the two were 100% 4// identical) for CSP hardening. Behavior unchanged. 5(function () { 6 7 setTimeout(function () { 8 LoadWizalyScript(); 9 }, 250); 10 11 function LoadWizalyScript() { 12 //loadScriptAsync(wizalyScriptURL); 13 declareWizilyVariables(); 14 } 15 16 function NotifyThirdPartyMiddleWare(tries) { 17 tries = tries || 0; 18 19 if (tries < 10) { 20 if (window.$ThirdPartyMiddleware !== undefined && window.$ThirdPartyMiddleware !== null 21 && window.$ThirdPartyMiddleware.Wizaly !== undefined && window.$ThirdPartyMiddleware.Wizaly !== null) { 22 23 window.$ThirdPartyMiddleware.Wizaly.NotifyWizalyObjectsInstantiaded(true); 24 } else { 25 26 tries++; 27 setTimeout(function () { 28 NotifyThirdPartyMiddleWare(tries); 29 }, 350); 30 } 31 } 32 33 34 } 35 36 function declareWizilyVariables() { 37 window._bwaq = window["_bwaq"] || []; // initialization of the queue as a global variable : the variable MUST be called _bwaq 38 //window._bwaq.push({ event: "[EVENT_NAME]", data: { EVENT_DATA } }); // push an action to the queue. As many actions as needed can be pushed to the queue 39 //window._bwaq.push({ event: "[EVENT_NAME_2]", data: { EVENT_DATA_2 } }); // push another action to the queue. As many actions as needed can be pushed to the queue 40 window._bwaq = window["esvtrack"] ? window["esvtrack"].apply(window._bwaq) : window._bwaq; // executes the action queue immediatlely if the tag is ready. Otherwise the action queue will be consumed on tag loading. 41 42 NotifyThirdPartyMiddleWare(0); 43 } 44 45 function loadScriptAsync(src) { 46 var scriptEl = document.createElement('script'); 47 scriptEl.src = src; 48 scriptEl.type = 'text/javascript'; 49 scriptEl.defer = true; 50 scriptEl.async = true; 51 52 document.body.appendChild(scriptEl); 53 54 //TODO: testing, not working for aysnc script 55 //return new Promise((resolve, reject) => { 56 // scriptEl.onreadystatechange = function () { 57 // if (scriptEl.readyState === 'loaded' || scriptEl.readyState === 'complete') { 58 // scriptEl.onreadystatechange = null; 59 // resolve(true); 60 // } 61 // }; 62 // document.body.appendChild(scriptEl); 63 // //document.getElementsByTagName('head')[0].appendChild(scriptEl); 64 //}); 65 } 66 67 68})();
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.