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 this.showPopupOverlay(); 928 } 929 CLI.BannerStatus('visible'); 930 }, 931 hideHeader:function() 932 { 933 if(this.settings.showagain_tab) 934 { 935 if(this.settings.notify_animate_show) 936 { 937 this.showagain_elm.slideDown(this.settings.animate_speed_show); 938 } else { 939 this.showagain_elm.show(); 940 } 941 }else 942 { 943 this.showagain_elm.hide(); 944 } 945 this.bar_elm.slideUp(this.settings.animate_speed_show); 946 this.hidePopupOverlay(); 947 CLI.BannerStatus('hidden'); 948 }, 949 hidePopupOverlay:function() 950 { 951 952 jQuery('body').removeClass("cli-barmodal-open"); 953 jQuery(".cli-popupbar-overlay").removeClass("cli-show"); 954 }, 955 showPopupOverlay:function() 956 { 957 if( this.bar_elm.length ) { 958 if(this.settings.popup_overlay) 959 { 960 961 if( ! ( this.main_link.hasClass('cli-minimize-bar') )) { 962 jQuery('body').addClass("cli-barmodal-open"); 963 jQuery(".cli-popupbar-overlay").addClass("cli-show"); 964 } 965 966 } 967 } 968 969 }, 970 barAsWidget:function(a) 971 { 972 var cli_elm=this.bar_elm; 973 cli_elm.attr('data-cli-type','widget'); 974 var cli_win=jQuery(window); 975 var cli_winh=cli_win.height()-40; 976 var cli_winw=cli_win.width(); 977 var cli_defw=cli_winw>465 ? 445 : cli_winw-60; 978 cli_elm.css({ 979 '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' 980 }); 981 if(this.settings.widget_position=='left') 982 { 983 cli_elm.css({ 984 'left':'30px','right':'auto','bottom':'30px','top':'auto' 985 }); 986 }else 987 { 988 cli_elm.css({ 989 'left':'auto','right':'30px','bottom':'30px','top':'auto' 990 }); 991 } 992 if(a) 993 { 994 this.setResize(); 995 } 996 }, 997 barAsPopUp:function(a) 998 { 999 if(typeof cookie_law_info_bar_as_popup==='function') 1000 { 1001 return false; 1002 } 1003 var cli_elm=this.bar_elm; 1004 cli_elm.attr('data-cli-type','popup'); 1005 var cli_win=jQuery(window); 1006 var cli_winh=cli_win.height(); 1007 var cli_defh = cli_winh > 500 ? 500 : cli_winh; 1008 var cli_winw=cli_win.width(); 1009 var cli_defw=cli_winw>700 ? 500 : cli_winw-20; 1010 //var cli_defw=cli_defw<500 ? 500 : cli_defw; 1011 cli_elm.css({ 1012 'width':cli_defw,'height':'auto','max-height':cli_defh,'bottom':'','top':'50%','left':'50%','transform':'translate(-50%, -50%)','overflow':'auto' 1013 }); 1014 if(a) 1015 { 1016 this.setResize(); 1017 } 1018 }, 1019 setResize:function() 1020 { 1021 var resizeTmr=null; 1022 jQuery(window).resize(function() { 1023 clearTimeout(resizeTmr); 1024 resizeTmr=setTimeout(function() 1025 { 1026 if(CLI_COOKIEBAR_AS_POPUP) 1027 { 1028 CLI.barAsPopUp(); 1029 } 1030 if(CLI.settings.cookie_bar_as=='widget') 1031 { 1032 CLI.barAsWidget(); 1033 } 1034 CLI.configShowAgain(); 1035 },500); 1036 }); 1037 }, 1038 isValidHex:function(color) { 1039 if(!color || typeof color !== 'string') return false; 1040 1041 // Validate hex values 1042 if(color.substring(0, 1) === '#') color = color.substring(1); 1043 1044 switch(color.length) { 1045 case 3: return /^[0-9A-F]{3}$/i.test(color); 1046 case 6: return /^[0-9A-F]{6}$/i.test(color); 1047 case 8: return /^[0-9A-F]{8}$/i.test(color); 1048 default: return false; 1049 } 1050 return false; 1051 }, 1052 ColorLuminance:function(hex, lum) { 1053 // validate hex string 1054 hex = String(hex).replace(/[^0-9a-f]/gi, ''); 1055 if (hex.length < 6) { 1056 hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; 1057 } 1058 lum = lum || 0; 1059 // convert to decimal and change luminosity 1060 var rgb = "#", c, i; 1061 for (i = 0; i < 3; i++) { 1062 c = parseInt(hex.substr(i*2,2), 16); 1063 c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); 1064 rgb += ("00"+c).substr(c.length); 1065 } 1066 return rgb; 1067 }, 1068 rgb2hex:function(rgb){ 1069 rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); 1070 return (rgb && rgb.length === 4) ? "#" + 1071 ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + 1072 ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + 1073 ("0" + parseInt(rgb[3],10).toString(16)).slice(-2) : ''; 1074 }, 1075 lightOrDark:function(color) { 1076 1077 // Variables for red, green, blue values 1078 var r, g, b, hsp; 1079 1080 // Check the format of the color, HEX or RGB? 1081 if (color.match(/^rgb/)) { 1082 1083 // If HEX --> store the red, green, blue values in separate variables 1084 color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/); 1085 1086 r = color[1]; 1087 g = color[2]; 1088 b = color[3]; 1089 } 1090 else { 1091 1092 // If RGB --> Convert it to HEX: http://gist.github.com/983661 1093 color = +("0x" + color.slice(1).replace( 1094 color.length < 5 && /./g, '$&$&')); 1095 1096 r = color >> 16; 1097 g = color >> 8 & 255; 1098 b = color & 255; 1099 } 1100 1101 // HSP (Highly Sensitive Poo) equation from http://alienryderflex.com/hsp.html 1102 hsp = Math.sqrt( 1103 0.299 * (r * r) + 1104 0.587 * (g * g) + 1105 0.114 * (b * b) 1106 ); 1107 1108 // Using the HSP value, determine whether the color is light or dark 1109 if (hsp>127.5) { 1110 1111 return 'light'; 1112 } 1113 else { 1114 1115 return 'dark'; 1116 } 1117 }, 1118 barPopupStyle:function() 1119 { 1120 var acceptBtn = jQuery('.cli_action_button[data-cli_action=accept]'); 1121 var primaryColor = this.settings.button_1_button_colour; 1122 var primaryLinkColor = this.settings.button_1_link_colour; 1123 var barColor = this.settings.background; 1124 var extractedStyle = ''; 1125 var primaryBtnStyle = this.settings.button_1_style; 1126 Object.keys(primaryBtnStyle).forEach(function(element) { 1127 extractedStyle+=primaryBtnStyle[element][0]+':'+primaryBtnStyle[element][1]+';'; 1128 }); 1129 var shadeColor; 1130 if(!CLI.isValidHex(barColor)) 1131 { 1132 barColor=CLI.rgb2hex(barColor); 1133 } 1134 if(barColor=="#000000") 1135 { 1136 shadeColor='#191919'; 1137 } 1138 else 1139 { 1140 var intensity=CLI.lightOrDark(barColor); 1141 if(intensity=='light') 1142 { 1143 shadeColor = CLI.ColorLuminance(barColor, -0.05); 1144 } 1145 else 1146 {
1147 shadeColor = CLI.ColorLuminance(barColor, 0.4); 1148 } 1149 } 1150 jQuery("<style>") 1151 .prop("type", "text/css") 1152 .html("\ 1153 #cookie-law-info-bar .cli-switch input:checked + .cli-slider{\ 1154 background-color: "+primaryColor+";\ 1155 }\ 1156 #cookie-law-info-bar .cli-tab-header{\ 1157 background-color: "+shadeColor+"\ 1158 }\ 1159 #cookie-law-info-bar .cli-switch .cli-slider:before{\ 1160 background-color: "+barColor+";\ 1161 }\ 1162 #cookie-law-info-bar .cli-tab-footer .cli-btn{\ 1163 background-color:"+primaryColor+";"+extractedStyle+"\ 1164 }\ 1165 ").appendTo("head"); 1166 1167 }, 1168 enableAllCookies:function() 1169 { 1170 1171 jQuery('.cli-user-preference-checkbox').each(function(){ 1172 var cli_chkbox_elm=jQuery(this); 1173 var cli_chkbox_data_id=cli_chkbox_elm.attr('data-id'); 1174 if(cli_chkbox_data_id!='checkbox-necessary') 1175 { 1176 cli_chkbox_elm.prop('checked',true); 1177 CLI_Cookie.set('cookielawinfo-'+cli_chkbox_data_id,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 1178 } 1179 }); 1180 }, 1181 disableAllCookies:function() 1182 { 1183 jQuery('.cli-user-preference-checkbox').each(function(){ 1184 1185 var cli_chkbox_elm=jQuery(this); 1186 var cli_chkbox_data_id=cli_chkbox_elm.attr('data-id'); 1187 cliCategorySlug = cli_chkbox_data_id.replace('checkbox-',''); 1188 if(Cli_Data.strictlyEnabled.indexOf(cliCategorySlug) === -1) 1189 { 1190 cli_chkbox_elm.prop('checked',false); 1191 CLI_Cookie.set('cookielawinfo-'+cli_chkbox_data_id,'no',CLI_ACCEPT_COOKIE_EXPIRE); 1192 } 1193 }); 1194 }, 1195 privacyReadmore:function() 1196 { 1197 var originalHtml = ''; 1198 1199 Trunc = { 1200 addReadmore:function(textBlock) 1201 { 1202 if(textBlock.html().length > Cli_Data.privacy_length) 1203 { 1204 jQuery('.cli-privacy-readmore').show(); 1205 } 1206 else 1207 { 1208 jQuery('.cli-privacy-readmore').hide(); 1209 } 1210 }, 1211 truncateText : function( textBlock ) { 1212 var strippedText = jQuery('<div />').html(textBlock.html()); 1213 strippedText.find('table').remove(); 1214 textBlock.html(strippedText.html()); 1215 currentText = textBlock.text(); 1216 if(currentText.trim().length > Cli_Data.privacy_length){ 1217 var newStr = currentText.substring(0, Cli_Data.privacy_length); 1218 textBlock.empty().html(newStr).append('...'); 1219 } 1220 }, 1221 replaceText: function ( textBlock, original ){ 1222 return textBlock.html(original); 1223 } 1224 }; 1225 1226 jQuery('.cli-privacy-content .cli-privacy-content-text').each(function () { 1227 var el = jQuery(this); 1228 var clone = el.clone(); 1229 originalHtml = clone.html(); 1230 Trunc.addReadmore(el); 1231 Trunc.truncateText(el); 1232 }); 1233 1234 jQuery(document).on('click keypress','a.cli-privacy-readmore',function(e){ 1235 var key = e.which; 1236 e.preventDefault(); 1237 if (key === 1 || key === 13) { 1238 1239 var currentElement = jQuery(this); 1240 var privacyElement = currentElement.closest('.cli-privacy-overview'); 1241 var privacyContent = privacyElement.find('.cli-privacy-content-text'); 1242 1243 if ( privacyElement.hasClass('cli-collapsed') ) { 1244 Trunc.truncateText(privacyContent); 1245 privacyElement.removeClass('cli-collapsed'); 1246 privacyContent.css('height', '100%'); 1247 } 1248 else { 1249 privacyElement.addClass('cli-collapsed'); 1250 Trunc.replaceText(privacyContent, originalHtml); 1251 } 1252 } 1253 }); 1254 }, 1255 checkCategories:function() 1256 { 1257 var cliAllowedCategories = []; 1258 var cli_categories = {}; 1259 jQuery('.cli-user-preference-checkbox').each(function() 1260 { var status=false; 1261 cli_chkbox_elm=jQuery(this); 1262 cli_chkbox_data_id=cli_chkbox_elm.attr('data-id'); 1263 cli_chkbox_data_id=cli_chkbox_data_id.replace('checkbox-',''); 1264 //cli_chkbox_data_id_trimmed=cli_chkbox_data_id.replace('-','_') 1265 if(jQuery(cli_chkbox_elm).is(':checked')) 1266 { 1267 status=true; 1268 cliAllowedCategories.push(cli_chkbox_data_id); 1269 } 1270 1271 cli_categories[cli_chkbox_data_id]= status; 1272 }); 1273 CLI.allowedCategories = cliAllowedCategories; 1274 CLI.consent=cli_categories; 1275 },
1276 cookieLawInfoRunCallBacks:function() 1277 { 1278 this.checkCategories(); 1279 if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes') 1280 { 1281 if("function" == typeof CookieLawInfo_Accept_Callback){ 1282 CookieLawInfo_Accept_Callback(); 1283 } 1284 } 1285 }, 1286 addStyleAttribute:function() 1287 { 1288 var bar=this.bar_elm; 1289 var styleClass=''; 1290 if(jQuery(bar).find('.cli-bar-container').length > 0) 1291 { 1292 styleClass=jQuery('.cli-bar-container').attr('class'); 1293 styleClass=jQuery.trim(styleClass.replace('cli-bar-container','')); 1294 jQuery(bar).attr('data-cli-style',styleClass); 1295 } 1296 }, 1297 getParameterByName: function( name, url ) { 1298 if (!url) url = window.location.href; 1299 name = name.replace(/[\[\]]/g, '\\$&'); 1300 var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), 1301 results = regex.exec(url); 1302 if (!results) return null; 1303 if (!results[2]) return ''; 1304 return decodeURIComponent(results[2].replace(/\+/g, ' ')); 1305 }, 1306 acceptPageNavigation: function() { 1307 if( Boolean( this.settings.accept_close_page_navigation ) === true && !CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)) { 1308 jQuery(document).on('click','a', function () { 1309 var href = jQuery(this).attr('href'); 1310 if( href !== undefined ) { 1311 CLI.close_header(); 1312 } 1313 }); 1314 } 1315 }, 1316 refocusElement: function() { 1317 if( this.banner_heading.length > 0 ) { 1318 this.banner_heading.focus(); 1319 } else { 1320 this.bar_elm.find('a').first().focus(); 1321 } 1322 }, 1323 mayBeSetPreferenceCookie: function() { 1324 if( CLI.getParameterByName('cli_bypass') === "1" ) { 1325 CLI.generateConsent(); 1326 } 1327 }, 1328 AfterConsent: function( status) { 1329 const consentCategories = { accepted: [], rejected: [] }; 1330 document.querySelectorAll(".cli-user-preference-checkbox").forEach(function (item) { 1331 if( !item ) return; 1332 const category = item.getAttribute("data-id").replace("checkbox-", ""); 1333 if(item.checked) consentCategories.accepted.push(category) 1334 else consentCategories.rejected.push(category) 1335 }); 1336 1337 const consentUpdate = new CustomEvent('cli_consent_update', { 1338 detail: { 1339 status: status, 1340 categories: consentCategories 1341 }, 1342 }); 1343 document.dispatchEvent(consentUpdate); 1344 }, 1345 ConsentAction: function( choice = 'accept') { 1346 if( choice === 'accept') { 1347 CLI.enableAllCookies(); 1348 } 1349 if( choice != 'reject' ) { 1350 CLI.accept_close(); 1351 } else { 1352 CLI.reject_close(); 1353 } 1354 CLI.saveLog(choice); 1355 CLI.settingsPopUpClose(); 1356 CLI.AfterConsent(choice); 1357 }, 1358 TogglePreference: function(slide = false ) { 1359 if( slide == true ) { 1360 jQuery('#cookie-law-info-bar .cli-tab-container').slideToggle(CLI.settings.animate_speed_show); 1361 } else { 1362 jQuery('#cliSettingsPopup').addClass("cli-show").css({'opacity':0}).animate({'opacity':1}); 1363 jQuery('#cliSettingsPopup').removeClass('cli-blowup cli-out').addClass("cli-blowup"); 1364 jQuery('#cliSettingsPopup').attr('aria-hidden', false); 1365 jQuery('body').addClass("cli-modal-open"); 1366 jQuery(".cli-settings-overlay").addClass("cli-show"); 1367 jQuery("#cookie-law-info-bar").css({'opacity':.1}); 1368 jQuery("#cliModalClose").focus(); 1369 if(!jQuery('.cli-settings-mobile').is(':visible')) 1370 { 1371 jQuery('#cliSettingsPopup').find('.cli-nav-link:eq(0)').click(); 1372 } 1373 } 1374 }, 1375 MaybeClosePreference: function( element ) { 1376 if (element.parent().hasClass('cli-preference-btn-wrapper')) { 1377 CLI.settingsPopUpClose(); 1378 } 1379 }, 1380 async BannerStatus(status = 'visible') { 1381 if (CLI.ref && typeof CLI.ref._cliIABStatusUpdate === 'function') { 1382 if (status == 'visible') { 1383 CLI.ref._cliIABStatusUpdate(true, true); 1384 } 1385 else if (status == 'revisit') { 1386 CLI.ref._cliIABStatusUpdate(true); 1387 } 1388 else { 1389 CLI.ref._cliIABStatusUpdate(false); 1390 } 1391 } 1392 } 1393} 1394var cliBlocker = 1395{ 1396 blockingStatus: true, 1397 geoIP: false, 1398 scriptsLoaded: false, 1399 ccpaEnabled : false, 1400 ccpaRegionBased : false, 1401 ccpaApplicable : false, 1402 ccpaBarEnabled: false, 1403 cliShowBar: true , 1404 isBypassEnabled: CLI.getParameterByName('cli_bypass'), 1405 checkPluginStatus:function(callbackA , callbackB ) 1406 { 1407 1408 cliBlocker.ccpaEnabled = Boolean( Cli_Data.ccpaEnabled );
1409 cliBlocker.ccpaRegionBased = Boolean( Cli_Data.ccpaRegionBased ); 1410 cliBlocker.ccpaBarEnabled = Boolean( Cli_Data.ccpaBarEnabled ); 1411 if( cliBlocker.ccpaEnabled === true ) { 1412 cliBlocker.ccpaApplicable = true; 1413 if( Cli_Data.ccpaType === 'ccpa') { 1414 cliBlocker.blockingStatus = false; 1415 cliBlocker.cliShowBar = false; 1416 if( cliBlocker.ccpaBarEnabled === true ) { 1417 cliBlocker.cliShowBar = true; 1418 cliBlocker.blockingStatus = true; 1419 } 1420 } 1421 } 1422 1423 if(Cli_Data.geoIP === 'enabled' || (cliBlocker.ccpaEnabled === true && cliBlocker.ccpaRegionBased === true ) ) 1424 { 1425 if( Boolean( Cli_Data.use_custom_geolocation_api ) === true ) { 1426 1427 cliBlocker.tryCustomGeoLocationService( callbackA, callbackB ); 1428 1429 } else { 1430 jQuery.getJSON('https://ipapi.co/json/', function(data) 1431 { 1432 cliBlocker.geolocationHandler( data, callbackA, callbackB ); 1433 1434 }).fail(function() { 1435 1436 cliBlocker.tryCustomGeoLocationService( callbackA, callbackB ); 1437 1438 }); 1439 } 1440 1441 } else { 1442 if ( cliBlocker.isBypassEnabled === "1") { 1443 cliBlocker.blockingStatus = false; 1444 } 1445 callbackA(); 1446 callbackB(); 1447 } 1448 1449 }, 1450 tryCustomGeoLocationService: function( callbackA, callbackB ) { 1451 jQuery.getJSON(Cli_Data.custom_geolocation_api, function(data) { 1452 cliBlocker.geolocationHandler( data, callbackA, callbackB ); 1453 }); 1454 }, 1455 geolocationHandler:function( data, callbackA, callbackB ){ 1456 var euCountries = Cli_Data.eu_countries; 1457 if( (data.in_eu === false ) && (euCountries.indexOf(data.country) === -1)) 1458 { 1459 if( Cli_Data.geoIP === 'enabled' ) { 1460 cliBlocker.blockingStatus = false; 1461 cliBlocker.cliShowBar = false; 1462 } 1463 else { 1464 if( Cli_Data.ccpaType !== 'ccpa' ) { 1465 cliBlocker.blockingStatus = true; 1466 cliBlocker.cliShowBar = true; 1467 } 1468 } 1469 } 1470 else 1471 { 1472 jQuery('body').addClass('wt-cli-geoip-on wt-cli-eu-country'); 1473 } 1474 if( cliBlocker.ccpaEnabled === true ) { 1475 if( cliBlocker.ccpaRegionBased === true && data.region_code !== 'CA' ) { 1476 cliBlocker.ccpaApplicable = false; 1477 if( Cli_Data.ccpaType === 'ccpa') { 1478 cliBlocker.cliShowBar = false; 1479 cliBlocker.blockingStatus = false; 1480 } 1481 jQuery('.wt-cli-ccpa-opt-out,.wt-cli-ccpa-checkbox,.wt-cli-ccpa-element').remove(); 1482 } 1483 else { 1484 cliBlocker.ccpaApplicable = true; 1485 if( cliBlocker.ccpaBarEnabled === true ) { 1486 cliBlocker.cliShowBar = true; 1487 } 1488 } 1489 1490 } 1491 if( cliBlocker.blockingStatus === false ) { 1492 1493 if("function" == typeof CookieLawInfo_Accept_Callback){ 1494 CookieLawInfo_Accept_Callback(); 1495 } 1496 jQuery('body').addClass('wt-cli-geoip-on wt-cli-non-eu-country'); 1497 CLI.hidePopupOverlay(); 1498 if( cliBlocker.ccpaApplicable !== true ) { 1499 cliBlocker.removeAllPreferenceCookies(); 1500 jQuery('.wt-cli-geoip-on.wt-cli-non-eu-country').find('.wt-cli-element').remove(); 1501 1502 } 1503 } 1504 callbackA(); 1505 callbackB(); 1506 }, 1507 cookieBar: function() 1508 { 1509 if( cliBlocker.cliShowBar === false ) 1510 { 1511 jQuery('.wt-cli-cookie-bar-container').remove(); 1512 CLI.BannerStatus('hidden'); 1513 } 1514 else 1515 { 1516 jQuery('.wt-cli-cookie-bar-container').show(); 1517 if(!CLI_Cookie.exists(CLI_ACCEPT_COOKIE_NAME)) 1518 { 1519 CLI.displayHeader(); 1520 1521 } 1522 else 1523 { 1524 CLI.hideHeader(); 1525 } 1526 } 1527 }, 1528 removeAllPreferenceCookies : function() 1529 { 1530 cliPreferenceCookies = Cli_Data.cookielist; 1531 for (var key in cliPreferenceCookies ) { 1532 CLI_Cookie.erase('cookielawinfo-checkbox-'+key); 1533 } 1534 }, 1535 removeCookieByCategory : function() 1536 { 1537 1538 if(cliBlocker.blockingStatus === true) 1539 { 1540 if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) !== null) 1541 { 1542 var non_necessary_cookies = Cli_Data.non_necessary_cookies; 1543 for (var key in non_necessary_cookies) { 1544 currentCategory = key; 1545 if(CLI.allowedCategories.indexOf(currentCategory) === -1) 1546 {
1547 var nonNecessaryCookies = non_necessary_cookies[currentCategory]; 1548 for(var i=0; i < nonNecessaryCookies.length; i++) 1549 { 1550 if(CLI_Cookie.read(nonNecessaryCookies[i]) !== null) 1551 { 1552 CLI_Cookie.erase(nonNecessaryCookies[i]); 1553 } 1554 1555 } 1556 } 1557 } 1558 } 1559 } 1560 }, 1561 runScripts:function() 1562 { 1563 srcReplaceableElms = ['iframe','IFRAME','EMBED','embed','OBJECT','object','IMG','img','SOURCE','source']; 1564 var genericFuncs = 1565 { 1566 1567 renderByElement: function(callback) 1568 { 1569 cliScriptFuncs.renderScripts(); 1570 cliHtmlElmFuncs.renderSrcElement(); 1571 callback(); 1572 cliBlocker.scriptsLoaded = true; 1573 }, 1574 reviewConsent : function() 1575 { 1576 jQuery(document).on('click','.cli_manage_current_consent,.wt-cli-manage-consent-link',function(){ 1577 CLI.bar_elm.slideDown(CLI.settings.animate_speed_show); 1578 }); 1579 } 1580 1581 }; 1582 var cliScriptFuncs = 1583 { 1584 // trigger DOMContentLoaded 1585 scriptsDone:function() 1586 { 1587 if( Boolean( Cli_Data.triggerDomRefresh ) === true ) 1588 { 1589 var DOMContentLoadedEvent = document.createEvent('Event') 1590 DOMContentLoadedEvent.initEvent('DOMContentLoaded', true, true) 1591 window.document.dispatchEvent(DOMContentLoadedEvent) 1592 } 1593 }, 1594 seq :function(arr, callback, index) { 1595 // first call, without an index 1596 if (typeof index === 'undefined') { 1597 index = 0 1598 } 1599 1600 arr[index](function () { 1601 index++ 1602 if (index === arr.length) { 1603 callback() 1604 } else { 1605 cliScriptFuncs.seq(arr, callback, index) 1606 } 1607 }) 1608 }, 1609 /* script runner */ 1610 insertScript:function($script,callback) { 1611 1612 var s =''; 1613 var allowedAttributes = [ 1614 'data-cli-class', 1615 'data-cli-label', 1616 'data-cli-placeholder', 1617 'data-cli-script-type', 1618 'data-cli-src' 1619 ]; 1620 var scriptType = $script.getAttribute('data-cli-script-type'); 1621 var elementPosition = $script.getAttribute('data-cli-element-position'); 1622 var isBlock = $script.getAttribute('data-cli-block'); 1623 var blockIfCCPA = $script.getAttribute('data-cli-block-if-ccpa-optout'); 1624 var s = document.createElement('script'); 1625 var ccpaOptedOut = cliBlocker.ccpaOptedOut(); 1626 s.type = 'text/plain'; 1627 if($script.async) 1628 { 1629 s.async = $script.async; 1630 } 1631 if($script.defer) 1632 { 1633 s.defer = $script.defer; 1634 } 1635 if ($script.src) { 1636 s.onload = callback 1637 s.onerror = callback 1638 s.src = $script.src 1639 } else { 1640 s.textContent = $script.innerText 1641 } 1642 if( $script.hasAttribute('data-cli-id') ) { 1643 s.id = $script.getAttribute('data-cli-id'); 1644 } 1645 var attrs = jQuery($script).prop("attributes"); 1646 for (var ii = 0; ii < attrs.length; ++ii) { 1647 if (attrs[ii].nodeName === 'id' && s.id) 1648 continue; 1649 s.setAttribute(attrs[ii].nodeName,attrs[ii].value); 1650 } 1651 1652 if(cliBlocker.blockingStatus === true) 1653 { 1654 1655 if(( CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes' && CLI.allowedCategories.indexOf(scriptType) !== -1 ) || ( CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null && isBlock==='false') ) 1656 { 1657 s.setAttribute('data-cli-consent','accepted'); 1658 s.type = 'text/javascript'; 1659 1660 } 1661 if( Cli_Data.ccpaType === 'ccpa' && blockIfCCPA !== 'true') 1662 { 1663 s.type = 'text/javascript'; 1664 } 1665 } 1666 else 1667 { 1668 s.type = 'text/javascript'; 1669 } 1670 if( cliBlocker.ccpaApplicable === true && blockIfCCPA === 'true' ) { 1671 if( ccpaOptedOut === true || CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null ) { 1672 s.type = 'text/plain'; 1673 } 1674 } 1675 1676 if($script && $script.type != s.type && $script.parentNode) 1677 { 1678 $script.parentNode.insertBefore(s,$script); 1679 if (!$script.src) 1680 { 1681 callback() 1682 } 1683 $script.parentNode.removeChild($script); 1684 } 1685 else { 1686 callback(); 1687 } 1688 }, 1689 renderScripts:function() 1690 { 1691 var $scripts = document.querySelectorAll('script[data-cli-class="cli-blocker-script"]'); 1692 if($scripts.length > 0) 1693 { 1694 var runList = [] 1695 var typeAttr 1696 Array.prototype.forEach.call($scripts, function ($script) { 1697 1698 // only run script tags without the type attribute 1699 // or with a javascript mime attribute value 1700 typeAttr = $script.getAttribute('type') 1701 var elmType = $script.tagName; 1702 runList.push(function (callback) { 1703 cliScriptFuncs.insertScript($script, callback) 1704 }) 1705 }) 1706 cliScriptFuncs.seq(runList, cliScriptFuncs.scriptsDone); 1707 } 1708 } 1709 }; 1710 var cliHtmlElmFuncs = { 1711 renderSrcElement: function() 1712 { 1713 var blockingElms = document.querySelectorAll('[data-cli-class="cli-blocker-script"]'); 1714 var ccpaOptedOut = cliBlocker.ccpaOptedOut(); 1715 for (var i = 0; i < blockingElms.length; i++) 1716 { 1717 var currentElm = blockingElms[i]; 1718 var elmType = currentElm.tagName; 1719 if(srcReplaceableElms.indexOf(elmType) !== -1) 1720 { 1721 var elmCategory = currentElm.getAttribute('data-cli-script-type'); 1722 var isBlock = currentElm.getAttribute('data-cli-block'); 1723 var blockIfCCPA = currentElm.getAttribute('data-cli-block-if-ccpa-optout'); 1724 if( cliBlocker.blockingStatus === true ) 1725 { 1726 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) 1727 { 1728 if( cliBlocker.ccpaApplicable == true && blockIfCCPA === 'true' && ccpaOptedOut === true) { 1729 this.addPlaceholder(currentElm); 1730 } 1731 else { 1732 this.replaceSrc(currentElm); 1733 } 1734 } 1735 else 1736 { 1737 if( Cli_Data.ccpaType === 'ccpa' && blockIfCCPA !== 'true') 1738 { 1739 this.replaceSrc(currentElm); 1740 } 1741 else { 1742 this.addPlaceholder(currentElm); 1743 } 1744 1745 } 1746 1747 } 1748 else 1749 { 1750 if( cliBlocker.ccpaApplicable == true && blockIfCCPA === 'true' ) { 1751 if( ccpaOptedOut === true || CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null ) { 1752 this.addPlaceholder(currentElm); 1753 } else { 1754 this.replaceSrc(currentElm); 1755 } 1756 1757 } 1758 else { 1759 this.replaceSrc(currentElm); 1760 } 1761 } 1762 1763 } 1764 } 1765 1766 }, 1767 addPlaceholder:function(htmlElm) 1768 { 1769 if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length === 0) 1770 { 1771 var htmlElemName = htmlElm.getAttribute('data-cli-label'); 1772 var htmlElemType = htmlElm.getAttribute('data-cli-placeholder'); 1773 var htmlElemWidth = htmlElm.getAttribute('width'); 1774 var htmlElemHeight = htmlElm.getAttribute('height'); 1775 if(htmlElemWidth == null) 1776 { 1777 htmlElemWidth = htmlElm.offsetWidth; 1778 } 1779 if(htmlElemHeight == null) 1780 { 1781 htmlElemHeight = htmlElm.offsetHeight; 1782 } 1783 pixelPattern = /px/; 1784 htmlElemWidth = ((pixelPattern.test(htmlElemWidth)) ? htmlElemWidth : htmlElemWidth+'px'); 1785 htmlElemHeight = ((pixelPattern.test(htmlElemHeight)) ? htmlElemHeight : htmlElemHeight+'px'); 1786 var addPlaceholder = '<div style="width:'+htmlElemWidth+'; height:'+htmlElemHeight+';" class="wt-cli-iframe-placeholder"><div class="wt-cli-inner-text">'+htmlElemType+'</div></div>'; 1787 addPlaceholder.width = htmlElemWidth; 1788 addPlaceholder.height = htmlElemHeight; 1789 if(htmlElm.tagName !== 'IMG') 1790 { 1791 jQuery(addPlaceholder).insertBefore(htmlElm); 1792 } 1793 htmlElm.removeAttribute('src'); 1794 htmlElm.style.display = 'none'; 1795 } 1796 }, 1797 replaceSrc: function(htmlElm) 1798 { 1799 if(!htmlElm.hasAttribute('src')) 1800 { 1801 var htmlElemSrc = htmlElm.getAttribute('data-cli-src'); 1802 htmlElm.setAttribute('src',htmlElemSrc); 1803 if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length > 0) 1804 { 1805 jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').remove(); 1806 } 1807 htmlElm.style.display = 'block'; 1808 } 1809 } 1810 }; 1811 1812 genericFuncs.reviewConsent(); 1813 genericFuncs.renderByElement(cliBlocker.removeCookieByCategory); 1814 }, 1815 ccpaOptedOut: function () { 1816 var ccpaOptedOut = false;
1817 var preferenceCookie = CLI_Cookie.read(CLI_PREFERNCE_COOKIE); 1818 if( preferenceCookie !== null ) { 1819 if(CLI.isBase64(preferenceCookie)) 1820 { 1821 cliConsent = window.atob(preferenceCookie); 1822 } 1823 else 1824 { 1825 cliConsent = decodeURIComponent(preferenceCookie); 1826 } 1827 cliConsent = JSON.parse(cliConsent); 1828 if( typeof cliConsent.ccpaOptout !== 'undefined') { 1829 ccpaOptedOut = cliConsent.ccpaOptout; 1830 } 1831 } 1832 return ccpaOptedOut; 1833 } 1834} 1835jQuery(document).ready(function() { 1836 if(typeof cli_cookiebar_settings!='undefined') 1837 { 1838 CLI.set({ 1839 settings:cli_cookiebar_settings 1840 }); 1841 cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts); 1842 } 1843 else 1844 { 1845 var data = { 1846 action: 'cli_get_settings_json', 1847 }; 1848 jQuery.ajax({ 1849 url: Cli_Data.ajax_url, 1850 data: data, 1851 dataType: 'json', 1852 type: 'GET', 1853 success: function (response) { 1854 CLI.set({ 1855 settings:response 1856 }); 1857 cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts); 1858 } 1859 }); 1860 } 1861});
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.