1CLI_ACCEPT_COOKIE_NAME =(typeof CLI_ACCEPT_COOKIE_NAME !== 'undefined' ? CLI_ACCEPT_COOKIE_NAME : 'viewed_cookie_policy'); 2CLI_PREFERNCE_COOKIE =(typeof CLI_PREFERNCE_COOKIE !== 'undefined' ? CLI_PREFERNCE_COOKIE : 'CookieLawInfoConsent'); 3CLI_ACCEPT_COOKIE_EXPIRE =(typeof CLI_ACCEPT_COOKIE_EXPIRE !== 'undefined' ? CLI_ACCEPT_COOKIE_EXPIRE : 365); 4CLI_COOKIEBAR_AS_POPUP=(typeof CLI_COOKIEBAR_AS_POPUP !== 'undefined' ? CLI_COOKIEBAR_AS_POPUP : false); 5var CLI_Cookie={ 6 set: function (name, value, days) { 7 if (days) { 8 var date = new Date(); 9 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 10 var expires = "; expires=" + date.toGMTString(); 11 } else 12 { 13 var expires = ""; 14 } 15 document.cookie = name + "=" + value + expires + "; path=/;"+ ( Cli_Data.cookieDomain !== '' ? 'domain=' + Cli_Data.cookieDomain + ';' : '' )+";"; 16 if(days<1) 17 { 18 host_name=window.location.hostname; 19 20 document.cookie = name + "=" + value + expires + "; path=/; domain=."+host_name+";secure"; 21 if(host_name.indexOf("www")!=1) 22 { 23 var host_name_withoutwww=host_name.replace('www',''); 24 document.cookie = name + "=" + value + expires + "; path=/; domain="+host_name_withoutwww+";"; 25 } 26 host_name=host_name.substring(host_name.lastIndexOf(".", host_name.lastIndexOf(".")-1)); 27 document.cookie = name + "=" + value + expires + "; path=/; domain="+host_name+";"; 28 } 29 }, 30 read: function (name) { 31 var nameEQ = name + "="; 32 var ca = document.cookie.split(';'); 33 for (var i = 0; i < ca.length; i++) { 34 var c = ca[i]; 35 while (c.charAt(0) == ' ') { 36 c = c.substring(1, c.length); 37 } 38 if (c.indexOf(nameEQ) === 0) { 39 return c.substring(nameEQ.length, c.length); 40 } 41 } 42 return null; 43 }, 44 erase: function (name) { 45 this.set(name, "", -10); 46 }, 47 exists: function (name) { 48 return (this.read(name) !== null); 49 }, 50 getallcookies:function() 51 { 52 var pairs = document.cookie.split(";"); 53 var cookieslist = {}; 54 for (var i = 0; i < pairs.length; i++) { 55 var pair = pairs[i].split("="); 56 cookieslist[(pair[0] + '').trim()] = unescape(pair[1]); 57 } 58 return cookieslist; 59 } 60} 61var CLI= 62{ 63 bar_config:{}, 64 consent:{}, 65 allowedCategories:[], 66 showagain_config:{}, 67 set:function(args) 68 { 69 if(typeof JSON.parse !== "function") 70 { 71 console.log("CookieLawInfo requires JSON.parse but your browser doesn't support it"); 72 return; 73 } 74 if(typeof args.settings!=='object') 75 { 76 this.settings = JSON.parse(args.settings); 77 }else 78 { 79 this.settings = args.settings; 80 } 81 this.bar_elm=jQuery(this.settings.notify_div_id); 82 this.showagain_elm = jQuery(this.settings.showagain_div_id); 83 84 //buttons 85 this.main_button=jQuery('.cli-plugin-main-button'); 86 this.main_link = jQuery('.cli-plugin-main-link'); 87 this.reject_link = jQuery('.cookie_action_close_header_reject'); 88 this.settings_link = jQuery('.cli_settings_button'); 89 this.delete_link=jQuery(".cookielawinfo-cookie-delete"); 90 91 if(this.settings.cookie_bar_as=='popup') 92 { 93 CLI_COOKIEBAR_AS_POPUP=true; 94 } 95 this.cliRenewConsent(); 96 this.configBar(); 97 this.toggleBar(); 98 this.attachDelete(); 99 this.attachEvents(); 100 this.configButtons(); 101 this.addStyleAttribute(); 102 this.settingsPopUp(); 103 this.cookieLawInfoRunCallBacks(); 104 var cli_hidebar_on_readmore=this.hideBarInReadMoreLink(); 105 if(this.settings.scroll_close===true && cli_hidebar_on_readmore===false) 106 { 107 window.addEventListener("scroll",CLI.closeOnScroll, false); 108 } 109 }, 110 hideBarInReadMoreLink:function() 111 { 112 if(CLI.settings.button_2_hidebar===true && this.main_link.length>0 && this.main_link.hasClass('cli-minimize-bar')) 113 { 114 jQuery('.wt-cli-cookie-bar-container').addClass('wt-cli-hide-bar'); 115 this.hideHeader(); 116 this.showagain_elm.slideDown(this.settings.animate_speed_show); 117 return true; 118 } 119 return false;
120 }, 121 settingsPopUp:function() 122 { 123 jQuery('.cli_settings_button').click(function (e) { 124 e.preventDefault(); 125 if(CLI.settings.cookie_setting_popup==true) 126 { 127 jQuery('#cliSettingsPopup').addClass("cli-show").css({'opacity':0}).animate({'opacity':1}); 128 jQuery('#cliSettingsPopup').removeClass('cli-blowup cli-out').addClass("cli-blowup"); 129 jQuery('body').addClass("cli-modal-open"); 130 jQuery(".cli-settings-overlay").addClass("cli-show"); 131 jQuery("#cookie-law-info-bar").css({'opacity':.1}); 132 if(!jQuery('.cli-settings-mobile').is(':visible')) 133 { 134 jQuery('#cliSettingsPopup').find('.cli-nav-link:eq(0)').click(); 135 } 136 } 137 else 138 { 139 jQuery('#cookie-law-info-bar .cli-tab-container').slideToggle(CLI.settings.animate_speed_show); 140 } 141 142 143 }); 144 jQuery('#cliModalClose').click(function(){ 145 CLI.settingsPopUpClose(); 146 }); 147 jQuery("#cliSettingsPopup").click(function(e){ 148 if(!(document.getElementsByClassName('cli-modal-dialog')[0].contains(e.target))) 149 { 150 CLI.settingsPopUpClose(); 151 } 152 }); 153 jQuery('.cli_enable_all_btn').click(function(){ 154 var cli_toggle_btn = jQuery(this); 155 var enable_text = cli_toggle_btn.attr('data-enable-text'); 156 var disable_text= cli_toggle_btn.attr('data-disable-text'); 157 if(cli_toggle_btn.hasClass('cli-enabled')){ 158 CLI.disableAllCookies(); 159 cli_toggle_btn.html(enable_text); 160 } 161 else 162 { 163 CLI.enableAllCookies(); 164 cli_toggle_btn.html(disable_text); 165 166 } 167 jQuery(this).toggleClass('cli-enabled'); 168 }); 169 this.settingsTabbedAccordion(); 170 this.toggleUserPreferenceCheckBox(); 171 this.privacyReadmore(); 172 }, 173 settingsTabbedAccordion:function() 174 { 175 jQuery(".cli-tab-header").on("click", function(e) { 176 if(!(jQuery(e.target).hasClass('cli-slider') || jQuery(e.target).hasClass('cli-user-preference-checkbox'))) 177 { 178 if (jQuery(this).hasClass("cli-tab-active")) { 179 jQuery(this).removeClass("cli-tab-active"); 180 jQuery(this) 181 .siblings(".cli-tab-content") 182 .slideUp(200); 183 184 } else { 185 jQuery(".cli-tab-header").removeClass("cli-tab-active"); 186 jQuery(this).addClass("cli-tab-active"); 187 jQuery(".cli-tab-content").slideUp(200); 188 jQuery(this) 189 .siblings(".cli-tab-content") 190 .slideDown(200); 191 } 192 } 193 }); 194 }, 195 settingsPopUpClose:function() 196 { 197 jQuery('#cliSettingsPopup').removeClass('cli-show'); 198 jQuery('#cliSettingsPopup').addClass('cli-out'); 199 jQuery('body').removeClass("cli-modal-open"); 200 jQuery(".cli-settings-overlay").removeClass("cli-show"); 201 jQuery("#cookie-law-info-bar").css({'opacity':1}); 202 }, 203 toggleUserPreferenceCheckBox:function() 204 { 205 206 jQuery('.cli-user-preference-checkbox').each(function(){ 207 208 categoryCookie = 'cookielawinfo-'+jQuery(this).attr('data-id'); 209 categoryCookieValue = CLI_Cookie.read(categoryCookie); 210 if( categoryCookieValue == null ) 211 { 212 if(jQuery(this).is(':checked')) 213 { 214 CLI_Cookie.set(categoryCookie,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 215 }else 216 { 217 CLI_Cookie.set(categoryCookie,'no',CLI_ACCEPT_COOKIE_EXPIRE); 218 } 219 } 220 else 221 { 222 if(categoryCookieValue == "yes") 223 { 224 jQuery(this).prop("checked",true); 225 } 226 else 227 { 228 jQuery(this).prop("checked",false); 229 } 230 231 } 232 233 }); 234 jQuery('.cli-user-preference-checkbox').click(function(){ 235 var dataID = jQuery(this).attr('data-id'); 236 var currentToggleElm = jQuery('.cli-user-preference-checkbox[data-id='+dataID+']'); 237 if(jQuery(this).is(':checked')) 238 { 239 CLI_Cookie.set('cookielawinfo-'+dataID,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 240 currentToggleElm.prop('checked',true); 241 }else 242 { 243 CLI_Cookie.set('cookielawinfo-'+dataID,'no',CLI_ACCEPT_COOKIE_EXPIRE); 244 currentToggleElm.prop('checked',false); 245 } 246 CLI.checkCategories(); 247 CLI.generate_user_preference_cookie(); 248 CLI.generateConsent(); 249 }); 250 }, 251 attachEvents:function() 252 { 253 jQuery('.cli_setting_save_button').click(function(){ 254 CLI.accept_close(); 255 CLI.saveLog('accept'); 256 CLI.settingsPopUpClose(); 257 }); 258 259 jQuery(document).on('click','.cli_action_button',function(e){ 260 e.preventDefault(); 261 var elm=jQuery(this); 262 var button_action=elm.attr('data-cli_action'); 263 var open_link=elm[0].hasAttribute("href") && elm.attr("href") != '#' ? true : false;
264 var new_window=false; 265 if(button_action=='accept') 266 { 267 if (e.originalEvent !== undefined) { 268 269 if(CLI.settings.accept_all==true) 270 { 271 CLI.enableAllCookies(); 272 } 273 274 } 275 else 276 { 277 CLI.settingsPopUpClose(); 278 } 279 CLI.accept_close(); 280 new_window=CLI.settings.button_1_new_win ? true : false; 281 }else if(button_action=='reject') 282 { 283 CLI.disableAllCookies(); 284 CLI.reject_close(); 285 new_window=CLI.settings.button_3_new_win ? true : false; 286 } 287 CLI.saveLog(button_action); 288 if(open_link) 289 { 290 if(new_window) 291 { 292 window.open(elm.attr("href"),'_blank'); 293 }else 294 { 295 window.location.href =elm.attr("href"); 296 } 297 } 298 }); 299 jQuery(document).on('click','.cli_cookie_close_button',function(e){ 300 e.preventDefault(); 301 var elm=jQuery(this); 302 var button_action=elm.attr('data-cli_action'); 303 if(CLI.settings.accept_all==true) 304 { 305 CLI.enableAllCookies(); 306 } 307 CLI.accept_close(); 308 CLI.saveLog(button_action); 309 }); 310 }, 311 saveLog:function(button_action) 312 { 313 if(CLI.settings.logging_on) 314 { 315 var ccpaOptedOut = cliBlocker.ccpaOptedOut(); 316 cookies = CLI_Cookie.getallcookies(); 317 cookies.ccpaOptout = ccpaOptedOut; 318 jQuery.ajax({ 319 url: log_object.ajax_url, 320 type: 'POST', 321 data:{ 322 action: 'wt_log_visitor_action', 323 wt_clicked_button_id: '', 324 wt_user_action:button_action, 325 cookie_list:cookies 326 }, 327 success:function (response) 328 { 329 330 } 331 }); 332 } 333 }, 334 attachDelete:function() 335 { 336 this.delete_link.click(function () { 337 CLI_Cookie.erase(CLI_ACCEPT_COOKIE_NAME); 338 for(var k in Cli_Data.nn_cookie_ids) 339 { 340 CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]); 341 } 342 CLI.generate_user_preference_cookie(); 343 CLI.generateConsent(); 344 window.location.reload(); 345 return false; 346 }); 347 }, 348 configButtons:function() 349 { 350 //[cookie_button] 351 this.main_button.css('color',this.settings.button_1_link_colour); 352 if(this.settings.button_1_as_button) 353 { 354 this.main_button.css('background-color',this.settings.button_1_button_colour); 355 this.main_button.hover(function () { 356 jQuery(this).css('background-color',CLI.settings.button_1_button_hover); 357 },function (){ 358 jQuery(this).css('background-color',CLI.settings.button_1_button_colour); 359 }); 360 } 361 362 //[cookie_link] 363 this.main_link.css('color',this.settings.button_2_link_colour); 364 if(this.settings.button_2_as_button) 365 { 366 this.main_link.css('background-color',this.settings.button_2_button_colour); 367 this.main_link.hover(function () { 368 jQuery(this).css('background-color',CLI.settings.button_2_button_hover); 369 },function (){ 370 jQuery(this).css('background-color',CLI.settings.button_2_button_colour); 371 }); 372 } 373 374 375 //[cookie_reject] 376 this.reject_link.css('color',this.settings.button_3_link_colour); 377 if(this.settings.button_3_as_button) 378 { 379 this.reject_link.css('background-color',this.settings.button_3_button_colour); 380 this.reject_link.hover(function () { 381 jQuery(this).css('background-color',CLI.settings.button_3_button_hover); 382 },function () { 383 jQuery(this).css('background-color',CLI.settings.button_3_button_colour); 384 }); 385 } 386 387 //[cookie_settings] 388 this.settings_link.css('color',this.settings.button_4_link_colour); 389 if(this.settings.button_4_as_button) 390 { 391 this.settings_link.css('background-color',this.settings.button_4_button_colour); 392 this.settings_link.hover(function () { 393 jQuery(this).css('background-color',CLI.settings.button_4_button_hover); 394 },function () { 395 jQuery(this).css('background-color',CLI.settings.button_4_button_colour); 396 }); 397 } 398 }, 399 toggleBar:function() 400 { 401 if(CLI_COOKIEBAR_AS_POPUP) 402 { 403 this.barAsPopUp(1); 404 } 405 if(CLI.settings.cookie_bar_as=='widget') 406 { 407 this.barAsWidget(1); 408 } 409 if(this.settings.show_once_yn) 410 { 411 412 setTimeout(function(){ 413 CLI.close_header(); 414 },CLI.settings.show_once); 415 } 416 this.showagain_elm.click(function (e) { 417 e.preventDefault(); 418 CLI.showagain_elm.slideUp(CLI.settings.animate_speed_hide,function() 419 { 420 CLI.bar_elm.slideDown(CLI.settings.animate_speed_show); 421 if(CLI_COOKIEBAR_AS_POPUP) 422 { 423 CLI.showPopupOverlay(); 424 } 425 }); 426 }); 427 }, 428 configShowAgain:function() 429 { 430 this.showagain_config = { 431 'background-color': this.settings.background, 432 'color':this.settings.text, 433 'position': 'fixed', 434 'font-family': this.settings.font_family 435 }; 436 if(this.settings.border_on) 437 { 438 var border_to_hide = 'border-' + this.settings.notify_position_vertical; 439 this.showagain_config['border'] = '1px solid ' + this.l1hs(this.settings.border); 440 this.showagain_config[border_to_hide] = 'none'; 441 } 442 var cli_win=jQuery(window); 443 var cli_winw=cli_win.width(); 444 var showagain_x_pos=this.settings.showagain_x_position; 445 if(cli_winw<300) 446 { 447 showagain_x_pos=10; 448 this.showagain_config.width=cli_winw-20; 449 }else 450 { 451 this.showagain_config.width='auto'; 452 } 453 var cli_defw=cli_winw>400 ? 500 : cli_winw-20; 454 if(CLI_COOKIEBAR_AS_POPUP) //cookie bar as popup 455 { 456 var sa_pos=this.settings.popup_showagain_position; 457 var sa_pos_arr=sa_pos.split('-'); 458 if(sa_pos_arr[1]=='left') 459 { 460 this.showagain_config.left=showagain_x_pos; 461 }else if(sa_pos_arr[1]=='right') 462 { 463 this.showagain_config.right=showagain_x_pos; 464 } 465 if(sa_pos_arr[0]=='top') 466 { 467 this.showagain_config.top=0; 468 469 }else if(sa_pos_arr[0]=='bottom') 470 { 471 this.showagain_config.bottom=0; 472 } 473 this.bar_config['position'] = 'fixed'; 474 475 }else if(this.settings.cookie_bar_as=='widget') 476 { 477 this.showagain_config.bottom=0; 478 if(this.settings.widget_position=='left') 479 { 480 this.showagain_config.left=showagain_x_pos; 481 }else if(this.settings.widget_position=='right') 482 { 483 this.showagain_config.right=showagain_x_pos; 484 } 485 } 486 else 487 { 488 if(this.settings.notify_position_vertical == "top") 489 { 490 this.showagain_config.top = '0'; 491 } 492 else if(this.settings.notify_position_vertical == "bottom") 493 { 494 this.bar_config['position'] = 'fixed'; 495 this.bar_config['bottom'] = '0'; 496 this.showagain_config.bottom = '0'; 497 } 498 if(this.settings.notify_position_horizontal == "left") 499 { 500 this.showagain_config.left =showagain_x_pos; 501 }else if(this.settings.notify_position_horizontal == "right") 502 { 503 this.showagain_config.right =showagain_x_pos; 504 } 505 } 506 this.showagain_elm.css(this.showagain_config); 507 }, 508 configBar:function() 509 { 510 var templateID = ''; 511 this.bar_config = { 512 'background-color':this.settings.background, 513 'color':this.settings.text, 514 'font-family':this.settings.font_family 515 }; 516 if (jQuery(".wt-cli-template")[0]) 517 { 518 var templateElm = jQuery(".wt-cli-template"); 519 var templateClasses = templateElm.attr('class'); 520 var templateClasses = templateClasses.split(" "); 521 var matchingID = templateClasses.filter(function (value) { 522 523 return value.match(/\bcli-style/); 524 525 }); 526 templateID = matchingID[0]; 527 this.bar_elm.attr('data-template-id',templateID); 528 } 529 if(jQuery(".wt-cli-category-widget")[0]) 530 { 531 this.bar_elm.addClass('wt-cli-category-widget-active'); 532 } 533 if(this.settings.cookie_setting_popup===false) 534 { 535 this.barPopupStyle(); 536 } 537 if(this.settings.notify_position_vertical=="top") 538 { 539 this.bar_config['top'] = '0'; 540 if(this.settings.header_fix === true) 541 { 542 this.bar_config['position'] = 'fixed'; 543 } 544 }else 545 { 546 this.bar_config['bottom'] = '0'; 547 } 548 this.configShowAgain(); 549 this.bar_elm.css(this.bar_config).hide(); 550 }, 551 l1hs:function(str) 552 { 553 if (str.charAt(0) == "#") { 554 str = str.substring(1, str.length); 555 } else { 556 return "#" + str; 557 } 558 return this.l1hs(str); 559 }, 560 close_header:function() 561 { 562 CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 563 if(CLI.settings.accept_all==true) 564 { 565 CLI.enableAllCookies(); 566 } 567 CLI.accept_close(); 568 this.hideHeader(); 569 CLI.saveLog('accept'); 570 571 }, 572 accept_close:function() 573 { 574 575 this.hidePopupOverlay(); 576 CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 577 if(this.settings.notify_animate_hide) 578 { 579 this.bar_elm.slideUp(this.settings.animate_speed_hide,cliBlocker.runScripts); 580 }else 581 { 582 this.bar_elm.hide(cliBlocker.runScripts); 583 } 584 if(this.settings.showagain_tab) 585 { 586 this.showagain_elm.slideDown(this.settings.animate_speed_show); 587 } 588 this.generate_user_preference_cookie(); 589 this.generateConsent(); 590 CLI.cookieLawInfoRunCallBacks(); 591 if(this.settings.accept_close_reload === true) 592 { 593 this.reload_current_page(); 594 } 595 596 return false;
597 }, 598 reject_close:function() 599 { 600 this.hidePopupOverlay(); 601 for(var k in Cli_Data.nn_cookie_ids) 602 { 603 CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]); 604 } 605 CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'no',CLI_ACCEPT_COOKIE_EXPIRE); 606 if(this.settings.notify_animate_hide) 607 { 608 this.bar_elm.slideUp(this.settings.animate_speed_hide,cliBlocker.runScripts); 609 }else 610 { 611 this.bar_elm.hide(cliBlocker.runScripts); 612 } 613 if(this.settings.showagain_tab) 614 { 615 this.showagain_elm.slideDown(this.settings.animate_speed_show); 616 } 617 this.generate_user_preference_cookie(); 618 CLI.generateConsent(); 619 if(this.settings.reject_close_reload === true) 620 { 621 this.reload_current_page(); 622 } 623 return false; 624 }, 625 generate_user_preference_cookie:function() 626 { 627 var cli_user_preference_arr=new Array(); 628 var cli_user_preference_val=''; 629 if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)) 630 { 631 cli_user_preference_arr.push('cli-'+CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)); 632 } 633 jQuery('.cli-user-preference-checkbox').each(function(){ 634 if(jQuery(this).is(':checked')) 635 { 636 cli_user_preference_arr.push(jQuery(this).attr('data-id')+'-yes'); 637 }else 638 { 639 cli_user_preference_arr.push(jQuery(this).attr('data-id')+'-no'); 640 } 641 }); 642 if(cli_user_preference_arr.length>0) 643 { 644 cli_user_preference_val=Cli_Data.current_lang+'-'+cli_user_preference_arr.join('-'); 645 } 646 CLI_Cookie.set('cli_user_preference',cli_user_preference_val,CLI_ACCEPT_COOKIE_EXPIRE); 647 }, 648 isBase64:function(str) { 649 if (str ==='' || str.trim() ===''){ return false; } 650 try { 651 return btoa(atob(str)) == str; 652 } catch (err) { 653 return false; 654 } 655 }, 656 generateConsent:function() 657 { 658 var preferenceCookie = CLI_Cookie.read(CLI_PREFERNCE_COOKIE); 659 cliConsent = {}; 660 if(preferenceCookie !== null) { 661 if(CLI.isBase64(preferenceCookie)) 662 { 663 cliConsent = window.atob(preferenceCookie); 664 } 665 else 666 { 667 cliConsent = decodeURIComponent(preferenceCookie); 668 } 669 cliConsent = JSON.parse(cliConsent); 670 } 671 cliConsent.ver = Cli_Data.consentVersion; 672 categories = []; 673 jQuery('.cli-user-preference-checkbox').each(function(){ 674 categoryVal = ''; 675 cli_chkbox_data_id = jQuery(this).attr('data-id'); 676 cli_chkbox_data_id = cli_chkbox_data_id.replace('checkbox-',''); 677 if(jQuery(this).is(':checked')) 678 { 679 categoryVal = 'true'; 680 } 681 else 682 { 683 categoryVal = 'false'; 684 } 685 cliConsent[cli_chkbox_data_id] = categoryVal; 686 687 }); 688 cliConsent = JSON.stringify(cliConsent); 689 cliConsent = window.btoa(cliConsent); 690 CLI_Cookie.set(CLI_PREFERNCE_COOKIE,cliConsent,CLI_ACCEPT_COOKIE_EXPIRE); 691 }, 692 cliRenewConsent:function() 693 { 694 var preferenceCookie = CLI_Cookie.read(CLI_PREFERNCE_COOKIE); 695 if(preferenceCookie !== null) 696 { 697 if(CLI.isBase64(preferenceCookie)) 698 { 699 cliConsent = window.atob(preferenceCookie); 700 } 701 else 702 { 703 cliConsent = decodeURIComponent(preferenceCookie); 704 } 705 cliConsent = JSON.parse(cliConsent); 706 consentCurrentVersion = parseInt(cliConsent.ver); 707 consentRenewVersion = parseInt(Cli_Data.consentVersion); 708 if( typeof(cliConsent.ver) !== 'undefined') { 709 if(cliConsent.ver !== Cli_Data.consentVersion) 710 { 711 CLI_Cookie.erase(CLI_ACCEPT_COOKIE_NAME); 712 CLI_Cookie.erase(CLI_PREFERNCE_COOKIE); 713 CLI_Cookie.erase('cli_user_preference'); 714 for(var k in Cli_Data.nn_cookie_ids) 715 { 716 CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]); 717 } 718 } 719 } 720 } 721 722 723 }, 724 reload_current_page:function() 725 { 726 window.location.reload(true); 727 }, 728 add_clear_cache_url_query:function() 729 { 730 var cli_rand=new Date().getTime()/1000; 731 var cli_url=window.location.href; 732 var cli_hash_arr=cli_url.split('#'); 733 var cli_urlparts= cli_hash_arr[0].split('?'); 734 if(cli_urlparts.length>=2) 735 { 736 var cli_url_arr=cli_urlparts[1].split('&'); 737 cli_url_temp_arr=new Array(); 738 for(var cli_i=0; cli_i<cli_url_arr.length; cli_i++) 739 { 740 var cli_temp_url_arr=cli_url_arr[cli_i].split('='); 741 if(cli_temp_url_arr[0]=='cli_action') 742 { 743 744 }else 745 { 746 cli_url_temp_arr.push(cli_url_arr[cli_i]); 747 } 748 } 749 cli_urlparts[1]=cli_url_temp_arr.join('&'); 750 cli_url=cli_urlparts.join('?')+(cli_url_temp_arr.length>0 ? '&': '')+'cli_action='; 751 }else 752 { 753 cli_url=cli_hash_arr[0]+'?cli_action='; 754 } 755 cli_url+=cli_rand; 756 if(cli_hash_arr.length>1) 757 { 758 cli_url+='#'+cli_hash_arr[1]; 759 } 760 return cli_url; 761 }, 762 closeOnScroll:function() 763 { 764 if(window.pageYOffset > 100 && !CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)) 765 { 766 if(CLI.settings.accept_all==true) 767 { 768 CLI.enableAllCookies(); 769 }
770 CLI.accept_close(); 771 CLI.saveLog('accept'); 772 if(CLI.settings.scroll_close_reload === true) 773 { 774 window.location.reload(); 775 } 776 window.removeEventListener("scroll",CLI.closeOnScroll,false); 777 } 778 }, 779 displayHeader:function() 780 { 781 if(this.settings.notify_animate_show) 782 { 783 this.bar_elm.slideDown(this.settings.animate_speed_show); 784 }else 785 { 786 this.bar_elm.show(); 787 } 788 this.showagain_elm.hide(); 789 if(CLI_COOKIEBAR_AS_POPUP) 790 { 791 this.showPopupOverlay(); 792 } 793 }, 794 hideHeader:function() 795 { 796 if(this.settings.showagain_tab) 797 { 798 if(this.settings.notify_animate_show) 799 { 800 this.showagain_elm.slideDown(this.settings.animate_speed_show); 801 } else { 802 this.showagain_elm.show(); 803 } 804 }else 805 { 806 this.showagain_elm.hide(); 807 } 808 this.bar_elm.slideUp(this.settings.animate_speed_show); 809 this.hidePopupOverlay(); 810 }, 811 hidePopupOverlay:function() 812 { 813 814 jQuery('body').removeClass("cli-barmodal-open"); 815 jQuery(".cli-popupbar-overlay").removeClass("cli-show"); 816 }, 817 showPopupOverlay:function() 818 { 819 if( this.bar_elm.length ) { 820 if(this.settings.popup_overlay) 821 { 822 823 if( ! ( this.main_link.hasClass('cli-minimize-bar') )) { 824 jQuery('body').addClass("cli-barmodal-open"); 825 jQuery(".cli-popupbar-overlay").addClass("cli-show"); 826 } 827 828 } 829 } 830 831 }, 832 barAsWidget:function(a) 833 { 834 var cli_elm=this.bar_elm; 835 cli_elm.attr('data-cli-type','widget'); 836 var cli_win=jQuery(window); 837 var cli_winh=cli_win.height()-40; 838 var cli_winw=cli_win.width(); 839 var cli_defw=cli_winw>465 ? 445 : cli_winw-60; 840 cli_elm.css({ 841 'width':cli_defw,'height':'auto','max-height':cli_winh,'overflow':'auto','position':'fixed','box-shadow':'rgba(0,0,0,.5) 0px 5px 10px','box-sizing':'border-box' 842 }); 843 if(this.settings.widget_position=='left') 844 { 845 cli_elm.css({ 846 'left':'30px','right':'auto','bottom':'30px','top':'auto' 847 }); 848 }else 849 { 850 cli_elm.css({ 851 'left':'auto','right':'30px','bottom':'30px','top':'auto' 852 }); 853 } 854 if(a) 855 { 856 this.setResize(); 857 } 858 }, 859 barAsPopUp:function(a) 860 { 861 if(typeof cookie_law_info_bar_as_popup==='function') 862 { 863 return false; 864 } 865 var cli_elm=this.bar_elm; 866 cli_elm.attr('data-cli-type','popup'); 867 var cli_win=jQuery(window); 868 var cli_winh=cli_win.height(); 869 var cli_defh = cli_winh > 500 ? 500 : cli_winh; 870 var cli_winw=cli_win.width(); 871 var cli_defw=cli_winw>700 ? 500 : cli_winw-20; 872 //var cli_defw=cli_defw<500 ? 500 : cli_defw; 873 cli_elm.css({ 874 'width':cli_defw,'height':'auto','max-height':cli_defh,'bottom':'','top':'50%','left':'50%','transform':'translate(-50%, -50%)','overflow':'auto' 875 }); 876 if(a) 877 { 878 this.setResize(); 879 } 880 }, 881 setResize:function() 882 { 883 var resizeTmr=null; 884 jQuery(window).resize(function() { 885 clearTimeout(resizeTmr); 886 resizeTmr=setTimeout(function() 887 { 888 if(CLI_COOKIEBAR_AS_POPUP) 889 { 890 CLI.barAsPopUp(); 891 } 892 if(CLI.settings.cookie_bar_as=='widget') 893 { 894 CLI.barAsWidget(); 895 } 896 CLI.configShowAgain(); 897 },500); 898 }); 899 }, 900 isValidHex:function(color) { 901 if(!color || typeof color !== 'string') return false; 902 903 // Validate hex values 904 if(color.substring(0, 1) === '#') color = color.substring(1); 905 906 switch(color.length) { 907 case 3: return /^[0-9A-F]{3}$/i.test(color); 908 case 6: return /^[0-9A-F]{6}$/i.test(color); 909 case 8: return /^[0-9A-F]{8}$/i.test(color); 910 default: return false; 911 } 912 return false; 913 }, 914 ColorLuminance:function(hex, lum) { 915 // validate hex string 916 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 917 if (hex.length < 6) { 918 hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; 919 } 920 lum = lum || 0; 921 // convert to decimal and change luminosity 922 var rgb = "#", c, i; 923 for (i = 0; i < 3; i++) { 924 c = parseInt(hex.substr(i*2,2), 16); 925 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 926 rgb += ("00"+c).substr(c.length); 927 } 928 return rgb; 929 }, 930 rgb2hex:function(rgb){ 931 rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); 932 return (rgb && rgb.length === 4) ? "#" + 933 ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + 934 ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + 935 ("0" + parseInt(rgb[3],10).toString(16)).slice(-2) : ''; 936 }, 937 lightOrDark:function(color) { 938 939 // Variables for red, green, blue values 940 var r, g, b, hsp; 941 942 // Check the format of the color, HEX or RGB? 943 if (color.match(/^rgb/)) { 944 945 // If HEX --> store the red, green, blue values in separate variables 946 color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/); 947 948 r = color[1]; 949 g = color[2]; 950 b = color[3]; 951 } 952 else { 953 954 // If RGB --> Convert it to HEX: http://gist.github.com/983661 955 color = +("0x" + color.slice(1).replace( 956 color.length < 5 && /./g, '$&$&')); 957 958 r = color >> 16; 959 g = color >> 8 & 255; 960 b = color & 255; 961 } 962 963 // HSP (Highly Sensitive Poo) equation from http://alienryderflex.com/hsp.html 964 hsp = Math.sqrt( 965 0.299 * (r * r) + 966 0.587 * (g * g) + 967 0.114 * (b * b) 968 ); 969 970 // Using the HSP value, determine whether the color is light or dark 971 if (hsp>127.5) { 972 973 return 'light'; 974 } 975 else { 976 977 return 'dark'; 978 } 979 }, 980 barPopupStyle:function() 981 { 982 var acceptBtn = jQuery('.cli_action_button[data-cli_action=accept]'); 983 var primaryColor = this.settings.button_1_button_colour; 984 var primaryLinkColor = this.settings.button_1_link_colour; 985 var barColor = this.settings.background; 986 var extractedStyle = ''; 987 var primaryBtnStyle = this.settings.button_1_style; 988 Object.keys(primaryBtnStyle).forEach(function(element) { 989 extractedStyle+=primaryBtnStyle[element][0]+':'+primaryBtnStyle[element][1]+';'; 990 }); 991 var shadeColor; 992 if(!CLI.isValidHex(barColor)) 993 { 994 barColor=CLI.rgb2hex(barColor); 995 } 996 if(barColor=="#000000") 997 { 998 shadeColor='#191919'; 999 } 1000 else 1001 { 1002 var intensity=CLI.lightOrDark(barColor); 1003 if(intensity=='light') 1004 { 1005 shadeColor = CLI.ColorLuminance(barColor, -0.05); 1006 } 1007 else 1008 {
1009 shadeColor = CLI.ColorLuminance(barColor, 0.4); 1010 } 1011 } 1012 jQuery("<style>") 1013 .prop("type", "text/css") 1014 .html("\ 1015 #cookie-law-info-bar .cli-switch input:checked + .cli-slider{\ 1016 background-color: "+primaryColor+";\ 1017 }\ 1018 #cookie-law-info-bar .cli-tab-header{\ 1019 background-color: "+shadeColor+"\ 1020 }\ 1021 #cookie-law-info-bar .cli-switch .cli-slider:before{\ 1022 background-color: "+barColor+";\ 1023 }\ 1024 #cookie-law-info-bar .cli-tab-footer .cli-btn{\ 1025 background-color:"+primaryColor+";"+extractedStyle+"\ 1026 }\ 1027 ").appendTo("head"); 1028 1029 }, 1030 enableAllCookies:function() 1031 { 1032 1033 jQuery('.cli-user-preference-checkbox').each(function(){ 1034 var cli_chkbox_elm=jQuery(this); 1035 var cli_chkbox_data_id=cli_chkbox_elm.attr('data-id'); 1036 if(cli_chkbox_data_id!='checkbox-necessary') 1037 { 1038 cli_chkbox_elm.prop('checked',true); 1039 CLI_Cookie.set('cookielawinfo-'+cli_chkbox_data_id,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 1040 } 1041 }); 1042 }, 1043 disableAllCookies:function() 1044 { 1045 jQuery('.cli-user-preference-checkbox').each(function(){ 1046 1047 var cli_chkbox_elm=jQuery(this); 1048 var cli_chkbox_data_id=cli_chkbox_elm.attr('data-id'); 1049 cliCategorySlug = cli_chkbox_data_id.replace('checkbox-',''); 1050 if(Cli_Data.strictlyEnabled.indexOf(cliCategorySlug) === -1) 1051 { 1052 cli_chkbox_elm.prop('checked',false); 1053 CLI_Cookie.set('cookielawinfo-'+cli_chkbox_data_id,'no',CLI_ACCEPT_COOKIE_EXPIRE); 1054 } 1055 }); 1056 }, 1057 privacyReadmore:function() 1058 { 1059 var el= jQuery('.cli-privacy-content .cli-privacy-content-text'), 1060 clone= el.clone(), 1061 originalHtml= clone.html(), 1062 originalHeight= el.outerHeight(); 1063 if( ! el.length ) { 1064 return; 1065 } 1066 Trunc = { 1067 addReadmore:function(textBlock) 1068 { 1069 if(textBlock.html().length > Cli_Data.privacy_length) 1070 { 1071 jQuery('.cli-privacy-readmore').show(); 1072 } 1073 else 1074 { 1075 jQuery('.cli-privacy-readmore').hide(); 1076 } 1077 }, 1078 truncateText : function( textBlock ) { 1079 var strippedText = jQuery('<div />').html(textBlock.html()); 1080 strippedText.find('table').remove(); 1081 textBlock.html(strippedText.html()); 1082 currentText = textBlock.text(); 1083 if(currentText.trim().length > Cli_Data.privacy_length){ 1084 var newStr = currentText.substring(0, Cli_Data.privacy_length); 1085 textBlock.empty().html(newStr).append('...'); 1086 } 1087 }, 1088 replaceText: function ( textBlock, original ){ 1089 return textBlock.html(original); 1090 } 1091 1092 }; 1093 Trunc.addReadmore(el); 1094 Trunc.truncateText(el); 1095 jQuery('a.cli-privacy-readmore').click(function(e){ 1096 e.preventDefault(); 1097 if(jQuery('.cli-privacy-overview').hasClass('cli-collapsed')) 1098 { 1099 Trunc.truncateText(el); 1100 jQuery('.cli-privacy-overview').removeClass('cli-collapsed'); 1101 el.css('height', '100%'); 1102 } 1103 else 1104 { 1105 jQuery('.cli-privacy-overview').addClass('cli-collapsed'); 1106 Trunc.replaceText(el, originalHtml); 1107 } 1108 1109 1110 }); 1111 }, 1112 checkCategories:function() 1113 { 1114 var cliAllowedCategories = []; 1115 var cli_categories = {}; 1116 jQuery('.cli-user-preference-checkbox').each(function() 1117 { var status=false; 1118 cli_chkbox_elm=jQuery(this); 1119 cli_chkbox_data_id=cli_chkbox_elm.attr('data-id'); 1120 cli_chkbox_data_id=cli_chkbox_data_id.replace('checkbox-',''); 1121 cli_chkbox_data_id_trimmed=cli_chkbox_data_id.replace('-','_') 1122 if(jQuery(cli_chkbox_elm).is(':checked')) 1123 { 1124 status=true; 1125 cliAllowedCategories.push(cli_chkbox_data_id); 1126 } 1127 1128 cli_categories[cli_chkbox_data_id_trimmed]= status; 1129 }); 1130 CLI.allowedCategories = cliAllowedCategories; 1131 CLI.consent=cli_categories; 1132 },
1133 cookieLawInfoRunCallBacks:function() 1134 { 1135 this.checkCategories(); 1136 if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes') 1137 { 1138 if("function" == typeof CookieLawInfo_Accept_Callback){ 1139 CookieLawInfo_Accept_Callback(); 1140 } 1141 } 1142 }, 1143 addStyleAttribute:function() 1144 { 1145 var bar=this.bar_elm; 1146 var styleClass=''; 1147 if(jQuery(bar).find('.cli-bar-container').length > 0) 1148 { 1149 styleClass=jQuery('.cli-bar-container').attr('class'); 1150 styleClass=jQuery.trim(styleClass.replace('cli-bar-container','')); 1151 jQuery(bar).attr('data-cli-style',styleClass); 1152 } 1153 }, 1154 getParameterByName: function( name, url ) { 1155 if (!url) url = window.location.href; 1156 name = name.replace(/[\[\]]/g, '\\$&'); 1157 var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), 1158 results = regex.exec(url); 1159 if (!results) return null; 1160 if (!results[2]) return ''; 1161 return decodeURIComponent(results[2].replace(/\+/g, ' ')); 1162 } 1163} 1164var cliBlocker = 1165{ 1166 blockingStatus: true, 1167 geoIP: false, 1168 scriptsLoaded: false, 1169 ccpaEnabled : false, 1170 ccpaRegionBased : false, 1171 ccpaApplicable : false, 1172 ccpaBarEnabled: false, 1173 cliShowBar: true , 1174 isBypassEnabled: CLI.getParameterByName('cli_bypass'), 1175 checkPluginStatus:function(callbackA , callbackB ) 1176 { 1177 var euCountries = Cli_Data.eu_countries; 1178 cliBlocker.ccpaEnabled = Boolean( Cli_Data.ccpaEnabled ); 1179 cliBlocker.ccpaRegionBased = Boolean( Cli_Data.ccpaRegionBased ); 1180 cliBlocker.ccpaBarEnabled = Boolean( Cli_Data.ccpaBarEnabled ); 1181 if( cliBlocker.ccpaEnabled === true ) { 1182 cliBlocker.ccpaApplicable = true; 1183 if( Cli_Data.ccpaType === 'ccpa') { 1184 cliBlocker.blockingStatus = false; 1185 cliBlocker.cliShowBar = false; 1186 if( cliBlocker.ccpaBarEnabled === true ) { 1187 cliBlocker.cliShowBar = true; 1188 cliBlocker.blockingStatus = true; 1189 } 1190 } 1191 } 1192 1193 if(Cli_Data.geoIP === 'enabled' || (cliBlocker.ccpaEnabled === true && cliBlocker.ccpaRegionBased === true ) ) 1194 { 1195 jQuery.getJSON('https://ipapi.co/json/', function(data) 1196 { 1197 if( (data.in_eu === false ) && (euCountries.indexOf(data.country) === -1)) 1198 { 1199 if( Cli_Data.geoIP === 'enabled' ) { 1200 cliBlocker.blockingStatus = false; 1201 cliBlocker.cliShowBar = false; 1202 } 1203 else { 1204 if( Cli_Data.ccpaType !== 'ccpa' ) { 1205 cliBlocker.blockingStatus = true; 1206 cliBlocker.cliShowBar = true; 1207 } 1208 } 1209 } 1210 else 1211 { 1212 jQuery('body').addClass('wt-cli-geoip-on wt-cli-eu-country'); 1213 } 1214 if( cliBlocker.ccpaEnabled === true ) { 1215 if( cliBlocker.ccpaRegionBased === true && data.region_code !== 'CA' ) { 1216 cliBlocker.ccpaApplicable = false; 1217 if( Cli_Data.ccpaType === 'ccpa') { 1218 cliBlocker.cliShowBar = false; 1219 cliBlocker.blockingStatus = false; 1220 } 1221 jQuery('.wt-cli-ccpa-opt-out,.wt-cli-ccpa-checkbox,.wt-cli-ccpa-element').remove(); 1222 } 1223 else { 1224 cliBlocker.ccpaApplicable = true; 1225 if( cliBlocker.ccpaBarEnabled === true ) { 1226 cliBlocker.cliShowBar = true; 1227 } 1228 } 1229 1230 } 1231 if( cliBlocker.blockingStatus === false ) { 1232 1233 if("function" == typeof CookieLawInfo_Accept_Callback){ 1234 CookieLawInfo_Accept_Callback(); 1235 } 1236 jQuery('body').addClass('wt-cli-geoip-on wt-cli-non-eu-country'); 1237 CLI.hidePopupOverlay(); 1238 if( cliBlocker.ccpaApplicable !== true ) { 1239 cliBlocker.removeAllPreferenceCookies(); 1240 jQuery('.wt-cli-geoip-on.wt-cli-non-eu-country').find('.wt-cli-element').remove(); 1241 1242 } 1243 } 1244 callbackA(); 1245 callbackB(); 1246 }); 1247 } else { 1248 if ( cliBlocker.isBypassEnabled === "1") { 1249 cliBlocker.blockingStatus = false; 1250 } 1251 callbackA(); 1252 callbackB(); 1253 } 1254 1255 }, 1256 cookieBar: function() 1257 { 1258 if( cliBlocker.cliShowBar === false ) 1259 { 1260 jQuery('.wt-cli-cookie-bar-container').remove(); 1261 } 1262 else 1263 { 1264 jQuery('.wt-cli-cookie-bar-container').show(); 1265 if(!CLI_Cookie.exists(CLI_ACCEPT_COOKIE_NAME)) 1266 { 1267 CLI.displayHeader(); 1268 } 1269 else 1270 { 1271 CLI.hideHeader(); 1272 } 1273 } 1274 }, 1275 removeAllPreferenceCookies : function() 1276 { 1277 cliPreferenceCookies = Cli_Data.cookielist; 1278 for (var key in cliPreferenceCookies ) { 1279 CLI_Cookie.erase('cookielawinfo-checkbox-'+key); 1280 } 1281 }, 1282 removeCookieByCategory : function() 1283 { 1284 1285 if(cliBlocker.blockingStatus === true) 1286 { 1287 if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) !== null) 1288 { 1289 non_necessary_cookies = Cli_Data.non_necessary_cookies; 1290 for (var key in non_necessary_cookies) { 1291 currentCategory = key; 1292 if(CLI.allowedCategories.indexOf(currentCategory) === -1) 1293 {
1294 var nonNecessaryCookies = non_necessary_cookies[currentCategory]; 1295 for(i=0; i < nonNecessaryCookies.length; i++) 1296 { 1297 1298 if(CLI_Cookie.read(nonNecessaryCookies[i]) !== null) 1299 { 1300 CLI_Cookie.erase(nonNecessaryCookies[i]); 1301 } 1302 1303 } 1304 } 1305 } 1306 } 1307 } 1308 }, 1309 runScripts:function() 1310 { 1311 srcReplaceableElms = ['iframe','IFRAME','EMBED','embed','OBJECT','object','IMG','img']; 1312 var genericFuncs = 1313 { 1314 1315 renderByElement: function(callback) 1316 { 1317 cliScriptFuncs.renderScripts(); 1318 cliHtmlElmFuncs.renderSrcElement(); 1319 callback(); 1320 cliBlocker.scriptsLoaded = true; 1321 }, 1322 reviewConsent : function() 1323 { 1324 jQuery(document).on('click','.cli_manage_current_consent',function(){ 1325 CLI.bar_elm.slideDown(CLI.settings.animate_speed_show); 1326 }); 1327 } 1328 1329 }; 1330 var cliScriptFuncs = 1331 { 1332 // trigger DOMContentLoaded 1333 scriptsDone:function() 1334 { 1335 1336 var DOMContentLoadedEvent = document.createEvent('Event') 1337 DOMContentLoadedEvent.initEvent('DOMContentLoaded', true, true) 1338 window.document.dispatchEvent(DOMContentLoadedEvent) 1339 1340 }, 1341 seq :function(arr, callback, index) { 1342 // first call, without an index 1343 if (typeof index === 'undefined') { 1344 index = 0 1345 } 1346 1347 arr[index](function () { 1348 index++ 1349 if (index === arr.length) { 1350 callback() 1351 } else { 1352 cliScriptFuncs.seq(arr, callback, index) 1353 } 1354 }) 1355 }, 1356 /* script runner */ 1357 insertScript:function($script,callback) { 1358 1359 var s =''; 1360 var allowedAttributes = [ 1361 'data-cli-class', 1362 'data-cli-label', 1363 'data-cli-placeholder', 1364 'data-cli-script-type', 1365 'data-cli-src' 1366 ]; 1367 var scriptType = $script.getAttribute('data-cli-script-type'); 1368 var elementPosition = $script.getAttribute('data-cli-element-position'); 1369 var isBlock = $script.getAttribute('data-cli-block'); 1370 var blockIfCCPA = $script.getAttribute('data-cli-block-if-ccpa-optout'); 1371 var s = document.createElement('script'); 1372 var ccpaOptedOut = cliBlocker.ccpaOptedOut(); 1373 s.type = 'text/plain'; 1374 if($script.async) 1375 { 1376 s.async = $script.async; 1377 } 1378 if($script.defer) 1379 { 1380 s.defer = $script.defer; 1381 } 1382 if ($script.src) { 1383 s.onload = callback 1384 s.onerror = callback 1385 s.src = $script.src 1386 } else { 1387 s.textContent = $script.innerText 1388 } 1389 var attrs = jQuery($script).prop("attributes"); 1390 for (var ii = 0; ii < attrs.length; ++ii) { 1391 if (attrs[ii].nodeName !== 'id') { 1392 s.setAttribute(attrs[ii].nodeName,attrs[ii].value); 1393 } 1394 } 1395 1396 if(cliBlocker.blockingStatus === true) 1397 { 1398 1399 if(( CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes' && CLI.allowedCategories.indexOf(scriptType) !== -1 ) || ( CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null && isBlock==='false') ) 1400 { 1401 s.setAttribute('data-cli-consent','accepted'); 1402 s.type = 'text/javascript'; 1403 1404 } 1405 if( Cli_Data.ccpaType === 'ccpa' && blockIfCCPA !== 'true') 1406 { 1407 s.type = 'text/javascript'; 1408 } 1409 } 1410 else 1411 { 1412 s.type = 'text/javascript'; 1413 } 1414 if( cliBlocker.ccpaApplicable === true && blockIfCCPA === 'true' ) { 1415 if( ccpaOptedOut === true || CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null ) { 1416 s.type = 'text/plain'; 1417 } 1418 } 1419 1420 if($script.type != s.type) 1421 { 1422 if(elementPosition === 'head') 1423 { 1424 document.head.appendChild(s); 1425 } 1426 else 1427 { 1428 document.body.appendChild(s); 1429 } 1430 if (!$script.src) 1431 { 1432 callback() 1433 } 1434 $script.parentNode.removeChild($script); 1435 } 1436 else { 1437 callback(); 1438 } 1439 }, 1440 renderScripts:function() 1441 { 1442 var $scripts = document.querySelectorAll('script[data-cli-class="cli-blocker-script"]'); 1443 if($scripts.length > 0) 1444 { 1445 var runList = [] 1446 var typeAttr 1447 Array.prototype.forEach.call($scripts, function ($script) { 1448 1449 // only run script tags without the type attribute 1450 // or with a javascript mime attribute value 1451 typeAttr = $script.getAttribute('type') 1452 var elmType = $script.tagName; 1453 runList.push(function (callback) { 1454 cliScriptFuncs.insertScript($script, callback) 1455 }) 1456 }) 1457 cliScriptFuncs.seq(runList, cliScriptFuncs.scriptsDone); 1458 } 1459 } 1460 }; 1461 var cliHtmlElmFuncs = { 1462 renderSrcElement: function() 1463 { 1464 var blockingElms = document.querySelectorAll('[data-cli-class="cli-blocker-script"]'); 1465 var ccpaOptedOut = cliBlocker.ccpaOptedOut(); 1466 for (var i = 0; i < blockingElms.length; i++) 1467 { 1468 var currentElm = blockingElms[i]; 1469 var elmType = currentElm.tagName; 1470 if(srcReplaceableElms.indexOf(elmType) !== -1) 1471 { 1472 var elmCategory = currentElm.getAttribute('data-cli-script-type'); 1473 var isBlock = currentElm.getAttribute('data-cli-block'); 1474 var blockIfCCPA = currentElm.getAttribute('data-cli-block-if-ccpa-optout'); 1475 if( cliBlocker.blockingStatus === true ) 1476 { 1477 if((CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes' && CLI.allowedCategories.indexOf(elmCategory) !== -1 ) || ( CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null && isBlock==='false') ) 1478 { 1479 if( cliBlocker.ccpaApplicable == true && blockIfCCPA === 'true' && ccpaOptedOut === true) { 1480 this.addPlaceholder(currentElm); 1481 } 1482 else { 1483 this.replaceSrc(currentElm); 1484 } 1485 } 1486 else 1487 { 1488 if( Cli_Data.ccpaType === 'ccpa' && blockIfCCPA !== 'true') 1489 { 1490 this.replaceSrc(currentElm); 1491 } 1492 else { 1493 this.addPlaceholder(currentElm); 1494 } 1495 1496 } 1497 1498 } 1499 else 1500 { 1501 if( cliBlocker.ccpaApplicable == true && blockIfCCPA === 'true' ) { 1502 if( ccpaOptedOut === true || CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null ) { 1503 this.addPlaceholder(currentElm); 1504 } else { 1505 this.replaceSrc(currentElm); 1506 } 1507 1508 } 1509 else { 1510 this.replaceSrc(currentElm); 1511 } 1512 } 1513 1514 } 1515 } 1516 1517 }, 1518 addPlaceholder:function(htmlElm) 1519 { 1520 if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length === 0) 1521 { 1522 var htmlElemName = htmlElm.getAttribute('data-cli-label'); 1523 var htmlElemType = htmlElm.getAttribute('data-cli-placeholder'); 1524 var htmlElemWidth = htmlElm.getAttribute('width'); 1525 var htmlElemHeight = htmlElm.getAttribute('height'); 1526 if(htmlElemWidth == null) 1527 { 1528 htmlElemWidth = htmlElm.offsetWidth; 1529 } 1530 if(htmlElemHeight == null) 1531 { 1532 htmlElemHeight = htmlElm.offsetHeight; 1533 } 1534 pixelPattern = /px/; 1535 htmlElemWidth = ((pixelPattern.test(htmlElemWidth)) ? htmlElemWidth : htmlElemWidth+'px'); 1536 htmlElemHeight = ((pixelPattern.test(htmlElemHeight)) ? htmlElemHeight : htmlElemHeight+'px'); 1537 var addPlaceholder = '<div style="width:'+htmlElemWidth+'; height:'+htmlElemHeight+';" class="wt-cli-iframe-placeholder"><div class="wt-cli-inner-text">'+htmlElemType+'</div></div>'; 1538 addPlaceholder.width = htmlElemWidth; 1539 addPlaceholder.height = htmlElemHeight; 1540 if(htmlElm.tagName !== 'IMG') 1541 { 1542 jQuery(addPlaceholder).insertBefore(htmlElm); 1543 } 1544 htmlElm.removeAttribute('src'); 1545 htmlElm.style.display = 'none'; 1546 } 1547 }, 1548 replaceSrc: function(htmlElm) 1549 { 1550 if(!htmlElm.hasAttribute('src')) 1551 { 1552 var htmlElemSrc = htmlElm.getAttribute('data-cli-src'); 1553 htmlElm.setAttribute('src',htmlElemSrc); 1554 if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length > 0) 1555 { 1556 jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').remove(); 1557 } 1558 htmlElm.style.display = 'block'; 1559 } 1560 } 1561 }; 1562 1563 genericFuncs.reviewConsent(); 1564 genericFuncs.renderByElement(cliBlocker.removeCookieByCategory); 1565 }, 1566 ccpaOptedOut: function () { 1567 var ccpaOptedOut = false;
1568 var preferenceCookie = CLI_Cookie.read(CLI_PREFERNCE_COOKIE); 1569 if( preferenceCookie !== null ) { 1570 if(CLI.isBase64(preferenceCookie)) 1571 { 1572 cliConsent = window.atob(preferenceCookie); 1573 } 1574 else 1575 { 1576 cliConsent = decodeURIComponent(preferenceCookie); 1577 } 1578 cliConsent = JSON.parse(cliConsent); 1579 if( typeof cliConsent.ccpaOptout !== 'undefined') { 1580 ccpaOptedOut = cliConsent.ccpaOptout; 1581 } 1582 } 1583 return ccpaOptedOut; 1584 } 1585} 1586jQuery(document).ready(function() { 1587 if(typeof cli_cookiebar_settings!='undefined') 1588 { 1589 CLI.set({ 1590 settings:cli_cookiebar_settings 1591 }); 1592 cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts); 1593 } 1594 else 1595 { 1596 var data = { 1597 action: 'cli_get_settings_json', 1598 }; 1599 jQuery.ajax({ 1600 url: Cli_Data.ajax_url, 1601 data: data, 1602 dataType: 'json', 1603 type: 'GET', 1604 success: function (response) { 1605 CLI.set({ 1606 settings:response 1607 }); 1608 cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts); 1609 } 1610 }); 1611 } 1612 1613});
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.