This commit is contained in:
pacnpal
2024-10-29 23:11:55 -04:00
parent 708986e4c4
commit 298e2a80cb
20 changed files with 175 additions and 153 deletions

View File

@@ -8,17 +8,15 @@
id="turnstile-widget"
class="cf-turnstile"
data-sitekey="{{ site_key }}"
data-theme="dark"
></div>
</div>
<script>
// Apply theme to the Turnstile widget based on system preference
// Apply theme to the Turnstile widget based on the retrieved theme
document.addEventListener("DOMContentLoaded", function () {
const turnstileWidget = document.getElementById("turnstile-widget");
if (turnstileWidget) {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
turnstileWidget.setAttribute("data-theme", prefersDark ? "dark" : "light");
turnstileWidget.setAttribute("data-theme", theme);
}
});
</script>