PageSourceSearch

https://sunnyvaledentalgroup.com/wp-content/plugins/dmm-consent-guard/assets/js/banner.js?ver=0.2.7

js sunnyvaledentalgroup.com collected 2026-10-02 01:45:21 UTC 3,308 bytes, 93 lines download raw bytes

1(function (w, d) {
2	'use strict';
3
4	var api = w.dmmConsent;
5	var root = d.getElementById('dmm-cg');
6	if (!api || !root) { return; }
7
8	/* A z-index only competes inside its own stacking context. Any ancestor with a transform,
9	   a filter, will-change, contain or a non-auto opacity creates one, and page builders put
10	   those on section wrappers constantly — inside such a wrapper the panel is trapped below
11	   the wrapper's own neighbours no matter how high its z-index goes. Reparenting to <body>
12	   is the only fix that always works. Done as a move, so listeners and state survive. */
13	if (root.parentNode !== d.body) { d.body.appendChild(root); }
14
15	var badge = d.querySelector('.dmm-cg-open--badge');
16	if (badge && badge.parentNode !== d.body) { d.body.appendChild(badge); }
17
18	var cats = root.querySelector('.dmm-cg__cats');
19	var saveBtn = root.querySelector('[data-dmm-action="save"]');
20	var customizeBtn = root.querySelector('[data-dmm-action="customize"]');
21	var lastFocus = null;
22
23	function checked() {
24		var boxes = root.querySelectorAll('[data-dmm-cat-input]');
25		var out = [];
26		for (var i = 0; i < boxes.length; i++) {
27			if (boxes[i].checked) { out.push(boxes[i].value); }
28		}
29		return out;
30	}
31
32	function show() {
33		lastFocus = d.activeElement;
34		root.hidden = false;
35		d.documentElement.classList.add('dmm-cg-showing');
36		var first = root.querySelector('.dmm-cg__btn');
37		if (first) { first.focus(); }
38	}
39
40	function hide() {
41		root.hidden = true;
42		d.documentElement.classList.remove('dmm-cg-showing');
43		if (lastFocus && lastFocus.focus) { lastFocus.focus(); }
44	}
45
46	function expand() {
47		// Disclaimer mode renders a notice with one button and no category list. Reopening it
48		// is still meaningful — the visitor wants to reread the disclosure — so show, not throw.
49		if (!cats || !saveBtn || !customizeBtn) { return; }
50
51		cats.hidden = false;
52		saveBtn.hidden = false;
53		customizeBtn.hidden = true;
54
55		var current = api.get() || [];
56		var boxes = root.querySelectorAll('[data-dmm-cat-input]');
57		for (var i = 0; i < boxes.length; i++) {
58			boxes[i].checked = current.indexOf(boxes[i].value) > -1 && !(api.gpc && boxes[i].value === 'marketing');
59		}
60	}
61
62	root.addEventListener('click', function (ev) {
63		var btn = ev.target.closest ? ev.target.closest('[data-dmm-action]') : null;
64		if (!btn) { return; }
65
66		var action = btn.getAttribute('data-dmm-action');
67
68		if (action === 'customize') { expand(); return; }
69		if (action === 'acknowledge') { api.acknowledge(); hide(); return; }
70		if (action === 'accept') { api.acceptAll(); hide(); return; }
71		if (action === 'reject') { api.rejectAll(); hide(); return; }
72		if (action === 'save') { api.save(checked()); hide(); }
73	});
74
75	root.addEventListener('keydown', function (ev) {
76		if (ev.key === 'Escape' && api.get()) { hide(); }
77	});
78
79	/* <?php any .dmm-cg-open element or #cookie-settings link reopens the panel ?> */
80	d.addEventListener('click', function (ev) {
81		if (!ev.target.closest) { return; }
82		var trigger = ev.target.closest('.dmm-cg-open, a[href="#cookie-settings"], a[href$="#cookie-settings"]');
83		if (!trigger || root.contains(trigger)) { return; }
84
85		ev.preventDefault();
86		expand();
87		show();
88	});
89
90	d.addEventListener('dmm:open', function () { expand(); show(); });
91
92	if (!api.get()) { show(); }
93}(window, document));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.