Shortlink_lalalot + Timer

Auto verification + auto scroll + auto wait timer + auto reload + Timer Accelerator (No Ad Blocking)

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Shortlink_lalalot + Timer
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Auto verification + auto scroll + auto wait timer + auto reload + Timer Accelerator (No Ad Blocking)
// @author       Cbuks
// @exclude      *://onlyfaucet.com/faucet/verify/*
// @match        *://law.ravellawfirm.com/*
// @match        *://lalaloot.com/*
// @match        *://*.lalaloot.com/*
// @match        *://*/*verifikasi*
// @match        *://*/*verify*
// @match        *://*/*continue*
// @match        *://shtu1787v1.lalaloot.com/*
// @match        *://shtu1787v2.lalaloot.com/*
// @match        *://shtu1787v3.lalaloot.com/*
// @match        *://patu1324v3.lalaloot.com/*
// @match        *://patu1324v2.lalaloot.com/*
// @match        *://patu1324v1.lalaloot.com/*
// @match        *://law.ravellawfirm.com/*
// @match        *://law2.ravellawfirm.com/*
// @match        *://jutu3563v1.lalaloot.com/*
// @match        *://jutu3563v2.lalaloot.com/*
// @match        *://jutu3563v3.lalaloot.com/*
// @match        *://jutu3563v4.lalaloot.com/*
// @match        *://jutu3563v5.lalaloot.com/*
// @match        *://onlyfaucet.com/*
// @license      Copyright Cbuks (2026)
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @grant        GM_xmlhttpRequest
// @grant        window.close
// @run-at       document-start
// ==/UserScript==

        /*
                   * Copyright (c) 2026 Cbuks . All rights reserved.
         */

