Repository navigation
Expand file tree
/
Copy pathdebug.html
More file actions
76 lines (73 loc) · 3.94 KB
/
Copy pathdebug.html
File metadata and controls
76 lines (73 loc) · 3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Cookie Consent Example: Debug</title>
<link rel="stylesheet" href="./assets/docs.css">
<style>
body { margin: 0; font-family: Georgia, serif; background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%); color: #0f172a; }
main { max-width: 980px; margin: 0 auto; padding: 56px 20px 140px; }
h1 { margin: 0 0 16px; font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1; }
p, li { font-size: 1rem; line-height: 1.7; }
.panel { margin-top: 24px; padding: 20px; border-radius: 20px; background: rgba(255,255,255,0.82); border: 1px solid rgba(15,23,42,0.1); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; padding: 0.8rem 1rem; border-radius: 999px; border: 1px solid #0f172a; background: #fff; color: #0f172a; text-decoration: none; font-weight: 700; cursor: pointer; }
.chip.active { background: #0f172a; color: #f8fafc; }
pre { padding: 14px; overflow: auto; white-space: pre-wrap; background: rgba(15,23,42,0.08); border-radius: 12px; }
</style>
<script src="./assets/docs.js" defer></script>
<script>
window.CookieConsentConfig = {
debugMode: 1
};
</script>
<script src="./assets/docs-bootstrap.js"></script>
<script src="../cookie-consent.js"></script>
</head>
<body>
<main>
<h1>Debug</h1>
<div class="panel"><div class="docs-panel-header"><h2>What this example shows</h2><p class="docs-panel-note"><code>debugMode</code> is for development and testing. It forces a consent state so you can verify integrations without depending on manual banner choices during local work.</p></div><p>This page demonstrates the public <code>debugMode</code> configuration and the related debug status available through the API.</p></div>
<div class="panel"><h2>Code used in this example</h2><pre><code>window.CookieConsentConfig = {
debugMode: 1
};
function refreshDebug() {
const output = document.getElementById("debug-output");
if (!window.CookieConsent) {
output.textContent = "CookieConsent API is not available.";
return;
}
output.textContent = JSON.stringify({
debugMode: window.CookieConsent.getConsentDebugMode(),
status: window.CookieConsent.getStatus()
}, null, 2);
}</code></pre></div>
<div class="panel"><h2>How to verify it</h2><ul><li>This page sets <code>debugMode: 1</code>, which forces optional consent on for development testing.</li><li>Press refresh to inspect <code>getConsentDebugMode()</code> and <code>getStatus()</code>.</li><li>You should see <code>debugMode</code> reported as <code>1</code> and choices resolved as enabled.</li></ul><div class="actions"><a href="#" class="chip active" id="open-cookie-settings">Cookie settings</a><a href="#" class="chip" id="refresh-debug">Refresh debug output</a></div><pre id="debug-output">Press "Refresh debug output" to inspect the public debug surface.</pre></div>
</main>
<script>
function refreshDebug() {
const output = document.getElementById("debug-output");
if (!window.CookieConsent) {
output.textContent = "CookieConsent API is not available.";
return;
}
output.textContent = JSON.stringify({
debugMode: window.CookieConsent.getConsentDebugMode(),
status: window.CookieConsent.getStatus()
}, null, 2);
}
document.getElementById("open-cookie-settings").addEventListener("click", function(event) {
event.preventDefault();
if (window.CookieConsent && typeof window.CookieConsent.showSettings === "function") {
window.CookieConsent.showSettings();
}
});
document.getElementById("refresh-debug").addEventListener("click", function(event) {
event.preventDefault();
refreshDebug();
});
refreshDebug();
</script>
</body>
</html>