MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
(function () {
if (localStorage.getItem("ageVerified") === "yes") {
return;
}
var overlay = document.createElement("div");
overlay.style.position = "fixed";
overlay.style.top = "0";
overlay.style.left = "0";
overlay.style.width = "100%";
overlay.style.height = "100%";
overlay.style.background = "rgba(0,0,0,0.95)";
overlay.style.color = "white";
overlay.style.zIndex = "99999";
overlay.style.display = "flex";
overlay.style.alignItems = "center";
overlay.style.justifyContent = "center";
overlay.style.fontFamily = "Arial, sans-serif";
overlay.style.textAlign = "center";
overlay.innerHTML = `
<div style="max-width:500px;padding:30px;">
<h2>18+ Age Verification</h2>
<p>This website contains adult content.</p>
<p>You must be 18 years or older to enter.</p>
<button id="ageYes" style="padding:12px 25px;margin:10px;font-size:16px;cursor:pointer;">
I am 18+
</button>
<button id="ageNo" style="padding:12px 25px;margin:10px;font-size:16px;cursor:pointer;">
Leave
</button>
</div>
`;
document.body.appendChild(overlay);
document.getElementById("ageYes").onclick = function () {
localStorage.setItem("ageVerified", "yes");
overlay.remove();
};
document.getElementById("ageNo").onclick = function () {
window.location.href = "https://google.com";
};
})();