NSFW Warning Script


(function() {
  // Check localStorage for existing age verification
  const storedAge = localStorage.getItem('isOver18');
  
  // Redirect immediately if underage response is stored
  if (storedAge === 'false' && window.isNSFW === true) {
    window.location.href = 'https://yokarion.com/';
    return;
  }
  
  // Exit if age verification already passed
  if (storedAge === 'true') return;

  let checkInterval;
  const startChecking = () => {
    // Check every 2 seconds
    checkInterval = setInterval(() => {
      if (window.isNSFW === true) {
        clearInterval(checkInterval);
        createAgeGate();
      }
    }, 2000);
    
    // Initial immediate check
    if (window.isNSFW === true) {
      clearInterval(checkInterval);
      createAgeGate();
    }
  };

  function createAgeGate() {
    // Create semi-transparent blurred overlay
    const overlay = document.createElement('div');
    overlay.style.cssText = `
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.65);
      backdrop-filter: blur(50px);
      z-index: 10000;
    `;
    
    // Create age verification popup
    const popup = document.createElement('div');
    popup.style.cssText = `
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: white;
      padding: 30px;
      border-radius: 12px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
      z-index: 10001;
      text-align: center;
      min-width: 300px;
    `;
    
    popup.innerHTML = `
      <h2 style="margin-top: 0">Age Verification</h2>
      <p>This content is marked as NSFW. Are you 18 or older?</p>
      <div style="display: flex; gap: 10px; justify-content: center; margin-top: 20px">
        <button id="age-deny" style="font-size: 20px; padding: 8px 20px; background: #d83333; color: white; border: none; border-radius: 12px; cursor: pointer">
          No, I'm under 18
        </button>

        <button id="age-confirm" style="font-size: 20px; padding: 8px 20px; background: #973dff; color: white; border: none; border-radius: 12px; cursor: pointer">
          Yes, I'm 18+
        </button>

      </div>
    `;
    
    // Add elements to document
    document.body.appendChild(overlay);
    document.body.appendChild(popup);
    
    // Setup event handlers
    document.getElementById('age-confirm').addEventListener('click', () => {
      localStorage.setItem('isOver18', 'true');
      document.body.removeChild(overlay);
      document.body.removeChild(popup);
    });
    
    document.getElementById('age-deny').addEventListener('click', () => {
      localStorage.setItem('isOver18', 'false');
      window.location.href = 'https://yokarion.com/';
    });
  }

  // Start checking when DOM is ready
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', startChecking);
  } else {
    startChecking();
  }
})();

A script that allows you to check if the page contains NSFW. The easiest way.

How to use:

Insert this code inside of your <head></head>

<script>window.isNSFW = true;</script>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *