https://cdn.top5credits.com/wp-content/plugins/draivi-cookies/js/draivi_cookies.js?ver=1.4&cdn=1.1.2
1/* 2File Name: draivi_cookies.js 3Description: Cookies functionality file for Draivi Plugin. 4*/ 5 6jQuery(document).ready(function() { 7 8 // Fetch a fresh nonce from the server (bypasses CDN cache) then POST consent to the AJAX handler. 9 // Banner is hidden immediately for instant UX; server submission happens in background. 10 function draiviSubmitConsent(consentState, payload) { 11 ConsentManager.instance().update_state(consentState); 12 jQuery('.cookie-container').hide(); 13 jQuery('body').css('overflow', 'auto'); 14 15 jQuery.ajax({ 16 url : draiviCookies.ajaxurl, 17 type : 'post', 18 data : { 19 action : 'draivi_cookies_sub', 20 payload : payload, 21 } 22 }); 23 } 24 25 // Soft banner â notice-only, grant all consents immediately on page load 26 if (jQuery('#cookie-soft-banner').length) { 27 ConsentManager.instance().update_state( 28 { necessary: 'granted', marketing: 'granted', preferences: 'granted', analytics: 'granted' } 29 ); 30 jQuery('#cookie-soft-banner').show(); 31 jQuery('#soft-banner-accept').on('click', function() { 32 draiviSubmitConsent( 33 { necessary: 'granted', marketing: 'granted', preferences: 'granted', analytics: 'granted' }, 34 { source: 'accept_all_cookies' } 35 ); 36 jQuery('#cookie-soft-banner').hide(); 37 }); 38 return; 39 } 40 41 // Open modal (settings-mode) on cookie settings page button click 42 if (jQuery('#settings-page-button').length) { 43 jQuery('#settings-page-button').click(function() { 44 jQuery('#cookie-container').css({ 'display': 'block', 'pointer-events': 'auto' }); 45 jQuery('body').css('overflow', 'hidden'); 46 jQuery('#settings-container').fadeIn(); 47 jQuery('.cookie-content').css({ 'display': 'none' }); 48 }); 49 } 50 51 // Open modal automatically on all pages, except the cookie settings page 52 if ( 53 jQuery('#cookie-container').length && 54 jQuery('#cookie-container').attr('cookie-page') !== "1" 55 ) { 56 jQuery('#cookie-container').css({ 'display': 'block', 'pointer-events': 'auto' }); 57 jQuery('body').css('overflow', 'hidden'); 58 } 59 60 // Show detailed settings on settings button click 61 if (jQuery('.settings-button').length) { 62 jQuery('.settings-button').click(function() { 63 jQuery('#cookie-container').css({ 'display': 'block', 'pointer-events': 'auto' }); 64 jQuery('body').css('overflow', 'hidden'); 65 jQuery('#settings-container').fadeIn(); 66 jQuery('.cookie-content').css({ 'display': 'none' }); 67 }); 68 } 69 70 // Necessary checkbox is always locked on 71 jQuery('.cookie-item:has(p:contains("Necessary")) input[type="checkbox"]').on('change', function() { 72 if (!this.checked) { this.checked = true; } 73 }); 74 75 // Toggle checkboxes on row click 76 jQuery('#marketing-checkbox-container, #preferences-checkbox-container, #analytics-checkbox-container').click(function() { 77 let checkbox = jQuery(this).find('input[type="checkbox"]'); 78 checkbox.prop('checked', !checkbox.prop('checked')); 79 }); 80 81 // Accept all 82 if (jQuery('.accept-button').length) { 83 jQuery('.accept-button').on('click', function() { 84 draiviSubmitConsent( 85 { necessary: 'granted', marketing: 'granted', preferences: 'granted', analytics: 'granted' }, 86 { source: 'accept_all_cookies' } 87 ); 88 }); 89 } 90 91 // Decline all 92 if (jQuery('.decline-button').length) { 93 jQuery('.decline-button').on('click', function() { 94 draiviSubmitConsent( 95 { necessary: 'granted', marketing: 'denied', preferences: 'denied', analytics: 'denied' }, 96 { source: 'decline_all_cookies' } 97 ); 98 }); 99 } 100 101 // Save selection 102 if (jQuery('#save').length) { 103 jQuery('#save').on('click', function() { 104 const consents = { 105 necessary : true, 106 marketing : jQuery('#marketing-checkbox').is(':checked'), 107 preferences: jQuery('#preferences-checkbox').is(':checked'), 108 analytics : jQuery('#analytics-checkbox').is(':checked'), 109 }; 110 draiviSubmitConsent( 111 { 112 necessary : 'granted', 113 marketing : consents.marketing ? 'granted' : 'denied', 114 preferences: consents.preferences ? 'granted' : 'denied', 115 analytics : consents.analytics ? 'granted' : 'denied', 116 }, 117 { 118 source : 'save_cookie_settings', 119 marketing : consents.marketing ? '1' : '0', 120 preferences: consents.preferences ? '1' : '0', 121 analytics : consents.analytics ? '1' : '0', 122 } 123 ); 124 }); 125 } 126 127});
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.