1// This file handle the cookie banner and stuff related to that. 2 3var days = cookieadmin_policy.cookieadmin_days; 4 5if(typeof cookieadmin_is_consent === 'undefined'){ 6 window.cookieadmin_is_consent = {}; 7} 8var cookieadmin_allcookies = cookieadmin_policy.categorized_cookies; 9//setInterval(cookieadmin_categorize_cookies, 5000); 10 11function cookieadmin_is_obj(consentObj){ 12 try{ 13 return ( 14 consentObj !== null && 15 typeof consentObj === 'object' && 16 !Array.isArray(consentObj) && 17 Object.keys(consentObj).length > 0 18 ); 19 }catch(e){ 20 return false; 21 } 22} 23 24 25// function cookieadmin_cookie_interceptor(){ 26 27 var originalCookieDescriptor = 28 Object.getOwnPropertyDescriptor(Document.prototype, 'cookie') || 29 Object.getOwnPropertyDescriptor(document, 'cookie'); 30 var allowed_cookies = ''; 31 32 // Override document.cookie to intercept cookie setting. 33 Object.defineProperty(document, 'cookie', { 34 configurable: true, 35 enumerable: true, 36 get: function(){ 37 return originalCookieDescriptor.get.call(document); 38 }, 39 set: function(val){ 40 41 if (!val) return; 42 43 var separatorIndex = val.indexOf('='); 44 if(separatorIndex === -1) { 45 return; 46 } 47 48 var cookieName = val.substring(0, separatorIndex).trim(); 49 var cookieValue = val.substring(separatorIndex + 1).trim(); 50 51 if(cookieName === "cookieadmin_consent"){ 52 originalCookieDescriptor.set.call(document, val); 53 return; 54 } 55 56 // Set cookies which are meant to be deleted 57 if(val.includes('expires=Thu, 01 Jan 1970') || cookieValue.startsWith("deleted;")){ 58 originalCookieDescriptor.set.call(document, val); 59 return; 60 } 61 62 var cookieInfo = cookieadmin_allcookies[cookieName] || {}; 63 var category = (cookieInfo.category || 'uncategorized').toLowerCase(); 64 65 // Set necessary cookies 66 if(category == "necessary"){ 67 originalCookieDescriptor.set.call(document, val); 68 return; 69 } 70 71 if(cookieadmin_is_obj(cookieadmin_is_consent) || (Array.isArray(cookieadmin_policy['preload']) && cookieadmin_policy['preload'].length > 0)){ 72 73 var consentAction = cookieadmin_is_consent.action; 74 75 if(!consentAction){ 76 consentAction = cookieadmin_policy['preload'].reduce((a, val) => {a[val] = ''; return a;}, {}); 77 } 78 79 if(consentAction.accept || consentAction[category]){ 80 originalCookieDescriptor.set.call(document, val); 81 }else{ 82 83 var pathMatch = val.match(/path=([^;]+)/i); 84 var domainMatch = val.match(/domain=([^;]+)/i); 85 var path = pathMatch ? pathMatch[1].trim() : '/'; 86 var domain = domainMatch ? `domain=${domainMatch[1].trim()};` : ''; 87 88 var deleteString = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=${path}; ${domain}`; 89 originalCookieDescriptor.set.call(document, deleteString.trim()); 90 } 91 92 }else{ 93 (cookieadmin_allcookies[cookieName] = cookieadmin_allcookies[cookieName] || {}).string = val.trim(); 94 return false; 95 } 96 97 } 98 }); 99// } 100// cookieadmin_cookie_interceptor(); 101 102 103function cookieadmin_is_cookie(name){ 104 105 if(!document.cookie) return false; 106 107 var coki = document.cookie.split(";") ; 108 109 if(name == "all"){ 110 return coki ? coki : []; 111 } 112 var nam = name + "="; 113 114 for(var i=0; i < coki.length; i++){ 115 if(coki[i].trim().indexOf(nam) == 0){ 116 try { 117 var cookie_value = coki[i].trim().split("="); 118 if(!cookie_value[1]){ 119 return false; 120 } 121 122 var decoded = decodeURIComponent(cookie_value[1]); 123 return JSON.parse(decoded); 124 } catch { 125 return false; 126 } 127 } 128 } 129 130 return false; 131} 132 133function cookieadmin_check_consent(){ 134 var cookieadmin_cookie = cookieadmin_is_cookie("cookieadmin_consent"); 135 if(!!cookieadmin_cookie){ 136 if(!!cookieadmin_cookie.consent){ 137 cookieadmin_is_consent.consent = cookieadmin_cookie.consent; 138 delete cookieadmin_cookie.consent; 139 } 140 141 cookieadmin_is_consent.action = cookieadmin_cookie; 142 } 143} 144cookieadmin_check_consent(); 145 146function cookieadmin_restore_cookies(update) { 147 148 var cookieadmin_accepted_categories = []; 149 150 if(update.accept && update.accept == "true"){ 151 152 document.querySelectorAll(".cookieadmin_toggle").forEach(function(e){ 153 key = e.children[0].id; 154 if (key.includes("cookieadmin-")) { 155 key = key.replace("cookieadmin-", ""); 156 cookieadmin_accepted_categories.push(key); 157 } 158 }); 159 160 }else if(update.reject && update.reject == "true"){ 161 return true; 162 }else{ 163 for (var [key, value] of Object.entries(update)) { 164 if(key != "consent"){ 165 cookieadmin_accepted_categories.push(key); 166 } 167 } 168 } 169 170 171 for(cookie in cookieadmin_allcookies){ 172 document.cookie = cookieadmin_allcookies[cookie].string; 173 }; 174
175 cookieadmin_accepted_categories.forEach(function(category) { 176 177 document.querySelectorAll( 178 'script[type="text/plain"][data-cookieadmin-category="' + category + '"]' 179 ).forEach(function(el) { 180 var newScript = document.createElement('script'); 181 182 // Copy attributes 183 if (el.src) { 184 newScript.src = el.src; 185 } else { 186 newScript.text = el.textContent; 187 } 188 189 if (el.defer) newScript.defer = true; 190 if (el.async) newScript.async = true; 191 192 // Copy other attributes if needed 193 ['id', 'class', 'data-name'].forEach(attr => { 194 if (el.hasAttribute(attr)) { 195 newScript.setAttribute(attr, el.getAttribute(attr)); 196 } 197 }); 198 199 el.parentNode.replaceChild(newScript, el); 200 }); 201 }); 202} 203 204function cookieadmin_set_cookie(name, value, days = 365, domain = "") { 205 if (!name || !value) return false; 206 207 if((cookieadmin_policy.is_pro != 0) && (cookieadmin_pro_vars !== 'undefined')){ 208 if(cookieadmin_pro_vars.shared_subdomain_consent && cookieadmin_pro_vars.base_domain){ 209 // Delete the cookie if exist with the subdomin 210 // Previously, cookie was set without specifying domain name, we'll not specify domain while deleting. 211 document.cookie = `cookieadmin_consent=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=${cookieadmin_policy.base_path};`; 212 domain = cookieadmin_pro_vars.base_domain; 213 } 214 } 215 216 var date = new Date(); 217 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); // default 1 year 218 219 var cookieString = `${encodeURIComponent(name)}=${JSON.stringify(value)};`; 220 cookieString += ` expires=${date.toUTCString()};`; 221 cookieString += ` path=${!domain ? cookieadmin_policy.base_path : '/'};`; 222 cookieString += ` SameSite=Lax;`; 223 if(cookieadmin_policy.is_ssl || window.location.protocol === 'https:'){ 224 cookieString += ` Secure;`; 225 } 226 227 // Add domain if explicitly passed 228 if (domain) { 229 cookieString += ` domain=${domain};`; 230 } 231 232 document.cookie = cookieString; 233 return true; 234} 235 236//Populates modal with consent if selected & adds found cookies 237function cookieadmin_populate_preference(){ 238 239 consent = cookieadmin_is_consent.action; 240 241 if(!!consent){ 242 243 if(consent.accept){ 244 document.querySelectorAll(".cookieadmin_toggle").forEach(function(e){ 245 e.children[0].checked = true; 246 }); 247 } 248 else if(consent.reject){ 249 document.querySelectorAll(".cookieadmin_toggle").forEach(function(e){ 250 e.children[0].checked = false; 251 }); 252 } 253 else{ 254 for(btn in consent){ 255 if(btn_ele = document.querySelector("#cookieadmin-" + btn)){ 256 btn_ele.checked = true; 257 } 258 } 259 } 260 //Load as per preloaded categories selected by admin 261 }else if(cookieadmin_policy['preload'] && cookieadmin_policy['preload'].length > 0){ 262 263 cookieadmin_policy['preload'].forEach(function(val){ 264 if(btn_ele = document.querySelector("#cookieadmin-" + val)){ 265 btn_ele.checked = true; 266 } 267 }); 268 } 269 270 var cookieadmin_shown = (typeof cookieadmin_shown !== "undefined") ? cookieadmin_shown : []; 271 272 if(cookieadmin_allcookies){ 273 274 var cookieadmin_filtrd = Object.keys(cookieadmin_allcookies).filter(e => !cookieadmin_shown.includes(e)); 275 276 for(c_info of cookieadmin_filtrd){ 277 278 var category_var = cookieadmin_allcookies[c_info].category; 279 280 if(!category_var){ 281 continue; 282 } 283 var card_container = document.querySelector(".cookieadmin-" + category_var.toLowerCase()); 284 285 if(!card_container){ 286 continue; 287 } 288 289 card_container.querySelector(".cookieadmin-nocookie-cat").style.display = 'none'; 290 291 var cookieadmin_exp = cookieadmin_policy.lang.session; 292 293 if( 294 !!cookieadmin_allcookies[c_info].expires 295 && cookieadmin_allcookies[c_info].expires !== "0000-00-00 00:00:00" 296 ){ 297 298 var expDate = new Date(cookieadmin_allcookies[c_info].expires.replace(' ', 'T')); 299 300 if (!isNaN(expDate.getTime())) { 301 var daysLeft = Math.ceil((expDate.getTime() - Date.now()) / (1000 * 60 * 60 * 24)); 302 303 if (daysLeft > 0) { 304 cookieadmin_exp = daysLeft +' '+ cookieadmin_policy.lang.days; 305 } 306 } 307 } 308 309 card_container.innerHTML += '<div class="cookieadmin-cookie-card"> <div class="cookieadmin-cookie-header"> <strong class="cookieadmin-cookie-name">'+ c_info.replace(/_+$/, "") +'</strong> <span class="cookieadmin-cookie-duration"><b>'+ cookieadmin_policy.lang.duration +':</b> '+ cookieadmin_exp +'</span> </div> <p class="cookieadmin-cookie-description">'+ cookieadmin_allcookies[c_info].description +'</p> <div class="cookieadmin-cookie-tags"> ' + (cookieadmin_allcookies[c_info].platform ? '<span class="cookieadmin-tag">
309' + cookieadmin_allcookies[c_info].platform + '</span>' : "") + ' </div> </div>'; 310 cookieadmin_shown.push(c_info); 311 } 312 } 313 314} 315 316function cookieadmin_toggle_overlay(){ 317 318 if(window.getComputedStyle(document.getElementsByClassName("cookieadmin_modal_overlay")[0]).display == "none"){ 319 document.getElementsByClassName("cookieadmin_modal_overlay")[0].style.display = "block"; 320 }else{ 321 document.getElementsByClassName("cookieadmin_modal_overlay")[0].style.display = "none"; 322 } 323 324} 325 326function cookieadmin_categorize_cookies(){ 327 328 if(!cookieadmin_allcookies){ 329 return; 330 } 331 332 var cookieadmin_chk_cookies = {}; 333 var cookieadmin_consent_chng = []; 334 335 for(a_cookie in cookieadmin_allcookies){ 336 if(!cookieadmin_allcookies[a_cookie].category){ 337 cookieadmin_chk_cookies[a_cookie] = cookieadmin_allcookies[a_cookie]; 338 }else if(cookieadmin_is_consent.old_action !== cookieadmin_is_consent.action && a_cookie !== "cookieadmin_consent"){ 339 document.cookie = cookieadmin_allcookies[a_cookie].string; 340 } 341 } 342 343 if(!cookieadmin_is_obj(cookieadmin_chk_cookies)){ 344 return; 345 } 346 347 /* var xhttp2 = new XMLHttpRequest(); 348 349 var data = 'action=cookieadmin_ajax_handler&cookieadmin_act=categorize_cookies&cookieadmin_security=' + cookieadmin_policy.nonce + "&cookieadmin_cookies=" + JSON.stringify(cookieadmin_chk_cookies); 350 351 xhttp2.onload = function() { 352 parsd = JSON.parse(this.responseText); 353 354 if(parsd.success){ 355 cookies = parsd.data; 356 for(coki in cookies){ 357 cookieadmin_chk_cookies[coki].name = coki; 358 if(cookies[coki].category === "un_c"){ 359 cookieadmin_chk_cookies[coki].source = "unknown"; 360 cookieadmin_chk_cookies[coki].description = "unknown"; 361 } 362 cookieadmin_allcookies[coki] = cookieadmin_chk_cookies[coki]; 363 document.cookie = cookieadmin_chk_cookies[coki].string; 364 } 365 } 366 } 367 368 xhttp2.open("POST", cookieadmin_policy.ajax_url, true); 369 xhttp2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 370 xhttp2.send(data); */ 371} 372 373 374document.addEventListener("DOMContentLoaded", function() { 375 376 var cookieadmin_show_reconsent = 0; 377 if(cookieadmin_policy.is_pro != 0 && cookieadmin_pro_vars !== 'undefined' && cookieadmin_pro_vars.reconsent != 0){ 378 var cookieadmin_show_reconsent = 1; 379 } 380 381 //Create overlay 382 var cookieadmin_ovrlay = document.createElement("div"); 383 cookieadmin_ovrlay.className = "cookieadmin_modal_overlay"; 384 document.body.appendChild(cookieadmin_ovrlay); 385 386 var before_consent_dispaly = new CustomEvent('cookieadmin_before_consent_display'); 387 388 // For anything that needs to be done before disaplying consent. 389 cookieadmin_policy.hide_banner = false; // initializing 390 window.dispatchEvent(before_consent_dispaly); 391 392 //Show notice or re-consent icon as needed 393 if(!cookieadmin_is_obj(cookieadmin_is_consent) && !cookieadmin_policy.hide_banner){ 394 395 if(cookieadmin_policy.cookieadmin_layout !== "popup"){ 396 var cookieadmin_banner_el = document.getElementsByClassName("cookieadmin_law_container")[0]; 397 if(cookieadmin_banner_el){ 398 cookieadmin_banner_el.style.display = "block"; 399 cookieadmin_banner_el.focus(); 400 } 401 }else{ 402 cookieadmin_toggle_overlay(); 403 document.getElementsByClassName("cookieadmin_cookie_modal")[0].style.display = "flex"; 404 } 405 406 /* //block cookie scripts 407 var cookieadmin_blockedScripts = [ 408 'https://www.google-analytics.com/analytics.js', 409 'https://connect.facebook.net/en_US/fbevents.js', 410 'https://www.youtube.com/iframe_api' 411 ]; 412 413 cookieadmin_blockedScripts.forEach(function(scriptUrl) { 414 var scriptTag = document.querySelector(`script[src='${scriptUrl}']`); 415 if (scriptTag) { 416 scriptTag.remove(); // Remove script if already loaded 417 } 418 }); */ 419 420 }else if(cookieadmin_show_reconsent){ 421 document.getElementsByClassName("cookieadmin_re_consent")[0].style.display = "block"; 422 423 } 424 425 //Edit Notice and Modal contents 426 427 cookieadmin_populate_preference(); 428 429 for(data in cookieadmin_policy){ 430 431 typ = 0; 432 if(data.includes("_bg_color")){ 433 d_ele = data.replace("_bg_color", ""); 434 typ = 1; 435 }else if(data.includes("_border_color")){ 436 d_ele = data.replace("_border_color", ""); 437 typ = 2; 438 }else if(data.includes("_color")){ 439 d_ele = data.replace("_color", ""); 440 typ = 3; 441 }else{ 442 d_ele = data; 443 } 444 445 d_eles = [];
446 if(document.getElementById(d_ele)){ 447 d_eles = [document.getElementById(d_ele)]; 448 } 449 if(document.getElementsByClassName(d_ele).length){ 450 d_eles = (document.getElementsByClassName(d_ele).length > 1) ? document.getElementsByClassName(d_ele) : [document.getElementsByClassName(d_ele)[0]]; 451 } 452 453 if(!!d_eles){ 454 i = 0; 455 while(i < d_eles.length){ 456 d_ele = d_eles[i]; 457 if(typ == 3){ 458 d_ele.style.color = cookieadmin_policy[data]; 459 }else if(typ == 2){ 460 d_ele.style.borderColor = cookieadmin_policy[data]; 461 }else if(typ == 1){ 462 d_ele.style.backgroundColor = cookieadmin_policy[data]; 463 }else{ 464 d_ele.innerHTML = cookieadmin_policy[data]; 465 } 466 i++; 467 } 468 } 469 } 470 471 //Add layout as class 472 if(!!cookieadmin_policy.cookieadmin_position && cookieadmin_policy.cookieadmin_layout !== "popup"){ 473 cookieadmin_policy.cookieadmin_position.split("_").forEach(function(clas){ 474 clas = "cookieadmin_" + clas; 475 document.getElementsByClassName("cookieadmin_law_container")[0].classList.add(clas); 476 }); 477 } 478 479 // Change consent layout dynamically 480 // TODO: There is a operator called optional chaining operator ?. something like this users?.[0]?.name; wont use it now just for reference 481 var cookieadmin_law_container_var = document.getElementsByClassName("cookieadmin_law_container")[0]; 482 if (!!cookieadmin_law_container_var){ 483 cookieadmin_law_container_var.classList.add("cookieadmin_" + cookieadmin_policy.cookieadmin_layout); 484 } 485 486 // Change Modal layout dynamically 487 document.getElementsByClassName("cookieadmin_cookie_modal")[0].classList.add("cookieadmin_" + cookieadmin_policy.cookieadmin_modal); 488 489 /*if(cookieadmin_policy.layout == "footer"){ 490 491 }*/ 492 493 if(cookieadmin_policy.cookieadmin_modal == "side"){ 494 document.getElementsByClassName("cookieadmin_modal_footer")[0].style.flexDirection = "column"; 495 } 496 497 // Remove modal close Button 498 if(cookieadmin_policy.cookieadmin_layout == "popup"){ 499 document.getElementsByClassName("cookieadmin_close_pref")[0].style.display = "none"; 500 } 501 502 var cookieadmin_modal_el = document.getElementsByClassName("cookieadmin_cookie_modal")[0]; 503 504 //show preference modal 505 cookieadmin_show_modal_elemnts = document.querySelectorAll(".cookieadmin_re_consent, .cookieadmin_customize_btn"); 506 cookieadmin_show_modal_elemnts.forEach(function(e){ 507 508 e.addEventListener("click", function(e){ 509 510 /*cookieadmin_is_cookie("all").forEach(function(e){ 511 c_name = e.split("=")[0].trim(); 512 if(!!cookieadmin_allcookies[c_name]){ 513 console.log(JSON.stringify(cookieadmin_allcookies[c_name])); 514 } 515 });*/ 516 517 cookieadmin_toggle_overlay(); 518 document.getElementsByClassName("cookieadmin_cookie_modal")[0].style.display = "flex"; 519 var cookieadmin_re_consent = document.getElementsByClassName("cookieadmin_re_consent")[0]; 520 if(cookieadmin_re_consent){ 521 cookieadmin_re_consent.style.display = "none"; 522 } 523 524 var cookieadmin_law_container = document.getElementsByClassName("cookieadmin_law_container")[0]; 525 if(cookieadmin_law_container){ 526 cookieadmin_law_container.style.display = "none"; 527 } 528 529 if(cookieadmin_policy["cookieadmin_modal"] == "side"){ 530 document.getElementsByClassName("cookieadmin_cookie_modal")[0].style.display = "grid"; 531 } 532 533 if(e.target.className == "cookieadmin_re_consent"){ 534 document.getElementsByClassName("cookieadmin_close_pref")[0].id = "cookieadmin_re_consent"; 535 }else{ 536 document.getElementsByClassName("cookieadmin_close_pref")[0].id = "cookieadmin_law_container"; 537 } 538 539 cookieadmin_modal_el.focus(); 540 }); 541 }); 542 543 //Save preference 544 document.querySelector(".cookieadmin_save_btn").addEventListener("click", function(){ 545 546 document.getElementsByClassName("cookieadmin_cookie_modal")[0].style.display = "none"; 547 if(cookieadmin_show_reconsent){ 548 document.getElementsByClassName("cookieadmin_re_consent")[0].style.display = "block"; 549 } 550 551 var prefer = {}; 552 553 document.querySelectorAll(".cookieadmin_toggle").forEach(function(e){ 554 if(!!e.children[0].checked){ 555 prefer[e.children[0].id.replace("cookieadmin-","")] = 'true'; 556 } 557 }); 558 559 if(Object.keys(prefer).length !== 0){ 560 var override_gpc = document.getElementById('cookieadmin-override_gpc'); 561 var is_override_gpc = false;
562 if(override_gpc && override_gpc.checked){ 563 is_override_gpc = true; 564 } 565 566 if(Object.keys(prefer).length === 3 && !is_override_gpc){ 567 let accept_btn = document.querySelectorAll(".cookieadmin_accept_btn"); 568 569 if(accept_btn.length > 0){ 570 accept_btn[accept_btn.length-1].click(); 571 } 572 573 return; 574 } 575 }else{ 576 let reject_btn = document.querySelectorAll(".cookieadmin_reject_btn"); 577 578 if(reject_btn.length > 0){ 579 reject_btn[reject_btn.length-1].click(); 580 } 581 582 return; 583 } 584 585 cookieadmin_toggle_overlay(); 586 587 cookieadmin_set_consent(prefer, days); 588 }); 589 590 591 //Accept or reject all cookies 592 cookieadmin_save_all_cookie_elemnts = document.querySelectorAll(".cookieadmin_accept_btn, .cookieadmin_reject_btn"); 593 594 cookieadmin_save_all_cookie_elemnts.forEach(function(e){ 595 596 e.addEventListener("click", function(){ 597 // console.log(e); 598 599 document.getElementsByClassName("cookieadmin_cookie_modal")[0].style.display = "none"; 600 var cookieadmin_law_container = document.getElementsByClassName("cookieadmin_law_container")[0]; 601 if(cookieadmin_law_container){ 602 cookieadmin_law_container.style.display = "none"; 603 } 604 605 var cookieadmin_re_consent = document.getElementsByClassName("cookieadmin_re_consent")[0]; 606 if(cookieadmin_re_consent){ 607 cookieadmin_re_consent.style.display = "block"; 608 } 609 610 if(e.id.includes("modal")){ 611 cookieadmin_toggle_overlay(); 612 } 613 614 var prefer2 = e.classList.contains("cookieadmin_reject_btn") ? {reject: "true"} : {accept: "true"}; 615 616 cookieadmin_set_consent(prefer2, days); 617 }); 618 }); 619 620 document.querySelectorAll(".cookieadmin_show_pref_cookies").forEach(function(btn){ 621 622 // Shared toggle function 623 function toggleAccordion(event){ 624 // Use currentTarget to target the element with the listener, even if child nodes are clicked 625 var trigger = event.currentTarget; 626 var tgt = trigger.id.replace(/-container$/, ""); 627 var targetEl = document.querySelector("." + tgt); 628 629 if (!targetEl){ 630 return; 631 }; 632 633 if(trigger.classList.contains("dwn")){ 634 trigger.innerHTML = "►"; // Right arrow 635 trigger.classList.remove("dwn"); 636 trigger.setAttribute("aria-expanded", "false"); 637 targetEl.style.display = "none"; 638 }else{ 639 trigger.innerHTML = "▼"; // Down arrow 640 trigger.classList.add("dwn"); 641 trigger.setAttribute("aria-expanded", "true"); 642 targetEl.style.display = "block"; 643 } 644 } 645 646 // 2. Native buttons fire click on mouse, Enter and Space 647 btn.addEventListener("click", toggleAccordion); 648 }); 649 650 document.getElementsByClassName("cookieadmin_close_pref")[0].addEventListener("click", function(e){ 651 document.getElementsByClassName("cookieadmin_cookie_modal")[0].style.display = "none"; 652 cookieadmin_toggle_overlay(); 653 if(!cookieadmin_is_obj(cookieadmin_is_consent)){ 654 var cookieadmin_law_container = document.getElementsByClassName("cookieadmin_law_container")[0]; 655 if(cookieadmin_law_container){ 656 cookieadmin_law_container.style.display = "block"; 657 } 658 }else if(cookieadmin_show_reconsent){ 659 var cookieadmin_re_consent = document.getElementsByClassName("cookieadmin_re_consent")[0]; 660 if(cookieadmin_re_consent){ 661 cookieadmin_re_consent.style.display = "block"; 662 } 663 } 664 }); 665 666}); 667 668function cookieadmin_set_consent(prefrenc, days){ 669 670 if (typeof cookieadmin_pro_set_consent === "function") { 671 return cookieadmin_pro_set_consent(prefrenc, days); 672 }else{ 673 return cookieadmin_save_consent_cookie(prefrenc, days); 674 } 675} 676 677function cookieadmin_save_consent_cookie(prefrenc, days, consent_id){ 678 679 var cookieadmin_consent = prefrenc; 680 681 if(consent_id){ 682 cookieadmin_is_consent.consent = consent_id; 683 cookieadmin_consent['consent'] = consent_id; 684 } 685 686 if(!cookieadmin_is_consent.consent){ 687 cookieadmin_is_consent.consent = ""; 688 } 689 690 cookieadmin_is_consent["old_action"] = cookieadmin_is_consent.action ? cookieadmin_is_consent.action : {}; 691 cookieadmin_is_consent.action = prefrenc; 692 cookieadmin_populate_preference(); 693 cookieadmin_set_cookie('cookieadmin_consent', cookieadmin_consent, days); 694 695 if (typeof cookieadmin_update_gcm === "function") { 696 cookieadmin_update_gcm(1); 697 } 698 699 if (typeof cookieadmin_pro_update_clarity_cookie === "function") { 700 cookieadmin_pro_update_clarity_cookie(); 701 } 702 703 if(!!cookieadmin_policy.reload_on_consent){ 704 location.reload(); 705 }else{ 706 cookieadmin_restore_cookies(prefrenc); 707 } 708} 709
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.