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