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