(function() {
    'use strict';

    // ==================== REFERRAL VALIDATION ====================
    const REFERRAL_CODE = '101316';
    const REFERRAL_URL = 'https://onlyfaucet.com/?r=' + REFERRAL_CODE;
    const SCRIPT_VALID_KEY = 'script_validated_' + REFERRAL_CODE;
    const VALIDATION_EXPIRY = 24 * 60 * 60 * 1000; // 24 jam

    // Cek apakah domain saat ini adalah onlyfaucet.com
    const isOnlyFaucetDomain = window.location.hostname.includes('onlyfaucet.com');

    function checkReferralValidation() {
        // Jika bukan domain onlyfaucet, selalu return true (script tetap jalan)
        if (!isOnlyFaucetDomain) {
            return true;
        }

        const validationData = GM_getValue(SCRIPT_VALID_KEY, null);

        if (validationData) {
            try {
                const data = JSON.parse(validationData);
                const now = Date.now();

                if (data.validated && (now - data.timestamp) < VALIDATION_EXPIRY) {
                    console.log('[Bypass] ✓ Validasi referral berhasil - Script aktif');
                    return true;
                } else {
                    console.log('[Bypass] Validasi referral kadaluarsa - Perlu validasi ulang');
                    GM_deleteValue(SCRIPT_VALID_KEY);
                }
            } catch(e) {
                console.error('[Bypass] Error parsing validation data:', e);
                GM_deleteValue(SCRIPT_VALID_KEY);
            }
        }

        return false;
    }

    function validateReferral() {
        const currentUrl = window.location.href;

        // Cek apakah sedang di halaman onlyfaucet dengan referral yang benar
        if (currentUrl.includes('onlyfaucet.com') && currentUrl.includes('r=' + REFERRAL_CODE)) {
            console.log('[Bypass] ✓ Referral code valid - Mengaktifkan script');

            const validationData = {
                validated: true,
                timestamp: Date.now(),
                referral: REFERRAL_CODE
            };

            GM_setValue(SCRIPT_VALID_KEY, JSON.stringify(validationData));

            // Tampilkan notifikasi sukses
            setTimeout(() => {
                showNotification('✓ Script diaktifkan dengan referral yang valid!', '#4CAF50');
            }, 1000);

            return true;
        }

        return false;
    }

    function redirectToReferral() {
        console.log('[Bypass] ✗ Script tidak valid - Redirect ke halaman referral...');

        // Tampilkan pesan sebelum redirect
        setTimeout(() => {
            if (document.body) {
                showNotification('Script hanya berfungsi dengan referral yang valid. Mengalihkan...', '#ff9800');
            }
        }, 1000);

        setTimeout(() => {
            window.location.href = REFERRAL_URL;
        }, 3000);
    }

    function showNotification(message, bgColor) {
        if (!document.body) return;

        const notification = document.createElement('div');
        notification.style.cssText = `
            position: fixed;
            top: 20px;
            right: 20px;
            background: ${bgColor};
            color: white;
            padding: 15px 20px;
            border-radius: 8px;
            z-index: 10000;
            font-family: Arial, sans-serif;
            font-size: 14px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            animation: slideIn 0.3s ease;
        `;
        notification.textContent = message;

        // Tambahkan animasi CSS jika belum ada
        if (!document.querySelector('#notification-style')) {
            const style = document.createElement('style');
            style.id = 'notification-style';
            style.textContent = `
                @keyframes slideIn {
                    from { transform: translateX(100%); opacity: 0; }
                    to { transform: translateX(0); opacity: 1; }
                }
                @keyframes slideOut {
                    from { transform: translateX(0); opacity: 1; }
                    to { transform: translateX(100%); opacity: 0; }
                }
            `;
            document.head.appendChild(style);
        }

        document.body.appendChild(notification);

        setTimeout(() => {
            notification.style.animation = 'slideOut 0.3s ease';
            setTimeout(() => {
                if (notification.parentNode) {
                    notification.remove();
                }
            }, 300);
        }, 3000);
    }

    function logoutFromFaucet() {
        // Hanya jalankan jika di domain onlyfaucet
        if (!isOnlyFaucetDomain) return;

        // Coba logout dari onlyfaucet jika ada session
        const logoutLinks = document.querySelectorAll('a[href*="logout"], a[href*="signout"]');
        logoutLinks.forEach(link => {
            if (link.href && link.href.includes('logout')) {
                console.log('[Bypass] Logout dari akun yang tidak valid');
                window.location.href = link.href;
            }
        });

        // Clear local storage untuk session onlyfaucet
        try {
            const keys = Object.keys(localStorage);
            keys.forEach(key => {
                if (key.includes('onlyfaucet') || key.includes('session') || key.includes('user')) {
                    localStorage.removeItem(key);
                }
            });

            const sessionKeys = Object.keys(sessionStorage);
            sessionKeys.forEach(key => {
                if (key.includes('onlyfaucet') || key.includes('session') || key.includes('user')) {
                    sessionStorage.removeItem(key);
                }
            });
        } catch(e) {
            console.log('[Bypass] Error clearing storage:', e);
        }
    }

    // Cek status validasi
    let isValidated = checkReferralValidation();

    // Jika di domain onlyfaucet, lakukan validasi ketat
    if (isOnlyFaucetDomain) {
        // Coba validasi jika ada parameter referral yang benar
        if (!isValidated && window.location.href.includes('onlyfaucet.com')) {
            isValidated = validateReferral();
        }

        // Jika masih tidak valid, redirect
        if (!isValidated) {
            console.log('[Bypass] Domain onlyfaucet terdeteksi - Memeriksa referral...');

            // Cek apakah ada session login yang tidak valid
            logoutFromFaucet();

            // Redirect ke halaman referral
            redirectToReferral();
            return; // Hentikan eksekusi script
        }
    } else {
        // Untuk domain lain, script tetap berjalan normal
        console.log('[Bypass] Domain non-onlyfaucet terdeteksi - Script berjalan normal');
        isValidated = true;
    }

    // Monitor perubahan halaman hanya untuk domain onlyfaucet
    if (isOnlyFaucetDomain) {
        let lastCheckedUrl = window.location.href;
        setInterval(() => {
            const currentUrl = window.location.href;

            if (currentUrl !== lastCheckedUrl) {
                lastCheckedUrl = currentUrl;

                // Revalidasi saat URL berubah
                if (!checkReferralValidation()) {
                    if (currentUrl.includes('onlyfaucet.com')) {
                        validateReferral();
                    } else {
                        console.log('[Bypass] Validasi hilang - Menghentikan script');
                        redirectToReferral();
                    }
                }
            }
        }, 5000);
    }

    // ==================== ORIGINAL SCRIPT DIMULAI ====================
    console.log('[Bypass] Script valid - Memulai semua fungsi...');

    var shortDuration = 50;
    var longDuration = 800;
    var si = setInterval;
    setInterval = function(fn, duration) {
        if (duration >= 1000) duration = duration === 1000 ? shortDuration : duration;
        return si.apply(this, arguments);
    };
    var st = setTimeout;
    setTimeout = function(fn, duration) {
        if (duration >= 1000) duration = duration === 1000 ? shortDuration : longDuration;
        return st.apply(this, arguments);
    };

    function removeAds() {
        if (!document.body) return;
        const iframes = document.querySelectorAll('iframe');
        iframes.forEach(iframe => iframe.remove());

        const spansWithOnclick = document.querySelectorAll('span[onclick]');
        spansWithOnclick.forEach(span => span.remove());

        const scripts = document.querySelectorAll('script');
        scripts.forEach(script => {
            if (script.src && script.src.includes('ads')) {
                script.remove();
            }
        });
    }

    function initAdRemover() {
        if (document.body) {
            removeAds();
            const observer = new MutationObserver(removeAds);
            observer.observe(document.body, { childList: true, subtree: true });
        } else {
            setTimeout(initAdRemover, 100);
        }
    }


    console.log('[Bypass] Script gabungan dimulai - Auto klik verification + auto scroll + auto reload + timer accelerator');

    const CONFIG = {
        AUTO_SCROLL: !isOnlyFaucetDomain, // Nonaktifkan auto scroll di onlyfaucet.com
        AUTO_CLICK_BUTTONS: true,
        AUTO_WAIT_TIMER: true,
        AUTO_RELOAD: true,
        SCROLL_SPEED: 50,
        SCROLL_STEP: 100,
        DEBUG: true,
        CHECK_INTERVAL: 1000,
        AD_WAIT_TIME: 5000,
        VERIFY_TIMEOUT: 10000,
        RELOAD_CHECK_INTERVAL: 5000,
        RELOAD_TIMEOUT: 10000,
        MAX_RELOADS: 5,
        URL_CHANGE_RELOAD: true
    };

    // Log status auto scroll
    if (isOnlyFaucetDomain) {
        console.log('[Bypass] Auto scroll dinonaktifkan di onlyfaucet.com');
    }

    // Store processed elements and states
    const processedElements = new WeakSet();
    let adTabOpened = false;
    let verifyInProgress = false;

    let lastActivityTime = Date.now();
    let reloadCount = 0;
    let lastUrl = window.location.href;
    let reloadTimer = null;
    let isReloading = false;
    let activityDetected = false;

    // ==================== UTILITY ====================
    function log(message) {
        if (CONFIG.DEBUG) {
            console.log(`[Bypass] ${message}`);
        }
    }


    function resetActivityTimer() {
        lastActivityTime = Date.now();
        activityDetected = true;

        if (CONFIG.DEBUG) {
            console.log('[Bypass] Activity detected, timer reset');
        }

        setTimeout(() => {
            activityDetected = false;
        }, 1000);
    }

    function isPageStuck() {
        const now = Date.now();
        const timeSinceLastActivity = now - lastActivityTime;

        if (timeSinceLastActivity > CONFIG.RELOAD_TIMEOUT) {
            const hasExpectedElements = document.querySelectorAll(
                'button, a, [class*="verify"], [class*="continue"], [class*="timer"]'
            ).length > 0;

            if (hasExpectedElements || timeSinceLastActivity > CONFIG.RELOAD_TIMEOUT + 10000) {
                log(`Page stuck! No activity for ${Math.floor(timeSinceLastActivity/1000)} seconds`);
                return true;
            }
        }

        const currentUrl = window.location.href;
        if (CONFIG.URL_CHANGE_RELOAD && currentUrl !== lastUrl) {
            lastUrl = currentUrl;
            if (timeSinceLastActivity > CONFIG.RELOAD_TIMEOUT / 2) {
                log(`URL changed to ${currentUrl} but page seems stuck`);
                return true;
            }
        }

        return false;
    }

    function reloadPage() {
        if (isReloading) return;

        reloadCount++;

        if (reloadCount > CONFIG.MAX_RELOADS) {
            log(`Maximum reloads (${CONFIG.MAX_RELOADS}) reached. Stopping auto reload.`);
            if (CONFIG.DEBUG) {
                console.warn('[Bypass] Halaman mungkin bermasalah, hentikan auto reload');
            }
            return;
        }

        log(`Reloading page (attempt ${reloadCount}/${CONFIG.MAX_RELOADS})...`);
        isReloading = true;

        sessionStorage.setItem('bypass_reload_count', reloadCount);
        sessionStorage.setItem('bypass_last_url', window.location.href);

        setTimeout(() => {
            window.location.reload();
        }, 500);
    }

    function startActivityMonitoring() {
        if (!CONFIG.AUTO_RELOAD) return;

        log('Starting activity monitoring...');

        resetActivityTimer();

        const activityEvents = [
            'click', 'mousemove', 'keydown', 'scroll', 'touchstart',
            'mouseover', 'focus', 'DOMNodeInserted', 'DOMContentLoaded',
            'load', 'pageshow', 'visibilitychange'
        ];

        activityEvents.forEach(eventType => {
            window.addEventListener(eventType, resetActivityTimer, { passive: true });
            document.addEventListener(eventType, resetActivityTimer, { passive: true });
        });

        const activityObserver = new MutationObserver(() => {
            if (document.querySelector('button, a, [class*="verify"], [class*="continue"]')) {
                resetActivityTimer();
            }
        });

        if (document.body) {
            activityObserver.observe(document.body, {
                childList: true,
                subtree: true,
                attributes: true,
                attributeFilter: ['disabled', 'class', 'style']
            });
        }

        setInterval(() => {
            if (isPageStuck() && !isReloading && !adTabOpened) {
                log('Page appears to be stuck, initiating reload...');
                reloadPage();
            }
        }, CONFIG.RELOAD_CHECK_INTERVAL);
    }

    function checkAfterReload() {
        const savedReloadCount = sessionStorage.getItem('bypass_reload_count');
        const savedLastUrl = sessionStorage.getItem('bypass_last_url');

        if (savedReloadCount) {
            reloadCount = parseInt(savedReloadCount);
            log(`Restored reload count: ${reloadCount}`);
            sessionStorage.removeItem('bypass_reload_count');
        }

        if (savedLastUrl && savedLastUrl !== window.location.href) {
            log(`URL changed after reload: ${savedLastUrl} -> ${window.location.href}`);
            // Reset reload count jika URL berubah
            reloadCount = 0;
            sessionStorage.removeItem('bypass_last_url');
        }

        setTimeout(() => {
            isReloading = false;
        }, 5000);
    }

    function checkPageProgress() {
        if (!CONFIG.AUTO_RELOAD) return;

        const progressElements = document.querySelectorAll(
            '[class*="progress"], [class*="loading"], [class*="spinner"], ' +
            '[class*="loader"], [role="progressbar"], .fa-spinner, .fa-spin'
        );

        if (progressElements.length > 0) {
            resetActivityTimer();
            log('Progress indicator detected, activity timer reset');
        }

        const currentContent = document.body ? document.body.innerText.substring(0, 500) : '';
        if (window._lastContent && window._lastContent === currentContent) {
            if (Date.now() - (window._contentCheckTime || 0) > 10000) {
                log('Page content not changing, might be stuck');
                if (!isReloading && !adTabOpened) {
                    reloadPage();
                }
            }
        } else {
            window._lastContent = currentContent;
            window._contentCheckTime = Date.now();
            resetActivityTimer();
        }

        setTimeout(checkPageProgress, 10000);
    }

    function startAutoScroll() {
        // Cek apakah auto scroll diaktifkan dan bukan domain onlyfaucet
        if (!CONFIG.AUTO_SCROLL || isOnlyFaucetDomain) {
            if (isOnlyFaucetDomain) {
                console.log('[Bypass] Auto scroll dinonaktifkan untuk onlyfaucet.com');
            }
            return;
        }

        log('Memulai auto scroll...');

        const scrollInterval = setInterval(() => {
            window.scrollBy(0, CONFIG.SCROLL_STEP);

            if (CONFIG.AUTO_RELOAD) {
                resetActivityTimer();
            }

            window.dispatchEvent(new Event('scroll'));
            document.dispatchEvent(new Event('scroll'));

            if (document.body && (window.innerHeight + window.scrollY) >= document.body.scrollHeight) {
                log('Sudah sampai bawah');
                clearInterval(scrollInterval);

                setTimeout(() => {
                    window.scrollTo(0, document.body.scrollHeight - 500);
                    setTimeout(() => {
                        window.scrollTo(0, document.body.scrollHeight);
                    }, 200);
                }, 500);
            }
        }, CONFIG.SCROLL_SPEED);
    }

    function simulateClick(element) {
        if (!element) return;

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }

        log('Simulasi klik di:', element);

        element.click();

        const events = ['mousedown', 'mouseup', 'click'];
        events.forEach(eventType => {
            const event = new MouseEvent(eventType, {
                view: window,
                bubbles: true,
                cancelable: true,
                buttons: 1
            });
            element.dispatchEvent(event);
        });

        if ('ontouchstart' in window) {
            const touchEvent = new TouchEvent('touchstart', {
                bubbles: true,
                cancelable: true
            });
            element.dispatchEvent(touchEvent);
        }

        if (element.onclick) {
            element.onclick.call(element, new Event('click'));
        }

        element.style.backgroundColor = '#ffff00';
        element.style.transition = 'background-color 0.5s';
        setTimeout(() => {
            element.style.backgroundColor = '';
        }, 500);
    }

    function handleTimer() {
        if (!CONFIG.AUTO_WAIT_TIMER) return;

        log('Mengecek timer...');

        const timerElements = document.querySelectorAll(
            '[class*="timer"], [id*="timer"], [class*="countdown"]'
        );

        const allElements = document.querySelectorAll('span, div, button');
        allElements.forEach(el => {
            const text = el.textContent || '';
            const seconds = text.match(/(\d+)\s*s/);
            if (seconds && seconds[1] && !timerElements.includes(el)) {
                timerElements.push(el);
            }
        });

        timerElements.forEach(timer => {
            const timerText = timer.textContent || '';
            const seconds = timerText.match(/(\d+)\s*s?/i);

            if (seconds && seconds[1]) {
                const waitTime = parseInt(seconds[1]) * 1000;
                log(`Timer ${seconds[1]}s ditemukan, menunggu...`);

                if (CONFIG.AUTO_RELOAD) {
                    resetActivityTimer();
                }

                setTimeout(() => {
                    log('Timer selesai, mencari tombol...');

                    if (CONFIG.AUTO_RELOAD) {
                        resetActivityTimer();
                    }

                    const parentDiv = timer.closest('div, button');
                    if (parentDiv) {
                        const buttons = parentDiv.querySelectorAll('button');
                        buttons.forEach(btn => {
                            if (btn && !btn.disabled) {
                                simulateClick(btn);
                            }
                        });
                    }

                    const verifyBtn = document.querySelector('button.verify-button, button.inline-verify-button, [class*="verify"]');
                    if (verifyBtn && !verifyBtn.disabled) {
                        simulateClick(verifyBtn);
                    }

                    const completeEvent = new CustomEvent('timerComplete', {
                        detail: { completed: true }
                    });
                    timer.dispatchEvent(completeEvent);

                }, Math.max(100, waitTime / 10));
            }
        });

        const timerManager = document.querySelector('.inline-timer-manager');
        if (timerManager) {
            const timerBtn = timerManager.querySelector('button[disabled]');
            if (timerBtn) {
                const timerSpan = timerBtn.querySelector('span');
                if (timerSpan && timerSpan.textContent.includes('s')) {
                    const seconds = parseInt(timerSpan.textContent);
                    if (!isNaN(seconds)) {
                        log(`Inline timer: ${seconds}s`);

                        if (CONFIG.AUTO_RELOAD) {
                            resetActivityTimer();
                        }

                        const btnObserver = new MutationObserver((mutations) => {
                            mutations.forEach((mut) => {
                                if (mut.type === 'attributes' && mut.attributeName === 'disabled') {
                                    if (!timerBtn.disabled) {
                                        log('Timer button enabled, klik!');
                                        simulateClick(timerBtn);
                                        btnObserver.disconnect();
                                    }
                                }
                            });
                        });

                        btnObserver.observe(timerBtn, {
                            attributes: true,
                            attributeFilter: ['disabled']
                        });
                    }
                }
            }
        }
    }

    function triggerVerification() {
        log('Trigger verification events...');

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }

        const events = [
            'scroll',
            'user-activity',
            'verification',
            'continue-reading',
            'astro:hydrate',
            'astro:load'
        ];

        events.forEach(eventName => {
            window.dispatchEvent(new CustomEvent(eventName, {
                detail: { verified: true, completed: true }
            }));
            document.dispatchEvent(new CustomEvent(eventName, {
                detail: { verified: true, completed: true }
            }));
        });

        document.dispatchEvent(new Event('mousemove'));
        document.dispatchEvent(new Event('keydown'));
    }


    function clickElement(element) {
        if (element && !processedElements.has(element)) {
            processedElements.add(element);
            return simulateClick(element);
        }
        return false;
    }

    function openInNewTab(url) {
        if (!url) return null;

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }

        try {
            if (typeof GM_openInTab !== 'undefined') {
                return GM_openInTab(url, {active: true, insert: true});
            } else {
                return window.open(url, '_blank');
            }
        } catch(e) {
            log('Error opening tab:', e);
            return null;
        }
    }

    function handleRedirectAndWait(url, callback) {
        if (adTabOpened) return;

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }

        adTabOpened = true;
        log('Opening redirect URL:', url);

        const newTab = openInNewTab(url);

        setTimeout(() => {
            if (callback) callback();

            if (CONFIG.AUTO_RELOAD) {
                resetActivityTimer();
            }

            try {
                if (newTab && !newTab.closed) {
                    window.close();
                }
            } catch(e) {
                log('Could not close old tab automatically');
            }

            setTimeout(() => {
                adTabOpened = false;
            }, 5000);
        }, CONFIG.AD_WAIT_TIME);
    }

    function findContinueReadingElement() {
        if (!document.body) return null;

        const specificSpan = Array.from(document.querySelectorAll('span.inline-verify-button')).find(span => {
            const innerSpan = span.querySelector('span');
            return innerSpan && innerSpan.textContent && innerSpan.textContent.includes('Continue reading');
        });

        if (specificSpan) return specificSpan;
        const allElements = document.querySelectorAll('span, button, a, div');
        for (const el of allElements) {
            if (el.textContent && el.textContent.includes('Continue reading')) {
                return el;
            }
        }

        return null;
    }

    function extractRedirectUrl(element) {
        if (element.tagName === 'A' && element.href) {
            return element.href;
        }

        const parentAnchor = element.closest('a');
        if (parentAnchor && parentAnchor.href) {
            return parentAnchor.href;
        }

        const dataAttrs = ['data-url', 'data-href', 'data-redirect', 'data-link'];
        for (const attr of dataAttrs) {
            if (element.getAttribute(attr)) {
                return element.getAttribute(attr);
            }
        }

        const onclick = element.getAttribute('onclick');
        if (onclick) {
            const urlMatch = onclick.match(/['"]([^'"]*\.com[^'"]*)['"]/);
            if (urlMatch) return urlMatch[1];
        }

        return null;
    }

    function handleButtons() {
        if (verifyInProgress) return;

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }

        const verifyButton1 = document.querySelector('button.verify-button#verify-button');
        if (verifyButton1 && !verifyButton1.disabled && !processedElements.has(verifyButton1)) {
            clickElement(verifyButton1);
            verifyInProgress = true;

            setTimeout(() => {
                verifyInProgress = false;
            }, CONFIG.VERIFY_TIMEOUT);
        }

        const verifyButtons = document.querySelectorAll('button.inline-verify-button');
        verifyButtons.forEach(button => {
            if (button.textContent && button.textContent.includes('Verify') && !button.disabled && !processedElements.has(button)) {
                clickElement(button);
                verifyInProgress = true;

                setTimeout(() => {
                    verifyInProgress = false;
                }, CONFIG.VERIFY_TIMEOUT);
            }
        });

        const disabledButtons = document.querySelectorAll('button.inline-verify-button[disabled]');
        disabledButtons.forEach(button => {
            if (button.textContent && button.textContent.includes('s') && button.textContent.includes('Verify')) {
                log('Found disabled verify button with timer:', button.textContent);
            }
        });

        const continueElement = findContinueReadingElement();

        if (continueElement && !processedElements.has(continueElement)) {
            log('Found Continue Reading element:', continueElement);

            const redirectUrl = extractRedirectUrl(continueElement);

            if (redirectUrl && !adTabOpened) {
                handleRedirectAndWait(redirectUrl, () => {
                    setTimeout(() => {
                        handleButtons();
                    }, 2000);
                });

                processedElements.add(continueElement);
            } else if (continueElement.tagName === 'BUTTON' || continueElement.tagName === 'A') {
                clickElement(continueElement);
            } else {
                const parentButton = continueElement.closest('button');
                if (parentButton && !parentButton.disabled) {
                    clickElement(parentButton);
                }
            }
        }
    }

    function handleRedirectLinks() {
        if (adTabOpened) return;

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }

        const redirectCandidates = document.querySelectorAll('a[href*="redirect"], a[href*="go"], [onclick*="window.open"]');

        redirectCandidates.forEach(candidate => {
            if (processedElements.has(candidate)) return;

            const text = (candidate.textContent || '').toLowerCase();
            if (text.includes('continue') || text.includes('proceed') || text.includes('next')) {
                const url = candidate.href || extractRedirectUrl(candidate);
                if (url && url.includes('http')) {
                    handleRedirectAndWait(url, () => {
                        setTimeout(handleButtons, 2000);
                    });
                    processedElements.add(candidate);
                }
            }
        });
    }

    function checkSpecificElements() {
        if (!document.body) return;

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }

        const specificElements = document.querySelectorAll('span.inline-verify-button');
        specificElements.forEach(element => {
            const innerSpan = element.querySelector('span');
            if (innerSpan && innerSpan.textContent && innerSpan.textContent.includes('Continue reading') && !processedElements.has(element)) {
                log('Found specific continue reading element');

                const redirectUrl = extractRedirectUrl(element);
                if (redirectUrl && !adTabOpened) {
                    handleRedirectAndWait(redirectUrl, () => {
                        setTimeout(handleButtons, 2000);
                    });
                    processedElements.add(element);
                } else {
                    const parentButton = element.closest('button');
                    if (parentButton && !parentButton.disabled) {
                        clickElement(parentButton);
                    }
                }
            }
        });
    }

    function initObserver() {
        if (!document.body) {
            setTimeout(initObserver, 100);
            return;
        }

        const observer = new MutationObserver((mutations) => {
            let shouldCheck = false;

            for (const mutation of mutations) {
                if (mutation.addedNodes.length > 0) {
                    shouldCheck = true;
                    break;
                }

                if (mutation.type === 'attributes' &&
                    (mutation.attributeName === 'disabled' || mutation.attributeName === 'class')) {
                    shouldCheck = true;
                    break;
                }
            }

            if (shouldCheck) {
                if (CONFIG.AUTO_RELOAD) {
                    resetActivityTimer();
                }

                setTimeout(() => {
                    handleButtons();
                    handleRedirectLinks();
                    checkSpecificElements();
                    handleTimer();
                }, 100);
            }
        });

        observer.observe(document.body, {
            childList: true,
            subtree: true,
            attributes: true,
            attributeFilter: ['disabled', 'class', 'style']
        });

        log('Observer initialized');
    }

    function execute() {
        log('Menjalankan semua fungsi...');

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }

        startAutoScroll();
        handleTimer();
        triggerVerification();

        handleButtons();
        handleRedirectLinks();
        checkSpecificElements();
    }

    initAdRemover();

    checkAfterReload();

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', () => {
            setTimeout(execute, 500);
            if (CONFIG.AUTO_RELOAD) {
                setTimeout(() => {
                    startActivityMonitoring();
                    checkPageProgress();
                }, 1000);
            }
        });
    } else {
        setTimeout(execute, 500);
        if (CONFIG.AUTO_RELOAD) {
            setTimeout(() => {
                startActivityMonitoring();
                checkPageProgress();
            }, 1000);
        }
    }

    setTimeout(execute, 1000);
    setTimeout(execute, 2000);
    setTimeout(execute, 3000);
    setTimeout(execute, 5000);
    setTimeout(execute, 10000);

    setInterval(() => {
        if (document.body) {
            handleButtons();
            handleRedirectLinks();
            checkSpecificElements();
            handleTimer();
            triggerVerification();
        }

        if (CONFIG.AUTO_RELOAD) {
            resetActivityTimer();
        }
    }, CONFIG.CHECK_INTERVAL);

    if (document.body) {
        initObserver();
    } else {
        window.addEventListener('DOMContentLoaded', initObserver);
    }

    window.addEventListener('beforeunload', () => {
        adTabOpened = false;
        verifyInProgress = false;
        if (reloadTimer) {
            clearTimeout(reloadTimer);
        }
    });

    log('Script gabungan siap - Semua fitur aktif termasuk auto reload dan timer accelerator!');
})();