Erome auto-pass age gate

Automatically clears the Erome 18+ disclaimer when it appears

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

Advertisement:

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

Advertisement:

// ==UserScript==
// @name         Erome auto-pass age gate
// @namespace    https://github.com/danmaclann/
// @license      MIT
// @author       danmaclann
// @version      1.0
// @description  Automatically clears the Erome 18+ disclaimer when it appears
// @match        https://www.erome.com/*
// @run-at       document-idle
// @grant        none
// @icon         https://www.erome.com/android-chrome-512x512.png
// ==/UserScript==

(function () {
    'use strict';

    function clearDisclaimer() {
        const disclaimer = document.getElementById('disclaimer');
        const enterBtn = document.querySelector('.enter');

        if (!disclaimer || !enterBtn) return;

        // Prevent repeated firing
        if (window.__eromeDisclaimerBypassed) return;
        window.__eromeDisclaimerBypassed = true;

        const csrf =
            document.querySelector('meta[name="csrf-token"]')?.content ||
            document.querySelector('input[name="_token"]')?.value ||
            getCookie('XSRF-TOKEN');

        fetch('/user/disclaimer', {
            method: 'POST',
            credentials: 'same-origin',
            headers: {
                'X-Requested-With': 'XMLHttpRequest',
                ...(csrf ? { 'X-CSRF-TOKEN': decodeURIComponent(csrf) } : {})
            }
        })
        .then(() => {
            disclaimer.remove();
            document.body.style.overflow = 'visible';
            location.reload();
        })
        .catch(() => {
            // Fallback: trigger the site's own click handler
            enterBtn.click();
        });
    }

    function getCookie(name) {
        const match = document.cookie.match(
            new RegExp('(?:^|; )' + name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '=([^;]*)')
        );
        return match ? match[1] : null;
    }

    clearDisclaimer();

    const observer = new MutationObserver(() => clearDisclaimer());
    observer.observe(document.documentElement, {
        childList: true,
        subtree: true
    });
})();