PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.3.2
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.3.2
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 / settings-page.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 2 years ago support-page.js 3 years ago
settings-page.js
159 lines
1 /**
2 * Load init function when the page is ready
3 *
4 * @since 1.8.0
5 */
6 jQuery( document ).ready( init );
7
8 function init() {
9 language_toggle();
10 advanced_settings_toggle();
11 cookie_blocking_mode();
12 activeSettingsTab();
13 closeSubmitMsg();
14 submitEnable();
15 googleConsentModeOptions();
16 tcfOptions();
17 }
18
19 function language_toggle() {
20 jQuery( '#show_add_language_guide' ).on( 'click', function ( e ) {
21 e.preventDefault()
22 jQuery( '#add_language_guide' ).slideDown()
23 jQuery( this ).hide()
24 } )
25 jQuery( '#hide_add_language_guide' ).on( 'click', function ( e ) {
26 e.preventDefault()
27 jQuery( '#add_language_guide' ).slideUp()
28 jQuery( '#show_add_language_guide' ).show()
29 } )
30
31 jQuery( '#cookiebot-language' ).on( 'change', function () {
32 if ( this.value === '' ) {
33 jQuery( '#info_lang_autodetect' ).show()
34 jQuery( '#info_lang_specified' ).hide()
35 } else {
36 jQuery( '#info_lang_autodetect' ).hide()
37 jQuery( '#info_lang_specified' ).show()
38 }
39 } )
40 }
41
42 function advanced_settings_toggle() {
43 jQuery( '.cookiebot_fieldset_header' ).on( 'click', function ( e ) {
44 e.preventDefault()
45 jQuery( this ).next().slideToggle()
46 jQuery( this ).toggleClass( 'active' )
47 } )
48 }
49
50 function cookie_blocking_mode() {
51 let cookieBlockingMode = cookiebot_settings.cookieBlockingMode;
52
53 jQuery( 'input[type=radio][name=cookiebot-cookie-blocking-mode]' ).on( 'change', function () {
54 if ( this.value === 'auto' && cookieBlockingMode !== this.value ) {
55 jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 );
56 jQuery( '#declaration-tag, #cookie-popup, #gcm-cookie-categories, #gtm-cookie-categories').addClass('disabled__item');
57 jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true );
58 jQuery( '#cb-settings__gtm__cookie-types input[type=checkbox]' ).prop( 'disabled', true );
59 jQuery( '#cb-settings__gcm__cookie-types input[type=checkbox]' ).prop( 'disabled', true );
60 }
61 if ( this.value === 'manual' && cookieBlockingMode !== this.value ) {
62 jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 1 );
63 jQuery( '#declaration-tag, #cookie-popup, #gcm-cookie-categories, #gtm-cookie-categories').removeClass('disabled__item');
64 jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', false );
65 jQuery( '#cb-settings__gtm__cookie-types input[type=checkbox]' ).prop( 'disabled', false );
66 jQuery( '#cb-settings__gcm__cookie-types input[type=checkbox]' ).prop( 'disabled', false );
67 }
68 cookieBlockingMode = this.value;
69 } )
70 if ( cookieBlockingMode === 'auto' ) {
71 jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 );
72 jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true );
73 jQuery( '#cb-settings__gtm__cookie-types input[type=checkbox]' ).prop( 'disabled', true );
74 jQuery( '#cb-settings__gcm__cookie-types input[type=checkbox]' ).prop( 'disabled', true );
75 }
76 }
77
78 function activeSettingsTab() {
79 jQuery('.cb-settings__tabs__item').on('click', function(){
80 let currentTab = jQuery('.cb-settings__tabs__item.active-item').data('tab');
81 let tab = jQuery(this).data('tab');
82 let tabSelector = '#'+tab;
83 jQuery('.cb-settings__tabs__item.active-item, .cb-settings__tabs__content--item.active-item').removeClass('active-item');
84 jQuery(this).addClass('active-item');
85 jQuery(tabSelector).addClass('active-item');
86
87 window.history.replaceState(null, null, '?page=cookiebot_settings&tab='+tab );
88 let referrer = jQuery('input[name="_wp_http_referer"]');
89 let referrerVal = referrer.val();
90 if(referrerVal.indexOf('tab=')!==-1) {
91 referrerVal = referrerVal.replace(currentTab,tab);
92 }else{
93 referrerVal += '&tab=' + tab;
94 }
95 referrer.val(referrerVal);
96 });
97 }
98
99 function closeSubmitMsg() {
100 jQuery('.cb-submit__msg').on('click',function(){
101 jQuery(this).addClass('hidden');
102 });
103 }
104
105 function submitEnable() {
106 const initialValues = jQuery('form').serialize();
107 const events = {
108 change: 'input:not([type=text]), select',
109 input: 'input[type="text"], textarea'
110 };
111
112 Object.entries(events).forEach(entry => {
113 const [eventName, elements] = entry;
114 jQuery(document).on(eventName,elements,{initialValues: initialValues},function(event){
115 checkValues(event.data.initialValues)
116 });
117 });
118 }
119
120 function checkValues(initialValues){
121 let submitBtn = jQuery('p.submit #submit');
122 let newValues = jQuery('form').serialize();
123 if(newValues !== initialValues) {
124 submitBtn.addClass('enabled');
125 }else{
126 submitBtn.removeClass('enabled');
127 }
128 }
129
130 function googleConsentModeOptions() {
131 jQuery('input#gcm').on('change', function () {
132 const parent = jQuery(this).parents('#consent-mode');
133 parent.find('.cb-settings__config__item:has(input#gcm-url-pasthrough)').toggle();
134 parent.find('.cb-settings__config__item:has(ul#cb-settings__gcm__cookie-types)').toggle();
135 const passthroughInput = jQuery('input#gcm-url-pasthrough');
136 const passthroughLabel = passthroughInput.parents('label.switch-checkbox')[0];
137 if (!passthroughLabel || !passthroughLabel.childNodes.length)
138 return;
139 passthroughLabel.childNodes[passthroughLabel.childNodes.length - 1].textContent = 'URL passthrough' + ' ' +
140 (passthroughInput.is(':checked') ? 'enabled' : 'disabled');
141 });
142 jQuery('input#gcm, input#gcm-url-pasthrough').on('change', function () {
143 const input = jQuery(this);
144 const label = input.parents('label.switch-checkbox')[0];
145 if (!label || !label.childNodes.length)
146 return;
147 label.childNodes[label.childNodes.length - 1].textContent = (
148 (input.attr('id') === 'gcm' ? 'Google Consent Mode' : 'URL passthrough') + ' ' +
149 (input.is(':checked') ? 'enabled' : 'disabled')
150 );
151 });
152 }
153
154 function tcfOptions() {
155 jQuery('input#cookiebot-iab').on('change', function () {
156 const parent = jQuery(this).parents('#iab');
157 parent.find('.cb-settings__config__item:has(input.tcf-option)').toggle();
158 });
159 }