PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.3.12
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.3.12
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 consent-mapping.js 2 years ago cookiebot-admin-script.js 2 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 1 year ago support-page.js 3 years ago
cookiebot-admin-script.js
179 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 hideSubmitMessage();
14 selectorListeners();
15 }
16
17 /**
18 * Displays popup form.
19 */
20 function deactivateCookiebot( e ) {
21 e.preventDefault();
22
23 let deactivationLink = e.target.href;
24
25 jQuery( '#cb-review__skip' ).attr( 'href', deactivationLink );
26 jQuery( '.cookiebot-popup-container' ).addClass( 'cb-opened' );
27 }
28
29 /**
30 * Close popup form.
31 */
32
33 function closeSurveyPopup(e) {
34 const popup = jQuery(e.target).closest('.cookiebot-popup-container');
35 popup.removeClass('cb-opened');
36 jQuery('#cb-review__alert').removeClass('show-alert');
37 document.getElementById('cb-review__form').reset();
38 }
39
40 /**
41 * Shows optional consent.
42 */
43
44 function showOptionalConsent(e) {
45 const option = e.target.value;
46 const optionalConsentBox = jQuery('.consent-item');
47 const optionalConsent = jQuery('#cb-review__debug-reason');
48
49 if(option!=='7'){
50 optionalConsentBox.removeClass('show-consent');
51 if(optionalConsent.checked){
52 optionalConsent.checked = false;
53 }
54 }else{
55 optionalConsentBox.addClass('show-consent');
56 }
57 }
58
59 /**
60 * Popup submit
61 */
62 function submitSurveyPopup(e){
63 e.preventDefault();
64 const deactivateLink = jQuery( '#cb-review__skip' ).attr( 'href' );
65 const button = jQuery('#cb-review__submit', '#cb-review__form');
66 if (button.hasClass('disabled')) {
67 return;
68 }
69 const option = jQuery('input[type="radio"]:checked', '#cb-review__form');
70 if(0 === option.length){
71 jQuery('#cb-review__alert').addClass('show-alert');
72 return;
73 }
74 const otherReason = jQuery('#cb-review__other-description');
75 const debugReason = jQuery('#cb-review__debug-reason');
76 jQuery.ajax({
77 url: cb_ajax.ajax_url,
78 type: 'POST',
79 data: {
80 action: 'cb_submit_survey',
81 reason_id: (0 === option.length) ? null : option.val(),
82 reason_text: (0 === option.length) ? 'none' : option.closest('label').text(),
83 reason_info: (0 !== otherReason.length) ? otherReason.val().trim() : '',
84 reason_debug: (!debugReason) ? null : debugReason.val(),
85 survey_nonce: cb_ajax.survey_nonce,
86 survey_check: 'ODUwODA1'
87 },
88 beforeSend: function() {
89 button.addClass('disabled');
90 },
91 complete: function(response) {
92 const code = JSON.parse(response.responseText).code;
93 const msg = JSON.parse(response.responseText).data;
94
95 if(code===400||code===401){
96 jQuery('#cb-review__alert').text(msg).addClass('show-alert');
97 button.removeClass('disabled');
98 }else{
99 window.location.href = deactivateLink;
100 }
101 }
102 });
103 }
104
105 function hideSubmitMessage(){
106 let submitMsg = jQuery('.cb-submit__msg');
107 if(submitMsg){
108 setTimeout(function(){
109 submitMsg.fadeOut();
110 },2000)
111 }
112 }
113
114 function selectorListeners(){
115 openItemList();
116 closeitemList();
117 selectListItem();
118 searchListItem();
119 }
120
121 function openItemList() {
122 jQuery(document).on('click','.cb-settings__selector__container .cb-settings__selector-selector',function(){
123 jQuery('.cb-settings__selector-list-container').addClass('hidden');
124 jQuery(this).siblings('.cb-settings__selector-list-container').removeClass('hidden');
125 });
126 }
127
128 function closeitemList() {
129 jQuery(document).on('click','.cb-settings__selector__container .cb-settings__selector-veil',function(){
130 jQuery(this).parent('.cb-settings__selector-list-container').addClass('hidden');
131 jQuery(this).siblings('.cb-settings__selector-search').val('').trigger('keyup');
132 jQuery(this).siblings('.cb-settings__selector-list').scrollTop(0);
133 });
134 }
135
136 function selectListItem() {
137 jQuery(document).on('click','.cb-settings__selector__container .cb-settings__selector-list-item',function(){
138 const item = jQuery(this);
139 const mainParent = item.closest('.cb-settings__selector__container');
140 const itemList = item.parent('.cb-settings__selector-list');
141 const itemValue = item.data('value');
142 const itemAttr = 'cookiebot-tcf-disallowed['+itemValue+']';
143 const itemName = item.text();
144
145 if(!itemList.data('multiple')){
146 itemList.find('.selected').removeClass('selected');
147 }
148
149 item.addClass('selected');
150 mainParent.find('.cb-settings__selector-selector').text(itemName);
151 mainParent.find('.cb-settings__selector__container-input').val(itemValue).attr('name',itemAttr).trigger('change');
152 mainParent.find('.cb-settings__selector-search').val('').trigger('keyup');
153 itemList.scrollTop(0);
154
155 item.closest('.cb-settings__selector-list-container').addClass('hidden');
156 });
157 }
158
159 function searchListItem() {
160 jQuery(document).on('keyup','.cb-settings__selector-search',function(){
161 const searchName = jQuery(this).val().toLowerCase();
162 const itemList = jQuery(this).siblings('.search-list');
163
164 itemList.children().each(function(){
165 const item = jQuery(this);
166 if(searchName.length>0) {
167 const itemName = item.text().trim().toLowerCase();
168 if(itemName.indexOf(searchName) != -1){
169 item.removeClass('hidden');
170 }else{
171 item.addClass('hidden');
172 }
173 }else{
174 item.removeClass('hidden');
175 }
176 });
177
178 });
179 }