PluginProbe ʕ •ᴥ•ʔ
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode / 4.5.2
Cookiebot by Usercentrics – Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode v4.5.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 / dashboard.js
cookiebot / assets / js / backend Last commit date
gutenberg 3 years ago account.js 1 year ago consent-mapping.js 1 year ago cookiebot-admin-script.js 1 year ago dashboard.js 1 year ago debug-page.js 1 year ago jquery.tipTip.js 3 years ago multiple-page.js 3 years ago network-settings-page.js 1 year ago prior-consent-settings.js 3 years ago settings-page.js 1 year ago support-page.js 3 years ago
dashboard.js
77 lines
1 jQuery(document).ready(function($) {
2 // Handle toggle functionality
3 function handleToggle(toggleId, action, value) {
4 const toggle = document.getElementById(toggleId);
5 if (!toggle) {
6 console.error(`Toggle element not found: ${toggleId}`);
7 return;
8 }
9
10 toggle.addEventListener('click', async function(event) {
11 const isEnabled = this.checked;
12 const badgeId = toggleId === 'cookiebot-banner-enabled' ? 'cookiebot-banner-badge' : `${toggleId}-badge`;
13 const badge = document.getElementById(badgeId);
14 if (!badge) {
15 console.error(`Badge element not found: ${badgeId}`);
16 }
17
18 console.log(`Toggle ${toggleId} clicked. New state:`, isEnabled);
19
20 try {
21 const response = await $.ajax({
22 url: cookiebot_account.ajax_url,
23 method: 'POST',
24 data: {
25 action: action,
26 nonce: cookiebot_account.nonce,
27 value: isEnabled ? value : '0'
28 }
29 });
30
31 console.log(`Toggle ${toggleId} response:`, response);
32
33 if (!response.success) {
34 throw new Error(response.data || `Failed to update ${toggleId} status`);
35 }
36
37 // Update badge status
38 if (badge) {
39 badge.className = `label-wrapper status-badge ${isEnabled ? 'active' : 'inactive'}`;
40 badge.querySelector('.label-2').textContent = isEnabled ? 'Active' : 'Inactive';
41 console.log(`Updated badge for ${toggleId}. New state:`, isEnabled ? 'active' : 'inactive');
42 }
43
44 if (cookiebot_account.debug) {
45 console.log(`${toggleId} toggle response:`, response);
46 }
47 } catch (error) {
48 console.error(`Failed to toggle ${toggleId}:`, error);
49 this.checked = !isEnabled;
50 // Revert badge status on error
51 if (badge) {
52 badge.className = `label-wrapper status-badge ${!isEnabled ? 'active' : 'inactive'}`;
53 badge.querySelector('.label-2').textContent = !isEnabled ? 'Active' : 'Inactive';
54 console.log(`Reverted badge for ${toggleId}. State:`, !isEnabled ? 'active' : 'inactive');
55 }
56 }
57 });
58 }
59
60 handleToggle('cookiebot-banner-enabled', 'cookiebot_set_banner_enabled', '1');
61 handleToggle('cookiebot-gcm', 'cookiebot_set_gcm_enabled', '1');
62
63 // Handle expand/collapse
64 const expandToggle = document.querySelector('.expand-toggle');
65 if (expandToggle) {
66 expandToggle.addEventListener('click', function() {
67 const expanded = this.getAttribute('aria-expanded') === 'true';
68 const targetId = this.getAttribute('aria-controls');
69 const targetSection = document.getElementById(targetId);
70 const arrowIcon = this.querySelector('.arrow-icon');
71
72 this.setAttribute('aria-expanded', !expanded);
73 targetSection.style.display = expanded ? 'none' : 'block';
74 arrowIcon.style.transform = expanded ? 'rotate(0deg)' : 'rotate(180deg)';
75 });
76 }
77 });