Template:18PlusDisclaimer: Difference between revisions
Template page
More actions
Created page with "<templatestyles src="Template:18PlusDisclaimer/styles.css" /> {{#tag:html| <div id="ageDisclaimerOverlay" class="age-overlay"> <div class="age-popup"> <h2>18+ Content Warning</h2> <p>This page may contain content intended for mature audiences only.<br>Please confirm that you are 18 years of age or older.</p> <div class="btn-group"> <button id="acceptDisclaimer">I am 18 or older</button> <button id="declineDisclaimer">Leave this page</button>..." |
No edit summary |
||
| Line 3: | Line 3: | ||
{{#tag:html| | {{#tag:html| | ||
<div id="ageDisclaimerOverlay" class="age-overlay"> | <div id="ageDisclaimerOverlay" class="age-overlay"> | ||
<div class="age-popup"> | <div class="age-blur"></div> | ||
<div class="age-popup slide-down"> | |||
<h2>18+ Content Warning</h2> | <h2>18+ Content Warning</h2> | ||
<p>This page may contain content intended for mature audiences only.<br>Please confirm that you are 18 years of age or older.</p> | <p>This page may contain content intended for mature audiences only.<br>Please confirm that you are 18 years of age or older.</p> | ||
| Line 27: | Line 28: | ||
document.addEventListener("DOMContentLoaded", function () { | document.addEventListener("DOMContentLoaded", function () { | ||
const overlay = document.getElementById("ageDisclaimerOverlay"); | |||
const body = document.body; | |||
if (getCookie("ageConfirmed") !== "true") { | if (getCookie("ageConfirmed") !== "true") { | ||
document. | overlay.style.display = "flex"; | ||
body.style.overflow = "hidden"; | |||
requestAnimationFrame(() => { | |||
document.querySelector(".age-popup").classList.add("slide-active"); | |||
}); | |||
} | } | ||
document.getElementById("acceptDisclaimer").addEventListener("click", function () { | document.getElementById("acceptDisclaimer").addEventListener("click", function () { | ||
setCookie("ageConfirmed", "true", 30); | setCookie("ageConfirmed", "true", 30); | ||
overlay.style.display = "none"; | |||
body.style.overflow = ""; | |||
}); | }); | ||
document.getElementById("declineDisclaimer").addEventListener("click", function () { | document.getElementById("declineDisclaimer").addEventListener("click", function () { | ||
window.location.href = "/wiki/Main_Page"; // | window.location.href = "/wiki/Main_Page"; // Customize if needed | ||
}); | }); | ||
}); | }); | ||
</script> | </script> | ||
}} | }} | ||
Revision as of 13:26, 18 April 2025