1/** 2 * cookie popup features 3 * @var object ct_ultimate_gdpr_cookie - from wp_localize_script 4 * @var object ct_ultimate_gdpr_cookie_shortcode_popup - from wp_localize_script 5 * 6 * */ 7 jQuery(document).ready(function ($) { 8 9 // IN PANEL VIEW @ 1024px WINDOW WIDTH AND WIDER, ALLOWS OREO 10 // SKIN BUTTONS TO HAVE 50% HEIGHT EVEN IF PARENT HAS DYNAMIC HEIGHT 11 var oreoTopPanel = $('.ct-ultimate-gdpr-cookie-popup-oreo.ct-ultimate-gdpr-cookie-topPanel'); 12 var oreoBottomPanel = $('.ct-ultimate-gdpr-cookie-popup-oreo.ct-ultimate-gdpr-cookie-bottomPanel'); 13 if (oreoTopPanel.add(oreoBottomPanel).length) { 14 function setBtnHeight() { 15 if ($(window).width() >= 1024) { 16 var boxHeight = jQuery('#ct-ultimate-gdpr-cookie-popup.ct-ultimate-gdpr-cookie-popup-oreo').outerHeight(); 17 var btnHeight = boxHeight; 18 if ($('#ct-ultimate-gdpr-cookie-change-settings','.ct-ultimate-gdpr-cookie-popup-oreo').length) { 19 var btnHeight = boxHeight / 2; 20 } 21 $('#ct-ultimate-gdpr-cookie-accept, #ct-ultimate-gdpr-cookie-change-settings, #ct_ultimate-gdpr-cookie-reject','.ct-ultimate-gdpr-cookie-popup-oreo').css({ 22 'height': btnHeight + 'px', 23 'line-height': btnHeight + 'px', 24 'padding-top': 0, 25 'padding-bottom': 0 26 }); 27 } else { 28 $('#ct-ultimate-gdpr-cookie-accept, #ct-ultimate-gdpr-cookie-change-settings, #ct_ultimate-gdpr-cookie-reject','.ct-ultimate-gdpr-cookie-popup-oreo').css({ 29 'height': '52px', 30 'line-height': '52px', 31 'padding-top': 0, 32 'padding-bottom': 0 33 }); 34 } 35 } 36 setBtnHeight(); 37 $(window).resize(function() { 38 setBtnHeight(); 39 }); 40 } 41 42 // FIX DOUBLE VERTICAL SCROLLBAR AFTER COOKIE MODAL POPUP SAVE BUTTON IS CLICKED 43 $('.ct-ultimate-gdpr-cookie-modal-btn.save').on('click', function () { 44 $(this).parents('#ct-ultimate-gdpr-cookie-modal').hide(); 45 }); 46 47 // 1173 48 $('input.ct-ultimate-gdpr-cookie-modal-single-item').each(function() { 49 if ( $(this).is(":checked") ) { 50 var checkboxParent = $(this).closest("li"); 51 52 $(this).addClass('ct-cookie-item-selected'); 53 checkboxParent.addClass('active'); 54 checkboxParent.find('path').css('fill', '#82aa3b'); 55 } 56 }); 57 58 // TOGGLE "HIDE DETAILS" BUTTON, AND COOKIE WILL / WON'T LIST ACCORDINGLY 59 var compactBlock = $('.ct-ultimate-gdpr-cookie-modal-compact #ct-ultimate-gdpr-cookie-modal-slider-item-block'); 60 compactBlock.on('click', function () { 61 var cookieList = jQuery(this).parents('form').next(); 62 var hideDetails = jQuery('.hide-btn-wrapper'); 63 if (cookieList.is(':visible')) { 64 cookieList.slideUp(); 65 } 66 if (hideDetails.is(':visible')) { 67 hideDetails.slideUp(); 68 } 69 }); 70 var compactItem = $('.ct-ultimate-gdpr-cookie-modal-compact .ct-ultimate-gdpr-cookie-modal-slider-item'); 71 compactItem.not('#ct-ultimate-gdpr-cookie-modal-slider-item-block').on('click', function () { 72 var cookieList = jQuery(this).parents('form').next(); 73 var hideDetails = jQuery('.hide-btn-wrapper'); 74 if (cookieList.is(':hidden')) { 75 cookieList.slideDown(); 76 } 77 if (hideDetails.is(':hidden')) { 78 hideDetails.slideDown(); 79 } 80 }); 81 82 function isModalAlwaysVisible() { 83 return false; 84 // return !! ( window.ct_ultimate_gdpr_cookie_shortcode_popup && ct_ultimate_gdpr_cookie_shortcode_popup.always_visible ); 85 } 86 87 function hidePopup() { 88 89 if (isModalAlwaysVisible()) return; 90 91 jQuery('#ct-ultimate-gdpr-cookie-popup').hide(); 92 jQuery('.ct-ultimate-gdpr-cookie-fullPanel-overlay').hide(); 93 jQuery('#ct-ultimate-gdpr-cookie-open').show(function(){ 94 $(this).css('display','flex'); 95 }); 96 } 97 98 function showPopup() { 99 jQuery('#ct-ultimate-gdpr-cookie-popup').show(); 100 } 101 102 function hideModal() { 103 104 if (isModalAlwaysVisible()) return; 105 106 jQuery('#ct-ultimate-gdpr-cookie-modal').hide(); 107 jQuery('#ct-ultimate-gdpr-cookie-open').show(function(){ 108 $(this).css('display','flex'); 109 }); 110 } 111 112 function showModal() { 113 jQuery('#ct-ultimate-gdpr-cookie-modal').show(); 114 jQuery('#ct-ultimate-gdpr-cookie-open').hide(); 115 } 116 117 function getCookie(name) { 118 var ctCookie = document.cookie; 119 if (ctCookie) { 120 var match = ctCookie.match(new RegExp('(^| )' + name + '=([^;]+)')); 121 if (match) return match[2]; 122 } else { 123 return ''; 124 } 125 126 } 127 128 function dateToAge(date) { 129 const msDiff = Date.now() - date.getTime(); 130 const diffDate = new Date(msDiff); 131 132 return Math.abs(diffDate.getUTCFullYear() - 1970); 133 } 134 135 function shouldDisplayPopup() { 136 137 // on some setups php is unable to grab cookie in backend, then check in js below 138 if (ct_ultimate_gdpr_cookie.consent) { 139 return false; 140 } 141 142 const consentCookieValue = getCookie('ct-ultimate-gdpr-cookie'); 143 144 //fix for old version of the plugin 145 if(consentCookieValue){ 146 var myCookieIsFromOldVersion = (consentCookieValue.indexOf("consent") !== -1); 147 if(myCookieIsFromOldVersion){ 148 document.cookie = "ct-ultimate-gdpr-cookie" + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 149 return true; 150 } 151 } 152 153 var cookieObject = consentCookieValue ? JSON.parse(atob(decodeURIComponent(consentCookieValue))) : {}; 154 155 //checking for latest/legacy expire_time js implementation 156 if (cookieObject.consent_expire_time) { 157 return cookieObject.consent_expire_time < +new Date / 1000; 158 } else if (cookieObject.expire_time) { 159 return cookieObject.expire_time < +new Date / 1000; 160 } else { 161 return true; 162 } 163 164 } 165 166 function maybeShowPopup(e) { 167 // hide popup and show small gear icon if user already given consent 168 if (shouldDisplayPopup()) { 169 showPopup(); 170 $('body').removeClass("ct-ultimate-gdpr-cookie-bottomPanel-padding"); 171 $('body').removeClass("ct-ultimate-gdpr-cookie-topPanel-padding"); 172 173 } else { 174 hidePopup(); 175 } 176 177 } 178 179 function setJsCookie(consent_level) { 180 181 try { 182 183 var consent_expire_time = ct_ultimate_gdpr_cookie.consent_expire_time; 184 var consent_time = ct_ultimate_gdpr_cookie.consent_time; 185 var content = { 186 'consent_level': consent_level, 187 'consent_expire_time': consent_expire_time, 188 'consent_time': consent_time, 189 'consent_declined': false 190 }; 191 192 content = btoa(JSON.stringify(content)); 193 var js_expire_time = new Date(1000 * consent_expire_time).toUTCString(); 194 195 // Check if the site is accessed via HTTPS 196 var cookieSecureFlag = ''; 197 if (window.location.protocol === 'https:') { 198 cookieSecureFlag = '; Secure'; 199 } 200
201 document.cookie = "ct-ultimate-gdpr-cookie=" + content + "; expires=" + js_expire_time + "; path=/" + cookieSecureFlag; 202 203 } catch (e) { 204 205 } 206 207 } 208 209 function onAccept() { 210 211 var level = ct_ultimate_gdpr_cookie.consent_accept_level; 212 var protectLevel = $(".ct-ultimate-gdpr-shortcode-protection").attr('data-level'); 213 var $this = $(this); 214 setJsCookie(level); 215 216 // triggering click in proper modal input 217 jQuery('.ct-ultimate-gdpr-cookie-modal-content input[data-count=' + level + ']').trigger('click'); 218 219 jQuery.post(ct_ultimate_gdpr_cookie.ajaxurl, { 220 "action": "ct_ultimate_gdpr_cookie_consent_give", 221 "level": level 222 }, 223 function () { 224 $(document).trigger("consentUpdated.ctUltimateGdpr", [level]); 225 226 if( $this.attr("id") != "ct-ultimate-cookie-close-modal" ){ 227 if (ct_ultimate_gdpr_cookie.reload) { 228 window.location.reload(true); 229 } 230 } 231 } 232 ).fail(function () { 233 234 235 jQuery.post(ct_ultimate_gdpr_cookie.ajaxurl, { 236 "skip_cookies": true, 237 "action": "ct_ultimate_gdpr_cookie_consent_give", 238 "level": level 239 }, function () { 240 $(document).trigger("consentUpdated.ctUltimateGdpr", [level]); 241 242 if( $this.attr("id") != "ct-ultimate-cookie-close-modal" ){ 243 if (ct_ultimate_gdpr_cookie.reload) { 244 window.location.reload(true); 245 } 246 } 247 }); 248 249 }); 250 251 if (!ct_ultimate_gdpr_cookie.reload) { 252 hidePopup() 253 if (level >= protectLevel) { 254 $(".ct-ultimate-gdpr-shortcode-protection").removeClass("blur") 255 $("span.ct-ultimate-gdpr-shortcode-protection-label").remove(); 256 var content = $("div.ct-ultimate-gdpr-shortcode-protection").text(); 257 var result = $.base64.decode(content); 258 $(".ct-ultimate-gdpr-shortcode-protection").html(result); 259 } 260 261 } 262 263 $('body').removeClass("ct-ultimate-gdpr-cookie-bottomPanel-padding"); 264 $('body').removeClass("ct-ultimate-gdpr-cookie-topPanel-padding"); 265 266 267 if (level >= protectLevel) { 268 $(".ct-ultimate-gdpr-shortcode-protection").removeClass("blur") 269 $("span.ct-ultimate-gdpr-shortcode-protection-label").remove(); 270 var content = $("div.ct-ultimate-gdpr-shortcode-protection").text(); 271 var result = $.base64.decode(content); 272 $(".ct-ultimate-gdpr-shortcode-protection").html(result); 273 } 274 } 275 276 function onRead() { 277 if (ct_ultimate_gdpr_cookie && ct_ultimate_gdpr_cookie.readurl) { 278 if (ct_ultimate_gdpr_cookie.readurl_new_tab == "off"){ 279 window.location.href = ct_ultimate_gdpr_cookie.readurl; 280 }else{ 281 window.open(ct_ultimate_gdpr_cookie.readurl, '_blank'); 282 } 283 } 284 } 285 286 function onCloseModal(e) { 287 e.preventDefault(); 288 289 var level = ct_ultimate_gdpr_cookie.consent_default_level; 290 291 jQuery.post( ct_ultimate_gdpr_cookie.ajaxurl, { 292 "action" : "ct_ultimate_gdpr_cookie_consent_decline", 293 "ct_ultimate_gdpr_button_close" : "1" 294 }, 295 function () { 296 if (ct_ultimate_gdpr_cookie.reload) { 297 window.location.reload(true); 298 } 299 }); 300 301 if (isModalAlwaysVisible()) return; 302 303 jQuery('#ct-ultimate-gdpr-cookie-popup').hide(); 304 jQuery('.ct-ultimate-gdpr-cookie-fullPanel-overlay').hide(); 305 306 } 307 // 1173 308 function ASCValidate(array) { 309 var length = array.length; 310 return array.every(function(value, index) { 311 var nextIndex = index + 1; 312 return nextIndex < length ? value < array[nextIndex] : true; 313 }); 314 } 315 316 function onSave(e) { 317 318 e.preventDefault(); 319 320 var level = $('.ct-ultimate-gdpr-cookie-modal-slider-item--active input').val(), 321 protectLevel = $(".ct-ultimate-gdpr-shortcode-protection").attr('data-level'), 322 init_level_id = $('li input.ct-ultimate-gdpr-cookie-modal-single-item.ct-cookie-item-selected').map(function(){ return this.value; }).get(); 323 324 let level_id = init_level_id; // 1173 325 326 if(init_level_id.length > 0) { 327 $('li input.ct-ultimate-gdpr-cookie-modal-single-item.ct-cookie-item-selected').each(function(e) { 328 if( !ASCValidate(level_id) ) { 329 level_id = level_id.slice(0, -1); // delete last index until statement is true. 330 } 331 if( init_level_id[0] === '1') { // force block-all = 1. 332 level_id = ['1']; 333 } 334 }); 335 } 336
337 document.cookie = 'ct-ultimate-gdpr-cookie=;expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 338 339 jQuery.post(ct_ultimate_gdpr_cookie.ajaxurl, { 340 "action": "ct_ultimate_gdpr_cookie_consent_give", 341 "level": level, 342 "level_id": level_id 343 }, function () { 344 345 $(document).trigger("consentUpdated.ctUltimateGdpr", [level, level_id]); 346 347 if (ct_ultimate_gdpr_cookie.reload) { 348 window.location.reload(true); 349 } 350 }).fail(function () { 351 352 jQuery.post(ct_ultimate_gdpr_cookie.ajaxurl, { 353 "skip_cookies": true, 354 "action": "ct_ultimate_gdpr_cookie_consent_give", 355 "level": level, 356 "level_id": level_id 357 }, function () { 358 setJsCookie(level); 359 $(document).trigger("consentUpdated.ctUltimateGdpr", [level, level_id]); 360 if (ct_ultimate_gdpr_cookie.reload) { 361 window.location.reload(true); 362 } 363 }) 364 365 }); 366 367 if (!ct_ultimate_gdpr_cookie.reload) { 368 hideModal(); 369 hidePopup(); 370 if (level >= protectLevel) { 371 $(".ct-ultimate-gdpr-shortcode-protection").removeClass("blur") 372 $("span.ct-ultimate-gdpr-shortcode-protection-label").remove(); 373 var content = $("div.ct-ultimate-gdpr-shortcode-protection").text(); 374 var result = $.base64.decode(content); 375 $(".ct-ultimate-gdpr-shortcode-protection").html(result); 376 } 377 } 378 $('body').removeClass("ct-ultimate-gdpr-cookie-bottomPanel-padding"); 379 $('body').removeClass("ct-ultimate-gdpr-cookie-topPanel-padding"); 380 $('html').removeClass("cookie-modal-open"); 381 $('body').removeClass("cookie-modal-open"); 382 383 if (level >= protectLevel) { 384 $(".ct-ultimate-gdpr-shortcode-protection").removeClass("blur") 385 $("span.ct-ultimate-gdpr-shortcode-protection-label").remove(); 386 var content = $("div.ct-ultimate-gdpr-shortcode-protection").text(); 387 var result = $.base64.decode(content); 388 $(".ct-ultimate-gdpr-shortcode-protection").html(result); 389 } 390 } 391 392 $('#ct-ultimate-gdpr-cookie-accept').bind('click', onAccept); 393 $('#ct-ultimate-cookie-close-modal').bind('click', onCloseModal); 394 $('#ct-ultimate-gdpr-cookie-read-more').bind('click', onRead); 395 $('.ct-ultimate-gdpr-cookie-modal-btn.save').bind('click', onSave); 396 397 398 //MODAL 399 $('#ct-ultimate-gdpr-cookie-open,#ct-ultimate-gdpr-cookie-change-settings,.ct-ultimate-triggler-modal-sc').on('click', function (e) { 400 $link = $(this); 401 402 if(ct_ultimate_gdpr_cookie.use_ajax_cookie_popup === "1"){ 403 const $parentClass = "#ct-ultimate-gdpr-cookie-popup"; 404 $link.closest($parentClass).addClass("ct-loading"); 405 406 $.get( ct_ultimate_gdpr_cookie.url + "/wp-json/ct-ultimate-gdpr/v1/cookie-popup-options", function( data ) { 407 const obj = JSON.parse( data ); 408 if( obj.cookie_popup_ajax_enabled != '' ) { 409 $.ajax({
410 type: 'GET', 411 url: ct_ultimate_gdpr_cookie.url + '/wp-json/ct-ultimate-gdpr/v1/cookie-popup', 412 dataType: 'html', 413 success: function (output) { 414 $("#ct-ultimate-gdpr-cookie-modal").replaceWith(output); 415 $("#ct-ultimate-gdpr-cookie-modal").css('display', 'block'); 416 $(".ct-ultimate-gdpr-cookie-modal-slider-item.ct-ultimate-gdpr-cookie-modal-slider-item--active").trigger("click"); 417 $("body").addClass("cookie-modal-open"); 418 $("html").addClass("cookie-modal-open"); 419 e.stopPropagation(); 420 $link.closest($parentClass).removeClass("ct-loading"); 421 }, 422 error: function(output){ 423 console.log('error') 424 } 425 }); 426 } 427 }); 428 } else { 429 var modalbody = $("body"); 430 var modal = $("#ct-ultimate-gdpr-cookie-modal"); 431 modal.show(); 432 $('.ct-ultimate-gdpr-cookie-modal-slider-item.ct-ultimate-gdpr-cookie-modal-slider-item--active').trigger('click'); 433 modalbody.addClass("cookie-modal-open"); 434 $("html").addClass("cookie-modal-open"); 435 e.stopPropagation(); 436 437 var slider_class = $("#ct-ultimate-gdpr-cookie-modal-slider-form").attr("class"); 438 if (typeof slider_class !== "undefined" && slider_class) { 439 var matches = slider_class.match(/\d+$/); 440 if (matches) { 441 var level = matches[0]; 442 var selector = ".ct-ultimate-gdpr-cookie-modal-slider li:nth-child(" + level + ")"; 443 if ($(selector).length > 0) { // Check if the element exists 444 $(selector).addClass('ct-ultimate-gdpr-cookie-modal-slider-item--active'); 445 } 446 } 447 } 448 } 449 450 }); 451 452 //Close modal on x button 453 $('#ct-ultimate-gdpr-cookie-modal-close,#ct-ultimate-gdpr-cookie-modal-compact-close').on('click', function () { 454 455 if (isModalAlwaysVisible()) return; 456 457 var modalbody = $("body"); 458 var modal = $("#ct-ultimate-gdpr-cookie-modal"); 459 modal.hide(); 460 modalbody.removeClass("cookie-modal-open"); 461 $("html").removeClass("cookie-modal-open"); 462 }); 463 464 //Close modal when clicking outside of modal area. 465 $('#ct-ultimate-gdpr-cookie-modal').on("click", function (e) { 466 467 if (isModalAlwaysVisible()) return; 468 469 if (!($(e.target).closest('#ct-ultimate-gdpr-cookie-change-settings, .ct-ultimate-gdpr-cookie-modal-content').length)) { 470 var modalbody = $("body"); 471 var modal = $("#ct-ultimate-gdpr-cookie-modal"); 472 modal.hide(); 473 modalbody.removeClass("cookie-modal-open"); 474 $("html").removeClass("cookie-modal-open"); 475 } 476 477 e.stopPropagation(); 478 }); 479 480 //SVG 481 jQuery('img.ct-svg').each(function () { 482 var $img = jQuery(this); 483 var imgID = $img.attr('id'); 484 var imgClass = $img.attr('class'); 485 var imgURL = $img.attr('src'); 486 487 jQuery.get(imgURL, function (data) { 488 // Get the SVG tag, ignore the rest 489 var $svg = jQuery(data).find('svg'); 490 491 // Add replaced image's ID to the new SVG 492 if (typeof imgID !== 'undefined') { 493 $svg = $svg.attr('id', imgID); 494 } 495 // Add replaced image's classes to the new SVG 496 if (typeof imgClass !== 'undefined') { 497 $svg = $svg.attr('class', imgClass + ' replaced-svg'); 498 } 499 500 // Remove any invalid XML tags as per http://validator.w3.org 501 $svg = $svg.removeAttr('xmlns:a'); 502 503 // Check if the viewport is set, else we gonna set it if we can. 504 if (!$svg.attr('viewBox') && $svg.attr('height') && $svg.attr('width')) { 505 $svg.attr('viewBox', '0 0 ' + $svg.attr('height') + ' ' + $svg.attr('width')) 506 } 507 508 // Replace image with new SVG 509 $img.replaceWith($svg); 510 511 }, 'xml'); 512 });
513 514 function alwaysDisplayCookie(){ 515 if(ct_ultimate_gdpr_cookie.display_cookie_always) { 516 showPopup(); 517 jQuery('#ct-ultimate-gdpr-cookie-open').hide(); 518 } 519 } 520 521 function deleteAllCookies(){ 522 var cookies = document.cookie.split(";"); 523 524 for (var i = 0; i < cookies.length; i++) { 525 var cookie = cookies[i]; 526 var eqPos = cookie.indexOf("="); 527 var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; 528 setCookie(name,'',-1); 529 } 530 } 531 532 533 function setCookie(name,value,days) { 534 var expires = ""; 535 if (days) { 536 var date = new Date(); 537 date.setTime(date.getTime() + (days*24*60*60*1000)); 538 expires = "; expires=" + date.toUTCString(); 539 } 540 // Check if the site is accessed via HTTPS 541 var cookieSecureFlag = ''; 542 if (window.location.protocol === 'https:') { 543 cookieSecureFlag = '; Secure'; 544 } 545 546 document.cookie = name + "=" + (value || "") + expires + "; path=/" + cookieSecureFlag; 547 } 548 549 function resetCookieConsent(){ 550 if(ct_ultimate_gdpr_cookie.cookie_reset_consent){ 551 deleteAllCookies(); 552 } else { 553 // do nothing here 554 } 555 } 556 557 $(window).on('load', function () { 558 var selected = $('.ct-ultimate-gdpr-cookie-modal-slider-item--active'); 559 560 var checked = selected.find('input'); 561 var input_id = checked.attr('id'); 562 var $count = checked.attr('data-count'); 563 selected.find('path').css('fill', '#82aa3b'); 564 selected.prevUntil('#ct-ultimate-gdpr-cookie-modal-slider-item-block').addClass('ct-ultimate-gdpr-cookie-modal-slider-item--selected'); 565 checked.parent().prevUntil('#ct-ultimate-gdpr-cookie-modal-slider-item-block').find('path').css('fill', '#82aa3b'); 566 567 $('#ct-ultimate-gdpr-cookie-modal-slider-form').attr('class', 'ct-slider-cookie' + $count); 568 $('.ct-ultimate-gdpr-cookie-modal-slider-info.' + 'cookie_' + $count).css('display', 'block'); 569 570 if( getCookie('ct-ultimate-gdpr-cookie-popup') == 1 ){ 571 jQuery('#ct-ultimate-gdpr-cookie-popup').hide(); 572 jQuery('.ct-ultimate-gdpr-cookie-fullPanel-overlay').hide(); 573 } 574 575 576 }); 577 578 $('.ct-ultimate-gdpr-cookie-modal-slider').each(function () { 579 580 var $btns = $('.ct-ultimate-gdpr-cookie-modal-slider-item').click(function () { 581 582 var $input = $(this).find('input').attr('id'); 583 584 $('.tab').removeClass('ct-ultimate-gdpr-cookie-modal-active-tab'); 585 $('.tab.' + $input).addClass('ct-ultimate-gdpr-cookie-modal-active-tab'); 586 587 var $el = $('.' + $input); 588 $el.show(); 589 var form_class = $('#ct-ultimate-gdpr-cookie-modal-slider-form'); 590 var modalBody = $('div#ct-ultimate-gdpr-cookie-modal-body'); 591 592 var $count = $(this).find('input').attr('data-count'); 593 594 $('#ct-ultimate-gdpr-cookie-modal-slider-form').attr('class', 'ct-slider-cookie' + $count); 595 $('.ct-ultimate-gdpr-cookie-modal-slider-wrap .ct-ultimate-gdpr-cookie-modal-slider-info').not($el).hide(); 596 597 $btns.removeClass('ct-ultimate-gdpr-cookie-modal-slider-item--active'); 598 $(this).addClass('ct-ultimate-gdpr-cookie-modal-slider-item--active'); 599 600 $(this).prevUntil('#ct-ultimate-gdpr-cookie-modal-slider-item-block').find('path').css('fill', '#82aa3b'); 601 $(this).prevUntil('#ct-ultimate-gdpr-cookie-modal-slider-item-block').addClass('ct-ultimate-gdpr-cookie-modal-slider-item--selected'); 602 $(this).find('path').css('fill', '#82aa3b'); 603 $(this).nextAll().find('path').css('fill', '#595959'); 604 $(this).removeClass('ct-ultimate-gdpr-cookie-modal-slider-item--selected'); 605 $(this).nextAll().removeClass('ct-ultimate-gdpr-cookie-modal-slider-item--selected'); 606 607 if ($(this).attr('id') === 'ct-ultimate-gdpr-cookie-modal-slider-item-block') {
608 modalBody.addClass('ct-ultimate-gdpr-slider-block'); 609 modalBody.removeClass('ct-ultimate-gdpr-slider-not-block'); 610 } else { 611 modalBody.removeClass('ct-ultimate-gdpr-slider-block'); 612 modalBody.addClass('ct-ultimate-gdpr-slider-not-block'); 613 } 614 615 }); 616 617 }); 618 619 620 621 // 1173 granular cookie 622 623 $(document).on('change', '#ct-ultimate-gdpr-cookie-modal input[type=radio]', function() { 624 // granular cookies, block all 625 var radioParent = $(this).closest("li"); 626 $("input[type=checkbox]").prop( "checked", false ); 627 628 if( $(this).prop("checked") ) { 629 $(".ct-ultimate-gdpr-cookie-modal-single li").removeClass('active'); 630 $(".ct-ultimate-gdpr-cookie-modal-single li input").removeClass('ct-cookie-item-selected'); 631 $(".ct-ultimate-gdpr-cookie-modal-single li").find('path').css('fill', '#595959'); 632 633 radioParent.addClass('active'); 634 $(this).addClass('ct-cookie-item-selected'); 635 radioParent.find('path').css('fill', '#82aa3b'); 636 } 637 }); 638 639 $(document).on('change', '#ct-ultimate-gdpr-cookie-modal input[type=checkbox]', function() { 640 $('.ct-ultimate-gdpr-cookie-modal-single-wrap').show(); 641 var checkboxParent = $(this).closest("li"); 642 $("#cookie0").prop( "checked", false ); 643 $("#cookie0").closest("li").removeClass('active'); 644 $("#cookie0").removeClass('ct-cookie-item-selected'); 645 $("#cookie0").closest("li").find('path').css('fill', '#111'); 646 647 if( $(this).prop("checked") ) { 648 $(this).addClass('ct-cookie-item-selected'); 649 checkboxParent.addClass('active'); 650 checkboxParent.find('path').css('fill', '#82aa3b'); 651 } 652 else { 653 $(this).removeAttr('checked'); 654 $(this).removeClass('ct-cookie-item-selected'); 655 checkboxParent.removeClass('active'); 656 checkboxParent.find('path').css('fill', '#595959'); 657 } 658 }); 659 660 $('.ct-ultimate-gdpr-cookie-modal-single').on('change',function(){ 661 setTimeout(function(){ 662 displayItalianDescription(); 663 },0) 664 }); 665 666 /* HIDE DETAILS BUTTON */ 667 $('.hide-btn').on('click', function () { 668 669 var infoBox = $('.ct-ultimate-gdpr-cookie-modal-slider-wrap'); 670 var hideBtnI = jQuery(this).find('span'); 671 if (infoBox.is(':hidden')) { 672 hideBtnI.removeClass('fa-chevron-down'); 673 hideBtnI.addClass('fa-chevron-up'); 674 } else { 675 hideBtnI.removeClass('fa-chevron-up'); 676 hideBtnI.addClass('fa-chevron-down'); 677 } 678 infoBox.slideToggle(); 679 }); 680 681 // MAKE LEFT PANEL OF COOKIE MODAL POPUP INFO BOX IN COMPACT SKINS CLICKABLE 682 $('.cookie-modal-tab-wrapper li').on('click', function () { 683 var $this = jQuery(this); 684 var cookieType = ''; 685 if ($this.hasClass('cookie0')) { 686 cookieType = 'cookie0'; 687 } else if ($this.hasClass('cookie1')) { 688 cookieType = 'cookie1'; 689 } else if ($this.hasClass('cookie2')) { 690 cookieType = 'cookie2'; 691 } else if ($this.hasClass('cookie3')) { 692 cookieType = 'cookie3'; 693 } else if ($this.hasClass('cookie4')) { 694 cookieType = 'cookie4'; 695 } 696 var formCookieType = jQuery('#ct-ultimate-gdpr-cookie-modal-slider-form').find('#' + cookieType); 697 formCookieType.parent().click(); 698 }); 699 700 if ($("#ct-ultimate-gdpr-cookie-popup").hasClass("ct-ultimate-gdpr-cookie-topPanel")) { 701 if (!ct_ultimate_gdpr_cookie.consent) { 702 $('body').addClass("ct-ultimate-gdpr-cookie-topPanel-padding"); 703 } 704 } 705 706 if ($("#ct-ultimate-gdpr-cookie-popup").hasClass("ct-ultimate-gdpr-cookie-bottomPanel")) { 707 if (!ct_ultimate_gdpr_cookie.consent) { 708 $('body').addClass("ct-ultimate-gdpr-cookie-bottomPanel-padding"); 709 } 710 } 711 712 if ($("#ct-ultimate-gdpr-cookie-popup").hasClass("ct-ultimate-gdpr-cookie-topPanel ct-ultimate-gdpr-cookie-popup-modern")) { 713 $('body').addClass("popup-modern-style"); 714 } 715 716 if ($("#ct-ultimate-gdpr-cookie-popup").hasClass("ct-ultimate-gdpr-cookie-bottomPanel ct-ultimate-gdpr-cookie-popup-modern")) { 717 $('body').addClass("popup-modern-style"); 718 } 719 720 $(window).on('load resize', function() {
721 var cookiePopupHeight = $('#ct-ultimate-gdpr-cookie-popup').outerHeight(); 722 723 $('.ct-ultimate-gdpr-cookie-bottomPanel-padding').css('padding-bottom', cookiePopupHeight); 724 }); 725 726 function displayItalianDescription(){ 727 var blockAll = $('#cookie0'); 728 var essentials = $('#cookie5'); 729 var functionality = $('#cookie6'); 730 var analytics = $('#cookie7'); 731 var advertising = $('#cookie8'); 732 var descriptions = $('.ct-ultimate-gdpr-cookie-modal-single-wrap__inner--info'); 733 734 if(essentials.prop('checked')) { 735 descriptions.find('#desc-left li.essentials').show(); 736 descriptions.find('#desc-right li.essentials').hide(); 737 } else { 738 descriptions.find('#desc-right li.essentials').show(); 739 descriptions.find('#desc-left li.essentials').hide(); 740 741 } 742 if(functionality.prop('checked')) { 743 descriptions.find('#desc-left li.functionality').show(); 744 descriptions.find('#desc-right li.functionality').hide(); 745 } else { 746 descriptions.find('#desc-right li.functionality').show(); 747 descriptions.find('#desc-left li.functionality').hide(); 748 749 } 750 751 if(analytics.prop('checked')) { 752 descriptions.find('#desc-left li.analytics').show(); 753 descriptions.find('#desc-right li.analytics').hide(); 754 } else { 755 descriptions.find('#desc-right li.analytics').show(); 756 descriptions.find('#desc-left li.analytics').hide(); 757 758 } 759 760 if(advertising.prop('checked')) { 761 descriptions.find('#desc-left li.advertising').show(); 762 descriptions.find('#desc-right li.advertising').hide(); 763 } else { 764 descriptions.find('#desc-right li.advertising').show(); 765 descriptions.find('#desc-left li.advertising').hide(); 766 } 767 768 if(blockAll.prop('checked')) { 769 descriptions.find('#desc-left').find('li').hide(); 770 descriptions.find('#desc-right').find('li').show(); 771 descriptions.find('#desc-left li.block-all').show(); 772 descriptions.find('#desc-right li.block-all').hide(); 773 } else { 774 descriptions.find('#desc-right li.block-all').show(); 775 descriptions.find('#desc-left li.block-all').hide(); 776 } 777 778 } 779 780 $(document).on('ct-age-clicked', maybeShowPopup); 781 maybeShowPopup(); 782 displayItalianDescription(); 783 alwaysDisplayCookie(); 784 resetCookieConsent(); 785 786 // w_code 787 var className = $('#ct-ultimate-gdpr-cookie-popup').attr('data-class'); 788 $('#klaro').addClass(className); 789 // end of w_code 790 });
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.