(function(ns){ ns.DependencyLoaderSettings = { scripts: function() { return [ CF.Cookies.Loader.scripts.cookies ] } }; })(extend('CF.Cookies')); (function (ns) { ns.DependencyLoader = function () { var settings = CF.Cookies.DependencyLoaderSettings || {}; if (typeof jQuery === 'undefined') { throw new Error('JQuery not found! Required version >= 2.2.4'); } $.ajaxPrefilter(function (options) { if (window.location.hostname !== 'portal.extraportfel.pl') { options.crossDomain ={ crossDomain: true }; options.xhrFields = { withCredentials: true }; } }); $.ajaxSetup({ cache: true }); function worker(scripts, finishCb) { let loadedCounter = 0; for (var i = 0; i < scripts.length; i++) { const script = scripts[i]; const s = document.createElement('script'); s.setAttribute('src', script); s.onload = () => { if(++loadedCounter === scripts.length) { finishCb(); } }; s.onerror = () => { console.error('Error loading script: ' + script); if(++loadedCounter === scripts.length) { finishCb(); } }; document.body.appendChild(s); } } this.load = function (finishCb) { if (typeof settings.beforeLoad == 'function') { settings.beforeLoad(); } var scripts = typeof settings.scripts == 'function' ? settings.scripts() : settings.scripts; console.time('loading-scripts') worker(scripts, () => { if (typeof settings.afterLoad == 'function') { settings.afterLoad(); } console.timeEnd('loading-scripts'); finishCb(); } ); }; } })(extend('CF.Cookies')); function extend(ns_string) { window.CF = window.CF || {}; var parts = ns_string.split('.'), parent = window.CF, pl, i; if (parts[0] == "CF") { parts = parts.slice(1); } pl = parts.length; for (i = 0; i < pl; i++) { //create a property if it doesnt exist if (typeof parent[parts[i]] == 'undefined') { parent[parts[i]] = {}; } parent = parent[parts[i]]; } return parent; }(function (ns) { ns.scripts = { cookies: "https://portal.extraportfel.pl/generated/js/cookie-manager.js?a217d2cdeafc36582ea97680915c63b5d9d2e9c8b7a4667189f27df6a3c0705b_fb934dadb9fbfd089166493b058a47a5246ab87b70328b1e27940072c3c19381", }; ns.stylesheetUrl = "https://portal.extraportfel.pl/generated/css/cookie-manager.css?a217d2cdeafc36582ea97680915c63b5d9d2e9c8b7a4667189f27df6a3c0705b_fb934dadb9fbfd089166493b058a47a5246ab87b70328b1e27940072c3c19381"; ns.popupUrl = "https://portal.extraportfel.pl/cookie-manager/popup"; ns.decisionStorage = "https://portal.extraportfel.pl/cookie-manager/decision"; }) (extend('CF.Cookies.Loader'));