Bypass

Skips timers, removes ads, resolves safelinks, and auto-redirects on kimochi.info and ryuugames.com

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Bypass
// @namespace    Bypass
// @version      3.0
// @description  Skips timers, removes ads, resolves safelinks, and auto-redirects on kimochi.info and ryuugames.com
// @author       gdlbo
// @match        *://kimochi.info/download/*
// @match        *://*.ryuugames.com/processing/download*
// @match        *://*.ryuugames.com/*download*
// @match        *://www.ryuugames.com/wp-json/ryuu-safelink/v1/redirect/*
// @grant        GM_addStyle
// @run-at       document-start
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const origSetTimeout = window.setTimeout;
    const origSetInterval = window.setInterval;

    window.setTimeout = (fn, delay, ...args) => origSetTimeout(fn, delay && delay < 120000 ? 50 : delay, ...args);
    window.setInterval = (fn, delay, ...args) => origSetInterval(fn, delay && delay < 120000 ? 50 : delay, ...args);

    window.alert = () => {};
    window.confirm = () => true;
    window.prompt = () => null;
    if (window.Notification) {
        Notification.requestPermission = () => Promise.resolve('denied');
    }

    const adStyles = `
        #ryuu-sl-ad-banner, #ryuu-sl-ad-banner-2, #ryuu-sl-ad-button-1, #ryuu-sl-ad-button-2,
        #ryuu-sl-skyscraper-left, #ryuu-sl-skyscraper-right,
        [class*="ad-"], [id*="ad-"], [class*="_ad"], [id*="_ad"],
        .popup, .modal, .overlay, .ad-container, .ad-banner,
        iframe[src*="ads"], iframe[id*="google_ads"] {
            display: none !important;
            visibility: hidden !important;
            pointer-events: none !important;
            width: 0 !important;
            height: 0 !important;
        }
    `;
    if (typeof GM_addStyle !== 'undefined') {
        GM_addStyle(adStyles);
    } else {
        const style = document.createElement('style');
        style.textContent = adStyles;
        document.head.appendChild(style);
    }

    const blockPattern = /(adblock|adb|detectad|fuckadblock|disabledevtools)/i;
    const adObserver = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(node => {
                if (node.nodeType === 1 && (node.tagName === 'SCRIPT' || node.tagName === 'IFRAME')) {
                    const source = node.src || node.textContent || '';
                    if (blockPattern.test(source)) node.remove();
                }
            });
        });
    });
    adObserver.observe(document, { childList: true, subtree: true });

    function waitForElement(selector, timeout = 3000) {
        return new Promise(resolve => {
            const el = document.querySelector(selector);
            if (el) return resolve(el);
            const observer = new MutationObserver(() => {
                const target = document.querySelector(selector);
                if (target) {
                    observer.disconnect();
                    resolve(target);
                }
            });
            observer.observe(document.documentElement, { childList: true, subtree: true });
            if (timeout > 0) setTimeout(() => { observer.disconnect(); resolve(null); }, timeout);
        });
    }

    if (window.location.pathname.startsWith('/wp-json/ryuu-safelink/v1/redirect/')) {
        try {
            const text = document.body.textContent || document.querySelector('pre')?.textContent || '';
            const data = JSON.parse(text);
            const url = data?.url || data?.data?.url || data?.redirect || (data?.success && typeof data?.data === 'string' && data.data.startsWith('http') ? data.data : null);
            if (url) window.location.replace(url);
        } catch (e) {
            const match = (document.body.textContent || '').match(/https?:\/\/[^\s"']+/);
            if (match) window.location.replace(match[0]);
        }
        return;
    }

    async function handleRyuugames() {
        const btn = await waitForElement('#ryuu-sl-download-btn');
        if (!btn) return;

        btn.disabled = false;
        btn.classList.remove('ryuu-sl-disabled');
        btn.classList.add('ryuu-sl-ready');
        btn.style.display = 'block';
        btn.style.pointerEvents = 'auto';

        const btnText = document.getElementById('ryuu-sl-btn-text');
        const countdownEl = document.getElementById('ryuu-sl-countdown-number');
        const progressEl = document.getElementById('ryuu-sl-progress');

        if (btnText) btnText.textContent = 'Download';
        if (countdownEl) countdownEl.textContent = '0';
        if (progressEl) progressEl.style.strokeDashoffset = '0';

        setTimeout(() => {
            ['mouseover', 'mousedown', 'mouseup', 'click'].forEach(evt => {
                btn.dispatchEvent(new MouseEvent(evt, { bubbles: true, cancelable: true }));
            });
        }, 600);
    }

    async function handleKimochi() {
        const btn = await waitForElement('#downloadBtn');
        if (!btn) return;

        btn.style.display = 'block';
        btn.style.visibility = 'visible';
        btn.style.opacity = '1';
        btn.removeAttribute('disabled');
        btn.style.pointerEvents = 'auto';

        const hrefObserver = new MutationObserver(() => {
            if (btn.href && btn.href.startsWith('http')) {
                hrefObserver.disconnect();
                window.location.replace(btn.href);
            }
        });
        hrefObserver.observe(btn, { attributes: true, attributeFilter: ['href'] });

        if (btn.href && btn.href.startsWith('http')) {
            window.location.replace(btn.href);
        }
    }

    if (window.location.hostname.includes('ryuugames.com')) {
        handleRyuugames();
    } else if (window.location.hostname.includes('kimochi.info')) {
        handleKimochi();
    }
})();