PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.2.4
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.2.4
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 4 years ago debug-page.js 4 years ago jquery.tipTip.js 4 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
settings-page.js
143 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 googleConsentModeUrlPassthrough();
16 }
17
18 function language_toggle() {
19 jQuery( '#show_add_language_guide' ).on( 'click', function ( e ) {
20 e.preventDefault()
21 jQuery( '#add_language_guide' ).slideDown()
22 jQuery( this ).hide()
23 } )
24 jQuery( '#hide_add_language_guide' ).on( 'click', function ( e ) {
25 e.preventDefault()
26 jQuery( '#add_language_guide' ).slideUp()
27 jQuery( '#show_add_language_guide' ).show()
28 } )
29
30 jQuery( '#cookiebot-language' ).on( 'change', function () {
31 if ( this.value === '' ) {
32 jQuery( '#info_lang_autodetect' ).show()
33 jQuery( '#info_lang_specified' ).hide()
34 } else {
35 jQuery( '#info_lang_autodetect' ).hide()
36 jQuery( '#info_lang_specified' ).show()
37 }
38 } )
39 }
40
41 function advanced_settings_toggle() {
42 jQuery( '.cookiebot_fieldset_header' ).on( 'click', function ( e ) {
43 e.preventDefault()
44 jQuery( this ).next().slideToggle()
45 jQuery( this ).toggleClass( 'active' )
46 } )
47 }
48
49 function resetConsentMapping() {
50 if ( confirm( 'Are you sure you want to reset to default consent mapping?' ) ) {
51 jQuery( '.consent_mapping_table input[type=checkbox]' ).each( function () {
52 if ( !this.disabled ) {
53 this.checked = ( jQuery( this ).data( 'default-value' ) === '1' )
54 }
55 } )
56 }
57 return false
58 }
59
60 function cookie_blocking_mode() {
61 var cookieBlockingMode = cookiebot_settings.cookieBlockingMode;
62
63 jQuery( 'input[type=radio][name=cookiebot-cookie-blocking-mode]' ).on( 'change', function () {
64 if ( this.value === 'auto' && cookieBlockingMode !== this.value ) {
65 jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 );
66 jQuery( '#declaration-tag, #cookie-popup').addClass('disabled__item');
67 jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true )
68 }
69 if ( this.value === 'manual' && cookieBlockingMode !== this.value ) {
70 jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 1 );
71 jQuery( '#declaration-tag, #cookie-popup').removeClass('disabled__item');
72 jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', false )
73 }
74 cookieBlockingMode = this.value
75 } )
76 if ( cookieBlockingMode === 'auto' ) {
77 jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 )
78 jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true )
79 }
80 }
81
82 function activeSettingsTab() {
83 jQuery('.cb-settings__tabs__item').on('click', function(){
84 let currentTab = jQuery('.cb-settings__tabs__item.active-item').data('tab');
85 let tab = jQuery(this).data('tab');
86 let tabSelector = '#'+tab;
87 jQuery('.cb-settings__tabs__item.active-item, .cb-settings__tabs__content--item.active-item').removeClass('active-item');
88 jQuery(this).addClass('active-item');
89 jQuery(tabSelector).addClass('active-item');
90
91 window.history.replaceState(null, null, '?page=cookiebot_settings&tab='+tab );
92 let referrer = jQuery('input[name="_wp_http_referer"]');
93 let referrerVal = referrer.val();
94 if(referrerVal.indexOf('tab=')!==-1) {
95 referrerVal = referrerVal.replace(currentTab,tab);
96 }else{
97 referrerVal += '&tab=' + tab;
98 }
99 referrer.val(referrerVal);
100 });
101 }
102
103 function closeSubmitMsg() {
104 jQuery('.cb-submit__msg').on('click',function(){
105 jQuery(this).addClass('hidden');
106 });
107 }
108
109 function submitEnable() {
110 jQuery(':input').change(
111 function(){
112 jQuery('p.submit #submit').addClass('enabled');
113 }
114 );
115 }
116
117 function googleConsentModeUrlPassthrough() {
118 jQuery('input#gcm').on('change', function () {
119 jQuery(this)
120 .parents('#consent-mode')
121 .find('.cb-settings__config__item:has(input#gcm-url-pasthrough)')
122 .toggle(
123 jQuery(this)
124 .is(':checked')
125 )
126 const input = jQuery('input#gcm-url-pasthrough');
127 const label = input.parents('label.switch-checkbox')[0];
128 if (!label || !label.childNodes.length)
129 return;
130 label.childNodes[label.childNodes.length - 1].textContent = 'URL passthrough' + ' ' +
131 (input.is(':checked') ? 'enabled' : 'disabled');
132 });
133 jQuery('input#gcm, input#gcm-url-pasthrough').on('change', function () {
134 const input = jQuery(this);
135 const label = input.parents('label.switch-checkbox')[0];
136 if (!label || !label.childNodes.length)
137 return;
138 label.childNodes[label.childNodes.length - 1].textContent = (
139 (input.attr('id') === 'gcm' ? 'Google Consent Mode' : 'URL passthrough') + ' ' +
140 (input.is(':checked') ? 'enabled' : 'disabled')
141 );
142 });
143 }