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 domain = ( Cli_Data.cookieDomain !== '' ? ";domain=" + Cli_Data.cookieDomain : '' ); 8 var date = new Date(); 9 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 10 var expires = ";expires=" + date.toGMTString(); 11 if( days < 1 ){ 12 this.eraseCookie(name,expires); 13 } else { 14 document.cookie = name + "=" + value + expires + domain + ";path=/"; 15 } 16 }, 17 read: function (name) { 18 var nameEQ = name + "="; 19 var ca = document.cookie.split(';'); 20 for (var i = 0; i < ca.length; i++) { 21 var c = ca[i]; 22 while (c.charAt(0) == ' ') { 23 c = c.substring(1, c.length); 24 } 25 if (c.indexOf(nameEQ) === 0) { 26 return c.substring(nameEQ.length, c.length); 27 } 28 } 29 return null; 30 }, 31 erase: function (name) { 32 this.set(name, "", -10); 33 }, 34 eraseCookie: function( name, expires, index ){ 35 36 if( this.cookieExist(name) === false ) { 37 return false; 38 } 39 var _hostname = window.location.hostname; 40 var value = ""; 41 if (typeof index === 'undefined') { 42 index = 0; 43 } 44 if( index === 0 ){ 45 _hostname = _hostname.substring(_hostname.lastIndexOf(".", _hostname.lastIndexOf(".")-1)); 46 } 47 else if( index === 1 ){ 48 _hostname = ( Cli_Data.cookieDomain !== '' ? Cli_Data.cookieDomain : '' ); 49 } 50 else if( index === 2 ) { 51 if(_hostname.indexOf("www") != 1) 52 { 53 _hostname = _hostname.replace('www',''); 54 } 55 } 56 index = index + 1; 57 document.cookie = name + "=" + value + expires + ";domain="+ _hostname + ";path=/"; 58 if (index <= 2 ) { 59 this.eraseCookie( name, expires, index); 60 } 61 }, 62 exists: function (name) { 63 return (this.read(name) !== null); 64 }, 65 getallcookies:function() 66 { 67 var pairs = document.cookie.split(";"); 68 var cookieslist = {}; 69 for (var i = 0; i < pairs.length; i++) { 70 var pair = pairs[i].split("="); 71 cookieslist[(pair[0] + '').trim()] = unescape(pair[1]); 72 } 73 return cookieslist; 74 }, 75 cookieExist: function( name ){ 76 cookie_pattern = new RegExp("^(.*;)?\\s*"+name+"\\s*=\\s*[^;]+(.*)?$"); 77 if(!document.cookie.match(cookie_pattern)) { 78 return false; 79 } 80 return true; 81 } 82} 83var CLI= 84{ 85 bar_config:{}, 86 consent:{}, 87 allowedCategories:[], 88 showagain_config:{}, 89 set:function(args) 90 { 91 if(typeof JSON.parse !== "function") 92 { 93 console.log("CookieLawInfo requires JSON.parse but your browser doesn't support it"); 94 return; 95 } 96 if(typeof args.settings!=='object') 97 { 98 this.settings = JSON.parse(args.settings); 99 }else 100 { 101 this.settings = args.settings; 102 } 103 this.bar_elm=jQuery(this.settings.notify_div_id); 104 this.showagain_elm = jQuery(this.settings.showagain_div_id); 105 this.banner_heading = jQuery('#wt-cli-cookie-banner-title'); 106 107 //buttons 108 this.main_button = jQuery('.cli-plugin-main-button'); 109 this.main_link = jQuery('.cli-plugin-main-link'); 110 this.reject_link = jQuery('.cookie_action_close_header_reject'); 111 this.settings_link = jQuery('.cli_settings_button'); 112 this.delete_link=jQuery(".cookielawinfo-cookie-delete"); 113 this.accept_all_button = jQuery('.wt-cli-accept-all-btn'); 114 if(this.settings.cookie_bar_as=='popup') 115 { 116 CLI_COOKIEBAR_AS_POPUP=true; 117 } 118 this.cliRenewConsent(); 119 this.configBar(); 120 this.toggleBar(); 121 this.attachDelete(); 122 this.attachEvents(); 123 this.configButtons(); 124 this.addStyleAttribute(); 125 this.settingsPopUp(); 126 this.cookieLawInfoRunCallBacks(); 127 this.acceptPageNavigation(); 128 var cli_hidebar_on_readmore=this.hideBarInReadMoreLink(); 129 if(this.settings.scroll_close===true && cli_hidebar_on_readmore===false) 130 { 131 window.addEventListener("scroll",CLI.closeOnScroll, false); 132 } 133 }, 134 hideBarInReadMoreLink:function() 135 { 136 if(CLI.settings.button_2_hidebar===true && this.main_link.length>0 && this.main_link.hasClass('cli-minimize-bar')) 137 { 138 jQuery('.wt-cli-cookie-bar-container').addClass('wt-cli-hide-bar'); 139 this.hideHeader(); 140 this.showagain_elm.slideDown(this.settings.animate_speed_show); 141 return true; 142 } 143 return false;
144 }, 145 settingsPopUp:function() 146 { 147 jQuery(document).on('click keypress','.cli_settings_button',function(e){ 148 var key = e.which; 149 e.preventDefault(); 150 if(key === 1 || key === 13) { 151 if(CLI.settings.cookie_setting_popup==true) 152 { 153 jQuery('#cliSettingsPopup').addClass("cli-show").css({'opacity':0}).animate({'opacity':1}); 154 jQuery('#cliSettingsPopup').removeClass('cli-blowup cli-out').addClass("cli-blowup"); 155 jQuery('#cliSettingsPopup').attr('aria-hidden', false); 156 jQuery('body').addClass("cli-modal-open"); 157 jQuery(".cli-settings-overlay").addClass("cli-show"); 158 jQuery("#cookie-law-info-bar").css({'opacity':.1}); 159 jQuery("#cliModalClose").focus(); 160 if(!jQuery('.cli-settings-mobile').is(':visible')) 161 { 162 jQuery('#cliSettingsPopup').find('.cli-nav-link:eq(0)').click(); 163 } 164 } 165 else 166 { 167 jQuery('#cookie-law-info-bar .cli-tab-container').slideToggle(CLI.settings.animate_speed_show); 168 } 169 } 170 171 }); 172 jQuery('#cliModalClose').click(function(){ 173 CLI.settingsPopUpClose(); 174 }); 175 jQuery('#cliModalClose').keydown(function(e) { 176 var key = e.which 177 if(key === 9) { 178 if(e.shiftKey === true) { 179 e.preventDefault() 180 jQuery('#wt-cli-privacy-save-btn').focus() 181 } 182 } 183 }); 184 document.addEventListener('keydown', function(e) { 185 var key = e.which; 186 if(key === 27 && jQuery('#cliSettingsPopup').hasClass('cli-show')) { 187 CLI.settingsPopUpClose(); 188 } 189 }); 190 jQuery("#cliSettingsPopup").click(function(e){ 191 if(!(document.getElementsByClassName('cli-modal-dialog')[0].contains(e.target))) 192 { 193 CLI.settingsPopUpClose(); 194 } 195 }); 196 jQuery('.cli_enable_all_btn').click(function(){ 197 var cli_toggle_btn = jQuery(this); 198 var enable_text = cli_toggle_btn.attr('data-enable-text'); 199 var disable_text= cli_toggle_btn.attr('data-disable-text'); 200 if(cli_toggle_btn.hasClass('cli-enabled')){ 201 CLI.disableAllCookies(); 202 cli_toggle_btn.html(enable_text); 203 } 204 else 205 { 206 CLI.enableAllCookies(); 207 cli_toggle_btn.html(disable_text); 208 209 } 210 jQuery(this).toggleClass('cli-enabled'); 211 }); 212 this.settingsTabbedAccordion(); 213 this.toggleUserPreferenceCheckBox(); 214 this.privacyReadmore(); 215 }, 216 settingsTabbedAccordion:function() 217 { 218 jQuery(document).on('click keypress','.cli-tab-header',function(e){ 219 if (!(jQuery(e.target).hasClass('cli-slider') || jQuery(e.target).hasClass('cli-user-preference-checkbox'))) { 220 var key = e.which; 221 e.preventDefault(); 222 if (key === 1 || key === 13) { 223 var currentElement = jQuery(this); 224 var tabLink = currentElement.closest('.cli-tab-header').find('.cli-nav-link'); 225 if (currentElement.hasClass("cli-tab-active")) { 226 currentElement.removeClass("cli-tab-active"); 227 currentElement.siblings(".cli-tab-content").slideUp(200); 228 tabLink.attr('aria-expanded', false); 229 } else { 230 jQuery(".cli-tab-header").removeClass("cli-tab-active"); 231 currentElement.addClass("cli-tab-active"); 232 jQuery(".cli-tab-content").slideUp(200); 233 currentElement.siblings(".cli-tab-content").slideDown(200); 234 tabLink.attr('aria-expanded', true); 235 } 236 } 237 } 238 }); 239 }, 240 settingsPopUpClose:function() 241 { 242 jQuery('#cliSettingsPopup').removeClass('cli-show'); 243 jQuery('#cliSettingsPopup').addClass('cli-out'); 244 jQuery('#cliSettingsPopup').attr('aria-hidden', true); 245 jQuery('body').removeClass("cli-modal-open"); 246 jQuery(".cli-settings-overlay").removeClass("cli-show"); 247 jQuery("#cookie-law-info-bar").css({'opacity':1}); 248 jQuery(".cli_settings_button").focus(); 249 }, 250 toggleUserPreferenceCheckBox:function() 251 { 252 253 jQuery('.cli-user-preference-checkbox').each(function(){ 254 255 var categoryCookie = 'cookielawinfo-'+jQuery(this).attr('data-id'); 256 var categoryCookieValue = CLI_Cookie.read(categoryCookie); 257 if( categoryCookieValue == null ) 258 { 259 if(jQuery(this).is(':checked')) 260 { 261 CLI_Cookie.set(categoryCookie,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 262 }else 263 { 264 CLI_Cookie.set(categoryCookie,'no',CLI_ACCEPT_COOKIE_EXPIRE); 265 } 266 } 267 else 268 { 269 if(categoryCookieValue == "yes") 270 { 271 jQuery(this).prop("checked",true); 272 } 273 else 274 { 275 jQuery(this).prop("checked",false); 276 } 277 278 } 279 280 }); 281 jQuery('.cli-user-preference-checkbox').click(function(){ 282 var dataID = jQuery(this).attr('data-id'); 283 var currentToggleElm = jQuery('.cli-user-preference-checkbox[data-id='+dataID+']'); 284 if(jQuery(this).is(':checked')) 285 { 286 CLI_Cookie.set('cookielawinfo-'+dataID,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 287 currentToggleElm.prop('checked',true); 288 }else 289 { 290 CLI_Cookie.set('cookielawinfo-'+dataID,'no',CLI_ACCEPT_COOKIE_EXPIRE);
291 currentToggleElm.prop('checked',false); 292 } 293 CLI.checkCategories(); 294 CLI.generate_user_preference_cookie(); 295 CLI.generateConsent(); 296 }); 297 }, 298 attachEvents:function() 299 { 300 jQuery(document).on('click keypress','.wt-cli-privacy-btn',function(e){ 301 var key = e.which; 302 e.preventDefault(); 303 if(key === 1 || key === 13) { 304 var action = jQuery(this).attr('data-cli-action'); 305 if( action === 'accept_all') { 306 CLI.enableAllCookies(); 307 } 308 CLI.accept_close(); 309 CLI.saveLog('accept'); 310 CLI.settingsPopUpClose(); 311 } 312 }); 313 jQuery('.wt-cli-privacy-overview-actions').find('a').last().keydown(function(e) { 314 var key = e.which 315 if(key === 9) { 316 if(e.shiftKey === false) { 317 e.preventDefault() 318 jQuery('#cliModalClose').focus() 319 } 320 } 321 }); 322 jQuery(document).on('click keypress','.cli_action_button',function(e){ 323 var key = e.which; 324 e.preventDefault(); 325 if(key === 1 || key === 13) { 326 var elm=jQuery(this); 327 var button_action=elm.attr('data-cli_action'); 328 var open_link=elm[0].hasAttribute("href") && elm.attr("href").charAt(0) !== '#' ? true : false; 329 var new_window=false; 330 if(button_action=='accept') 331 { 332 if (e.originalEvent !== undefined) { 333 334 if(CLI.settings.accept_all==true) 335 { 336 CLI.enableAllCookies(); 337 } 338 339 } 340 else 341 { 342 CLI.settingsPopUpClose(); 343 } 344 CLI.accept_close(); 345 new_window=CLI.settings.button_1_new_win ? true : false; 346 } 347 else if( button_action == 'accept_all') { 348 CLI.enableAllCookies(); 349 CLI.accept_close(); 350 new_window=CLI.settings.button_7_new_win ? true : false; 351 } 352 else if(button_action=='reject') 353 { 354 CLI.disableAllCookies(); 355 CLI.reject_close(); 356 new_window=CLI.settings.button_3_new_win ? true : false; 357 } 358 CLI.saveLog(button_action); 359 if(open_link) 360 { 361 if(new_window) 362 { 363 window.open(elm.attr("href"),'_blank'); 364 }else 365 { 366 window.location.href =elm.attr("href"); 367 } 368 } 369 } 370 }); 371 jQuery(document).on('click','.cli_cookie_close_button',function(e){ 372 e.preventDefault(); 373 var elm=jQuery(this); 374 var button_action=elm.attr('data-cli_action'); 375 if(CLI.settings.accept_all==true) 376 { 377 CLI.enableAllCookies(); 378 } 379 CLI.accept_close(); 380 CLI.saveLog(button_action); 381 }); 382 }, 383 saveLog:function(button_action) 384 { 385 if(CLI.settings.logging_on) 386 { 387 var ccpaOptedOut = cliBlocker.ccpaOptedOut(); 388 cookies = CLI_Cookie.getallcookies(); 389 cookies.ccpaOptout = ccpaOptedOut; 390 jQuery.ajax({ 391 url: log_object.ajax_url, 392 type: 'POST', 393 data:{ 394 action: 'wt_log_visitor_action', 395 wt_clicked_button_id: '', 396 wt_user_action:button_action, 397 cookie_list:cookies 398 }, 399 success:function (response) 400 { 401 402 } 403 }); 404 } 405 }, 406 attachDelete:function() 407 { 408 this.delete_link.click(function () { 409 CLI_Cookie.erase(CLI_ACCEPT_COOKIE_NAME); 410 for(var k in Cli_Data.nn_cookie_ids) 411 { 412 CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]); 413 } 414 CLI.generate_user_preference_cookie(); 415 CLI.generateConsent(); 416 window.location.reload(); 417 return false; 418 }); 419 }, 420 configButtons:function() 421 { 422 //[cookie_button] 423 this.main_button.css('color',this.settings.button_1_link_colour); 424 if(this.settings.button_1_as_button) 425 { 426 this.main_button.css('background-color',this.settings.button_1_button_colour); 427 this.main_button.hover(function () { 428 jQuery(this).css('background-color',CLI.settings.button_1_button_hover); 429 },function (){ 430 jQuery(this).css('background-color',CLI.settings.button_1_button_colour); 431 }); 432 } 433 434 //[cookie_link] 435 this.main_link.css('color',this.settings.button_2_link_colour); 436 if(this.settings.button_2_as_button) 437 { 438 this.main_link.css('background-color',this.settings.button_2_button_colour); 439 this.main_link.hover(function () { 440 jQuery(this).css('background-color',CLI.settings.button_2_button_hover); 441 },function (){ 442 jQuery(this).css('background-color',CLI.settings.button_2_button_colour); 443 }); 444 } 445 446 447 //[cookie_reject] 448 this.reject_link.css('color',this.settings.button_3_link_colour); 449 if(this.settings.button_3_as_button) 450 { 451 this.reject_link.css('background-color',this.settings.button_3_button_colour); 452 this.reject_link.hover(function () { 453 jQuery(this).css('background-color',CLI.settings.button_3_button_hover); 454 },function () { 455 jQuery(this).css('background-color',CLI.settings.button_3_button_colour); 456 }); 457 } 458 459 //[cookie_settings] 460 this.settings_link.css('color',this.settings.button_4_link_colour); 461 if(this.settings.button_4_as_button) 462 { 463 this.settings_link.css('background-color',this.settings.button_4_button_colour); 464 this.settings_link.hover(function () { 465 jQuery(this).css('background-color',CLI.settings.button_4_button_hover); 466 },function () { 467 jQuery(this).css('background-color',CLI.settings.button_4_button_colour); 468 }); 469 } 470 471 //[cookie_accept_all] 472 this.accept_all_button.css('color',this.settings.button_7_link_colour); 473 if(this.settings.button_7_as_button) 474 { 475 this.accept_all_button.css('background-color',this.settings.button_7_button_colour); 476 this.accept_all_button.hover(function () { 477 jQuery(this).css('background-color',CLI.settings.button_7_button_hover); 478 },function (){ 479 jQuery(this).css('background-color',CLI.settings.button_7_button_colour); 480 }); 481 } 482 483 }, 484 toggleBar:function() 485 { 486 if(CLI_COOKIEBAR_AS_POPUP) 487 { 488 this.barAsPopUp(1); 489 } 490 if(CLI.settings.cookie_bar_as=='widget') 491 { 492 this.barAsWidget(1); 493 } 494 if(this.settings.show_once_yn) 495 { 496 497 setTimeout(function(){ 498 if(!CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)) 499 { 500 CLI.close_header(); 501 } 502 },CLI.settings.show_once); 503 } 504 this.showagain_elm.on('click keypress', function (e) { 505 var key = e.which; 506 if(key === 1 || key === 13) { 507 e.preventDefault(); 508 CLI.showagain_elm.slideUp(CLI.settings.animate_speed_hide, function() { 509 CLI.bar_elm.slideDown(CLI.settings.animate_speed_show); 510 CLI.refocusElement(); 511 if(CLI_COOKIEBAR_AS_POPUP) { 512 CLI.showPopupOverlay(); 513 } 514 }); 515 } 516 }); 517 }, 518 configShowAgain:function() 519 { 520 this.showagain_config = { 521 'background-color': this.settings.background, 522 'color':this.settings.text, 523 'position': 'fixed', 524 'font-family': this.settings.font_family 525 }; 526 if(this.settings.border_on) 527 { 528 var border_to_hide = 'border-' + this.settings.notify_position_vertical; 529 this.showagain_config['border'] = '1px solid ' + this.l1hs(this.settings.border); 530 this.showagain_config[border_to_hide] = 'none'; 531 } 532 var cli_win=jQuery(window); 533 var cli_winw=cli_win.width(); 534 var showagain_x_pos=this.settings.showagain_x_position; 535 if(cli_winw<300) 536 { 537 showagain_x_pos=10; 538 this.showagain_config.width=cli_winw-20; 539 }else 540 { 541 this.showagain_config.width='auto'; 542 } 543 var cli_defw=cli_winw>400 ? 500 : cli_winw-20; 544 if(CLI_COOKIEBAR_AS_POPUP) //cookie bar as popup 545 { 546 var sa_pos=this.settings.popup_showagain_position; 547 var sa_pos_arr=sa_pos.split('-'); 548 if(sa_pos_arr[1]=='left') 549 { 550 this.showagain_config.left=showagain_x_pos; 551 }else if(sa_pos_arr[1]=='right') 552 { 553 this.showagain_config.right=showagain_x_pos; 554 } 555 if(sa_pos_arr[0]=='top') 556 { 557 this.showagain_config.top=0; 558 559 }else if(sa_pos_arr[0]=='bottom') 560 { 561 this.showagain_config.bottom=0; 562 } 563 this.bar_config['position'] = 'fixed'; 564 565 }else if(this.settings.cookie_bar_as=='widget') 566 { 567 this.showagain_config.bottom=0; 568 if(this.settings.widget_position=='left') 569 { 570 this.showagain_config.left=showagain_x_pos; 571 }else if(this.settings.widget_position=='right') 572 { 573 this.showagain_config.right=showagain_x_pos; 574 } 575 } 576 else 577 { 578 if(this.settings.notify_position_vertical == "top") 579 { 580 this.showagain_config.top = '0'; 581 } 582 else if(this.settings.notify_position_vertical == "bottom") 583 { 584 this.bar_config['position'] = 'fixed'; 585 this.bar_config['bottom'] = '0'; 586 this.showagain_config.bottom = '0'; 587 } 588 if(this.settings.notify_position_horizontal == "left") 589 { 590 this.showagain_config.left =showagain_x_pos; 591 }else if(this.settings.notify_position_horizontal == "right") 592 { 593 this.showagain_config.right =showagain_x_pos; 594 } 595 } 596 this.showagain_elm.css(this.showagain_config); 597 }, 598 configBar:function() 599 { 600 var templateID = ''; 601 this.bar_config = { 602 'background-color':this.settings.background, 603 'color':this.settings.text, 604 'font-family':this.settings.font_family 605 }; 606 if (jQuery(".wt-cli-template")[0]) 607 { 608 var templateElm = jQuery(".wt-cli-template"); 609 var templateClasses = templateElm.attr('class'); 610 var templateClasses = templateClasses.split(" "); 611 var matchingID = templateClasses.filter(function (value) { 612 613 return value.match(/\bcli-style/); 614 615 }); 616 templateID = matchingID[0]; 617 this.bar_elm.attr('data-template-id',templateID); 618 } 619 if(jQuery(".wt-cli-category-widget")[0]) 620 { 621 this.bar_elm.addClass('wt-cli-category-widget-active'); 622 } 623 if(this.settings.cookie_setting_popup===false) 624 { 625 this.barPopupStyle(); 626 } 627 if(this.settings.notify_position_vertical=="top") 628 { 629 this.bar_config['top'] = '0'; 630 if(this.settings.header_fix === true) 631 { 632 this.bar_config['position'] = 'fixed'; 633 } 634 }else 635 { 636 this.bar_config['bottom'] = '0'; 637 } 638 this.configShowAgain(); 639 this.bar_elm.css(this.bar_config).hide(); 640 }, 641 l1hs:function(str) 642 { 643 if (str.charAt(0) == "#") { 644 str = str.substring(1, str.length); 645 } else { 646 return "#" + str; 647 } 648 return this.l1hs(str); 649 }, 650 close_header:function() 651 { 652 CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 653 if(CLI.settings.accept_all==true) 654 { 655 CLI.enableAllCookies(); 656 } 657 CLI.accept_close(); 658 this.hideHeader(); 659 CLI.saveLog('accept'); 660 661 }, 662 accept_close:function() 663 { 664 665 this.hidePopupOverlay(); 666 CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'yes',CLI_ACCEPT_COOKIE_EXPIRE); 667 if(this.settings.notify_animate_hide) 668 { 669 this.bar_elm.slideUp(this.settings.animate_speed_hide,cliBlocker.runScripts); 670 }else 671 { 672 this.bar_elm.hide(0,cliBlocker.runScripts); 673 } 674 if(this.settings.showagain_tab) 675 { 676 this.showagain_elm.slideDown(this.settings.animate_speed_show); 677 this.showagain_elm.focus(); 678 } 679 this.generate_user_preference_cookie(); 680 this.generateConsent(); 681 CLI.cookieLawInfoRunCallBacks(); 682 if(this.settings.accept_close_reload === true) 683 { 684 this.reload_current_page(); 685 } 686 687 return false;
688 }, 689 reject_close:function() 690 { 691 this.hidePopupOverlay(); 692 for(var k in Cli_Data.nn_cookie_ids) 693 { 694 CLI_Cookie.erase(Cli_Data.nn_cookie_ids[k]); 695 } 696 CLI_Cookie.set(CLI_ACCEPT_COOKIE_NAME,'no',CLI_ACCEPT_COOKIE_EXPIRE); 697 if(this.settings.notify_animate_hide) 698 { 699 this.bar_elm.slideUp(this.settings.animate_speed_hide,cliBlocker.runScripts); 700 }else 701 { 702 this.bar_elm.hide(0,cliBlocker.runScripts); 703 } 704 if(this.settings.showagain_tab) 705 { 706 this.showagain_elm.slideDown(this.settings.animate_speed_show); 707 this.showagain_elm.focus(); 708 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 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} 1280var cliBlocker = 1281{ 1282 blockingStatus: true, 1283 geoIP: false, 1284 scriptsLoaded: false, 1285 ccpaEnabled : false, 1286 ccpaRegionBased : false, 1287 ccpaApplicable : false, 1288 ccpaBarEnabled: false, 1289 cliShowBar: true , 1290 isBypassEnabled: CLI.getParameterByName('cli_bypass'), 1291 checkPluginStatus:function(callbackA , callbackB ) 1292 { 1293 1294 cliBlocker.ccpaEnabled = Boolean( Cli_Data.ccpaEnabled ); 1295 cliBlocker.ccpaRegionBased = Boolean( Cli_Data.ccpaRegionBased ); 1296 cliBlocker.ccpaBarEnabled = Boolean( Cli_Data.ccpaBarEnabled ); 1297 if( cliBlocker.ccpaEnabled === true ) { 1298 cliBlocker.ccpaApplicable = true; 1299 if( Cli_Data.ccpaType === 'ccpa') { 1300 cliBlocker.blockingStatus = false; 1301 cliBlocker.cliShowBar = false; 1302 if( cliBlocker.ccpaBarEnabled === true ) { 1303 cliBlocker.cliShowBar = true; 1304 cliBlocker.blockingStatus = true; 1305 } 1306 } 1307 } 1308 1309 if(Cli_Data.geoIP === 'enabled' || (cliBlocker.ccpaEnabled === true && cliBlocker.ccpaRegionBased === true ) ) 1310 { 1311 if( Boolean( Cli_Data.use_custom_geolocation_api ) === true ) { 1312 1313 cliBlocker.tryCustomGeoLocationService( callbackA, callbackB ); 1314 1315 } else { 1316 jQuery.getJSON('https://ipapi.co/json/', function(data) 1317 { 1318 cliBlocker.geolocationHandler( data, callbackA, callbackB ); 1319 1320 }).fail(function() { 1321 1322 cliBlocker.tryCustomGeoLocationService( callbackA, callbackB ); 1323 1324 }); 1325 } 1326 1327 } else { 1328 if ( cliBlocker.isBypassEnabled === "1") { 1329 cliBlocker.blockingStatus = false; 1330 } 1331 callbackA(); 1332 callbackB(); 1333 } 1334 1335 }, 1336 tryCustomGeoLocationService: function( callbackA, callbackB ) { 1337 jQuery.getJSON(Cli_Data.custom_geolocation_api, function(data) { 1338 cliBlocker.geolocationHandler( data, callbackA, callbackB ); 1339 }); 1340 }, 1341 geolocationHandler:function( data, callbackA, callbackB ){ 1342 var euCountries = Cli_Data.eu_countries; 1343 if( (data.in_eu === false ) && (euCountries.indexOf(data.country) === -1)) 1344 { 1345 if( Cli_Data.geoIP === 'enabled' ) { 1346 cliBlocker.blockingStatus = false; 1347 cliBlocker.cliShowBar = false; 1348 } 1349 else { 1350 if( Cli_Data.ccpaType !== 'ccpa' ) { 1351 cliBlocker.blockingStatus = true; 1352 cliBlocker.cliShowBar = true; 1353 } 1354 } 1355 } 1356 else 1357 { 1358 jQuery('body').addClass('wt-cli-geoip-on wt-cli-eu-country'); 1359 } 1360 if( cliBlocker.ccpaEnabled === true ) { 1361 if( cliBlocker.ccpaRegionBased === true && data.region_code !== 'CA' ) { 1362 cliBlocker.ccpaApplicable = false; 1363 if( Cli_Data.ccpaType === 'ccpa') { 1364 cliBlocker.cliShowBar = false; 1365 cliBlocker.blockingStatus = false; 1366 } 1367 jQuery('.wt-cli-ccpa-opt-out,.wt-cli-ccpa-checkbox,.wt-cli-ccpa-element').remove(); 1368 } 1369 else { 1370 cliBlocker.ccpaApplicable = true; 1371 if( cliBlocker.ccpaBarEnabled === true ) { 1372 cliBlocker.cliShowBar = true; 1373 } 1374 } 1375 1376 } 1377 if( cliBlocker.blockingStatus === false ) { 1378 1379 if("function" == typeof CookieLawInfo_Accept_Callback){ 1380 CookieLawInfo_Accept_Callback(); 1381 } 1382 jQuery('body').addClass('wt-cli-geoip-on wt-cli-non-eu-country'); 1383 CLI.hidePopupOverlay(); 1384 if( cliBlocker.ccpaApplicable !== true ) { 1385 cliBlocker.removeAllPreferenceCookies(); 1386 jQuery('.wt-cli-geoip-on.wt-cli-non-eu-country').find('.wt-cli-element').remove(); 1387 1388 } 1389 } 1390 callbackA(); 1391 callbackB(); 1392 },
1393 cookieBar: function() 1394 { 1395 if( cliBlocker.cliShowBar === false ) 1396 { 1397 jQuery('.wt-cli-cookie-bar-container').remove(); 1398 } 1399 else 1400 { 1401 jQuery('.wt-cli-cookie-bar-container').show(); 1402 if(!CLI_Cookie.exists(CLI_ACCEPT_COOKIE_NAME)) 1403 { 1404 CLI.displayHeader(); 1405 1406 } 1407 else 1408 { 1409 CLI.hideHeader(); 1410 } 1411 } 1412 }, 1413 removeAllPreferenceCookies : function() 1414 { 1415 cliPreferenceCookies = Cli_Data.cookielist; 1416 for (var key in cliPreferenceCookies ) { 1417 CLI_Cookie.erase('cookielawinfo-checkbox-'+key); 1418 } 1419 }, 1420 removeCookieByCategory : function() 1421 { 1422 1423 if(cliBlocker.blockingStatus === true) 1424 { 1425 if(CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) !== null) 1426 { 1427 var non_necessary_cookies = Cli_Data.non_necessary_cookies; 1428 for (var key in non_necessary_cookies) { 1429 currentCategory = key; 1430 if(CLI.allowedCategories.indexOf(currentCategory) === -1) 1431 { 1432 var nonNecessaryCookies = non_necessary_cookies[currentCategory]; 1433 for(var i=0; i < nonNecessaryCookies.length; i++) 1434 { 1435 if(CLI_Cookie.read(nonNecessaryCookie
1435s[i]) !== null) 1436 { 1437 CLI_Cookie.erase(nonNecessaryCookies[i]); 1438 } 1439 1440 } 1441 } 1442 } 1443 } 1444 } 1445 }, 1446 runScripts:function() 1447 { 1448 srcReplaceableElms = ['iframe','IFRAME','EMBED','embed','OBJECT','object','IMG','img','SOURCE','source']; 1449 var genericFuncs = 1450 { 1451 1452 renderByElement: function(callback) 1453 { 1454 cliScriptFuncs.renderScripts(); 1455 cliHtmlElmFuncs.renderSrcElement(); 1456 callback(); 1457 cliBlocker.scriptsLoaded = true; 1458 }, 1459 reviewConsent : function() 1460 { 1461 jQuery(document).on('click','.cli_manage_current_consent,.wt-cli-manage-consent-link',function(){ 1462 CLI.bar_elm.slideDown(CLI.settings.animate_speed_show); 1463 }); 1464 } 1465 1466 }; 1467 var cliScriptFuncs = 1468 { 1469 // trigger DOMContentLoaded 1470 scriptsDone:function() 1471 { 1472 if( Boolean( Cli_Data.triggerDomRefresh ) === true ) 1473 { 1474 var DOMContentLoadedEvent = document.createEvent('Event') 1475 DOMContentLoadedEvent.initEvent('DOMContentLoaded', true, true) 1476 window.document.dispatchEvent(DOMContentLoadedEvent) 1477 } 1478 }, 1479 seq :function(arr, callback, index) { 1480 // first call, without an index 1481 if (typeof index === 'undefined') { 1482 index = 0 1483 } 1484 1485 arr[index](function () { 1486 index++ 1487 if (index === arr.length) { 1488 callback() 1489 } else { 1490 cliScriptFuncs.seq(arr, callback, index) 1491 } 1492 }) 1493 }, 1494 /* script runner */ 1495 insertScript:function($script,callback) { 1496 1497 var s =''; 1498 var allowedAttributes = [ 1499 'data-cli-class', 1500 'data-cli-label', 1501 'data-cli-placeholder', 1502 'data-cli-script-type', 1503 'data-cli-src' 1504 ]; 1505 var scriptType = $script.getAttribute('data-cli-script-type'); 1506 var elementPosition = $script.getAttribute('data-cli-element-position'); 1507 var isBlock = $script.getAttribute('data-cli-block'); 1508 var blockIfCCPA = $script.getAttribute('data-cli-block-if-ccpa-optout'); 1509 var s = document.createElement('script'); 1510 var ccpaOptedOut = cliBlocker.ccpaOptedOut(); 1511 s.type = 'text/plain'; 1512 if($script.async) 1513 { 1514 s.async = $script.async; 1515 } 1516 if($script.defer) 1517 { 1518 s.defer = $script.defer; 1519 } 1520 if ($script.src) { 1521 s.onload = callback 1522 s.onerror = callback 1523 s.src = $script.src 1524 } else { 1525 s.textContent = $script.innerText 1526 } 1527 if( $script.hasAttribute('data-cli-id') ) { 1528 s.id = $script.getAttribute('data-cli-id'); 1529 } 1530 var attrs = jQuery($script).prop("attributes"); 1531 for (var ii = 0; ii < attrs.length; ++ii) { 1532 if (attrs[ii].nodeName !== 'id') { 1533 s.setAttribute(attrs[ii].nodeName,attrs[ii].value); 1534 } 1535 } 1536 1537 if(cliBlocker.blockingStatus === true) 1538 { 1539 1540 if(( CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes' && CLI.allowedCategories.indexOf(scriptType) !== -1 ) || ( CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null && isBlock==='false') ) 1541 { 1542 s.setAttribute('data-cli-consent','accepted'); 1543 s.type = 'text/javascript'; 1544 1545 } 1546 if( Cli_Data.ccpaType === 'ccpa' && blockIfCCPA !== 'true') 1547 { 1548 s.type = 'text/javascript'; 1549 } 1550 } 1551 else 1552 { 1553 s.type = 'text/javascript'; 1554 } 1555 if( cliBlocker.ccpaApplicable === true && blockIfCCPA === 'true' ) { 1556 if( ccpaOptedOut === true || CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null ) { 1557 s.type = 'text/plain'; 1558 } 1559 } 1560 1561 if($script.type != s.type) 1562 { 1563 $script.parentNode.insertBefore(s,$script); 1564 if (!$script.src) 1565 { 1566 callback() 1567 } 1568 $script.parentNode.removeChild($script); 1569 } 1570 else { 1571 callback(); 1572 } 1573 }, 1574 renderScripts:function() 1575 { 1576 var $scripts = document.querySelectorAll('script[data-cli-class="cli-blocker-script"]'); 1577 if($scripts.length > 0) 1578 { 1579 var runList = [] 1580 var typeAttr 1581 Array.prototype.forEach.call($scripts, function ($script) { 1582 1583 // only run script tags without the type attribute 1584 // or with a javascript mime attribute value 1585 typeAttr = $script.getAttribute('type') 1586 var elmType = $script.tagName; 1587 runList.push(function (callback) { 1588 cliScriptFuncs.insertScript($script, callback) 1589 }) 1590 }) 1591 cliScriptFuncs.seq(runList, cliScriptFuncs.scriptsDone); 1592 } 1593 } 1594 }; 1595 var cliHtmlElmFuncs = { 1596 renderSrcElement: function() 1597 { 1598 var blockingElms = document.querySelectorAll('[data-cli-class="cli-blocker-script"]'); 1599 var ccpaOptedOut = cliBlocker.ccpaOptedOut(); 1600 for (var i = 0; i < blockingElms.length; i++) 1601 { 1602 var currentElm = blockingElms[i]; 1603 var elmType = currentElm.tagName; 1604 if(srcReplaceableElms.indexOf(elmType) !== -1) 1605 { 1606 var elmCategory = currentElm.getAttribute('data-cli-script-type'); 1607 var isBlock = currentElm.getAttribute('data-cli-block'); 1608 var blockIfCCPA = currentElm.getAttribute('data-cli-block-if-ccpa-optout'); 1609 if( cliBlocker.blockingStatus === true ) 1610 { 1611 if((CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME)=='yes' && CLI.allowedCategories.indexOf(elmCategory) !== -1 ) || ( CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null && isBlock==='false') ) 1612 { 1613 if( cliBlocker.ccpaApplicable == true && blockIfCCPA === 'true' && ccpaOptedOut === true) { 1614 this.addPlaceholder(currentElm); 1615 } 1616 else { 1617 this.replaceSrc(currentElm); 1618 } 1619 } 1620 else 1621 { 1622 if( Cli_Data.ccpaType === 'ccpa' && blockIfCCPA !== 'true') 1623 { 1624 this.replaceSrc(currentElm); 1625 } 1626 else { 1627 this.addPlaceholder(currentElm); 1628 } 1629 1630 } 1631 1632 } 1633 else 1634 { 1635 if( cliBlocker.ccpaApplicable == true && blockIfCCPA === 'true' ) { 1636 if( ccpaOptedOut === true || CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) == null ) { 1637 this.addPlaceholder(currentElm); 1638 } else { 1639 this.replaceSrc(currentElm); 1640 } 1641 1642 } 1643 else { 1644 this.replaceSrc(currentElm); 1645 } 1646 } 1647 1648 } 1649 } 1650 1651 }, 1652 addPlaceholder:function(htmlElm) 1653 { 1654 if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length === 0) 1655 { 1656 var htmlElemName = htmlElm.getAttribute('data-cli-label'); 1657 var htmlElemType = htmlElm.getAttribute('data-cli-placeholder'); 1658 var htmlElemWidth = htmlElm.getAttribute('width'); 1659 var htmlElemHeight = htmlElm.getAttribute('height'); 1660 if(htmlElemWidth == null) 1661 { 1662 htmlElemWidth = htmlElm.offsetWidth; 1663 } 1664 if(htmlElemHeight == null) 1665 { 1666 htmlElemHeight = htmlElm.offsetHeight; 1667 } 1668 pixelPattern = /px/; 1669 htmlElemWidth = ((pixelPattern.test(htmlElemWidth)) ? htmlElemWidth : htmlElemWidth+'px'); 1670 htmlElemHeight = ((pixelPattern.test(htmlElemHeight)) ? htmlElemHeight : htmlElemHeight+'px'); 1671 var addPlaceholder = '<div style="width:'+htmlElemWidth+'; height:'+htmlElemHeight+';" class="wt-cli-iframe-placeholder"><div class="wt-cli-inner-text">'+htmlElemType+'</div></div>'; 1672 addPlaceholder.width = htmlElemWidth; 1673 addPlaceholder.height = htmlElemHeight; 1674 if(htmlElm.tagName !== 'IMG') 1675 { 1676 jQuery(addPlaceholder).insertBefore(htmlElm); 1677 } 1678 htmlElm.removeAttribute('src'); 1679 htmlElm.style.display = 'none'; 1680 } 1681 }, 1682 replaceSrc: function(htmlElm) 1683 { 1684 if(!htmlElm.hasAttribute('src')) 1685 { 1686 var htmlElemSrc = htmlElm.getAttribute('data-cli-src'); 1687 htmlElm.setAttribute('src',htmlElemSrc); 1688 if(jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').length > 0) 1689 { 1690 jQuery(htmlElm).prev('.wt-cli-iframe-placeholder').remove(); 1691 } 1692 htmlElm.style.display = 'block'; 1693 } 1694 } 1695 }; 1696 1697 genericFuncs.reviewConsent(); 1698 genericFuncs.renderByElement(cliBlocker.removeCookieByCategory); 1699 }, 1700 ccpaOptedOut: function () { 1701 var ccpaOptedOut = false;
1702 var preferenceCookie = CLI_Cookie.read(CLI_PREFERNCE_COOKIE); 1703 if( preferenceCookie !== null ) { 1704 if(CLI.isBase64(preferenceCookie)) 1705 { 1706 cliConsent = window.atob(preferenceCookie); 1707 } 1708 else 1709 { 1710 cliConsent = decodeURIComponent(preferenceCookie); 1711 } 1712 cliConsent = JSON.parse(cliConsent); 1713 if( typeof cliConsent.ccpaOptout !== 'undefined') { 1714 ccpaOptedOut = cliConsent.ccpaOptout; 1715 } 1716 } 1717 return ccpaOptedOut; 1718 } 1719} 1720jQuery(document).ready(function() { 1721 if(typeof cli_cookiebar_settings!='undefined') 1722 { 1723 CLI.set({ 1724 settings:cli_cookiebar_settings 1725 }); 1726 cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts); 1727 } 1728 else 1729 { 1730 var data = { 1731 action: 'cli_get_settings_json', 1732 }; 1733 jQuery.ajax({ 1734 url: Cli_Data.ajax_url, 1735 data: data, 1736 dataType: 'json', 1737 type: 'GET', 1738 success: function (response) { 1739 CLI.set({ 1740 settings:response 1741 }); 1742 cliBlocker.checkPluginStatus(cliBlocker.cookieBar,cliBlocker.runScripts); 1743 } 1744 }); 1745 } 1746});
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.