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