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