Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
The main server is currently down. We are running on a backup server, so editing and search functionality are temporarily disabled. Please check back in a few hours.

Template:18PlusDisclaimer: Difference between revisions

Template page
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
 
(11 intermediate revisions by the same user not shown)
Line 2: Line 2:


{{#tag:html|
{{#tag:html|
<div id="ageDisclaimerOverlay" class="age-overlay">
   <script src="https://www.gamebrew.org/images/misc/assets/js/Disclaimer.js"></script>
   <div class="age-popup">
  <script src="https://www.gamebrew.org/images/misc/assets/js/common.js"></script>
    <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>
    </div>
  </div>
</div>
 
<script>
  function setCookie(name, value, days) {
    const expires = new Date(Date.now() + days * 864e5).toUTCString();
    document.cookie = name + '=' + encodeURIComponent(value) + '; expires=' + expires + '; path=/';
  }
 
  function getCookie(name) {
    return document.cookie.split('; ').reduce((r, v) => {
      const parts = v.split('=');
      return parts[0] === name ? decodeURIComponent(parts[1]) : r
    }, '');
  }
 
  document.addEventListener("DOMContentLoaded", function () {
    if (getCookie("ageConfirmed") !== "true") {
      document.getElementById("ageDisclaimerOverlay").style.display = "flex";
    }
 
    document.getElementById("acceptDisclaimer").addEventListener("click", function () {
      setCookie("ageConfirmed", "true", 30);
      document.getElementById("ageDisclaimerOverlay").style.display = "none";
    });
 
    document.getElementById("declineDisclaimer").addEventListener("click", function () {
      window.location.href = "/wiki/Main_Page"; // Change to your preferred redirect page
    });
  });
</script>
}}
}}

Latest revision as of 11:58, 19 April 2025

Advertising: