PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.2.13
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.2.13
4.7.2 4.7.1 trunk 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 3.0.0 3.0.1 3.1.0 3.10.0 3.10.1 3.11.1 3.11.2 3.11.3 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.5 3.6.6 3.7.0 3.7.1 3.8.0 3.9.0 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.2.0 4.2.1 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.3.10 4.3.11 4.3.12 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.7.1 4.3.8 4.3.9 4.3.9.1 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.7.0
cookiebot / assets / js / backend / cookiebot-admin-script.js
cookiebot / assets / js / backend Last commit date
gutenberg 3 years ago cookiebot-admin-script.js 3 years ago debug-page.js 3 years ago jquery.tipTip.js 3 years ago multiple-page.js 3 years ago network-settings-page.js 3 years ago prior-consent-settings.js 3 years ago settings-page.js 3 years ago support-page.js 3 years ago
cookiebot-admin-script.js
101 lines
1 /**
2 * Load init function when the page is ready
3 *
4 * @since 4.2.10
5 */
6 jQuery( document ).ready( cbInit );
7
8 function cbInit() {
9 jQuery( document ).on( 'click', 'tr[data-slug="cookiebot"] .cb-deactivate-action', event => deactivateCookiebot( event ) );
10 jQuery( document ).on( 'click', '#cb-review__close', event => closeSurveyPopup( event ) );
11 jQuery( document ).on( 'submit', '#cb-review__form', event => submitSurveyPopup( event ) );
12 jQuery( document ).on( 'change', 'input[name="cookiebot-review-option"]', event => showOptionalConsent( event ) )
13 }
14
15 /**
16 * Displays popup form.
17 */
18 function deactivateCookiebot( e ) {
19 e.preventDefault();
20
21 let deactivationLink = e.target.href;
22
23 jQuery( '#cb-review__skip' ).attr( 'href', deactivationLink );
24 jQuery( '.cookiebot-popup-container' ).addClass( 'cb-opened' );
25 }
26
27 /**
28 * Close popup form.
29 */
30
31 function closeSurveyPopup(e) {
32 const popup = jQuery(e.target).closest('.cookiebot-popup-container');
33 popup.removeClass('cb-opened');
34 jQuery('#cb-review__alert').removeClass('show-alert');
35 document.getElementById('cb-review__form').reset();
36 }
37
38 /**
39 * Shows optional consent.
40 */
41
42 function showOptionalConsent(e) {
43 const option = e.target.value;
44 const optionalConsentBox = jQuery('.consent-item');
45 const optionalConsent = jQuery('#cb-review__debug-reason');
46
47 if(option!=='7'){
48 optionalConsentBox.removeClass('show-consent');
49 if(optionalConsent.checked){
50 optionalConsent.checked = false;
51 }
52 }else{
53 optionalConsentBox.addClass('show-consent');
54 }
55 }
56
57 /**
58 * Popup submit
59 */
60 function submitSurveyPopup(e){
61 e.preventDefault();
62 const deactivateLink = jQuery( '#cb-review__skip' ).attr( 'href' );
63 const button = jQuery('#cb-review__submit', '#cb-review__form');
64 if (button.hasClass('disabled')) {
65 return;
66 }
67 const option = jQuery('input[type="radio"]:checked', '#cb-review__form');
68 if(0 === option.length){
69 jQuery('#cb-review__alert').addClass('show-alert');
70 return;
71 }
72 const otherReason = jQuery('#cb-review__other-description');
73 const debugReason = jQuery('#cb-review__debug-reason');
74 jQuery.ajax({
75 url: cb_ajax.ajax_url,
76 type: 'POST',
77 data: {
78 action: 'cb_submit_survey',
79 reason_id: (0 === option.length) ? null : option.val(),
80 reason_text: (0 === option.length) ? 'none' : option.closest('label').text(),
81 reason_info: (0 !== otherReason.length) ? otherReason.val().trim() : '',
82 reason_debug: (!debugReason) ? null : debugReason.val(),
83 survey_nonce: cb_ajax.survey_nonce,
84 survey_check: 'ODUwODA1'
85 },
86 beforeSend: function() {
87 button.addClass('disabled');
88 },
89 complete: function(response) {
90 const code = JSON.parse(response.responseText).code;
91 const msg = JSON.parse(response.responseText).data;
92
93 if(code===400||code===401){
94 jQuery('#cb-review__alert').text(msg).addClass('show-alert');
95 button.removeClass('disabled');
96 }else{
97 window.location.href = deactivateLink;
98 }
99 }
100 });
101 }