ISCUT HELPER

Automatically extracts a domain from ISCUT pages and opens a Google site: search after a 3-second countdown.

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

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

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 betiği yüklemek için bir betik yöneticisi eklentisi yüklemeniz gerekecektir.

(Zaten bir betik yöneticim var, hadi yükleyelim!)

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         ISCUT HELPER
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically extracts a domain from ISCUT pages and opens a Google site: search after a 3-second countdown.
// @author       Mrtznx
// @match        https://iscut.eu/i/*
// @grant        GM_openInTab
// ==/UserScript==

(function() {
    'use strict';

    // 1. Find a domain in the page text
    const text = document.body.innerText;
    const match = text.match(/site:\s*((?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,})/i);
    if (!match) return;   // nothing found

    const domain = match[1];
    const searchUrl = `https://www.google.com/search?q=site:${encodeURIComponent(domain)}`;

    // 2. Create a small notification box with countdown
    const box = document.createElement('div');
    box.style.cssText = `
        position: fixed;
        bottom: 20px;
        right: 20px;
        background: #222;
        color: #fff;
        padding: 12px 18px;
        border-radius: 8px;
        font-family: sans-serif;
        font-size: 14px;
        z-index: 9999;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        display: flex;
        align-items: center;
        gap: 12px;
        opacity: 0.9;
        border: 1px solid #555;
    `;
    box.innerHTML = `
        <span>🔍 Opening search for <strong>${domain}</strong> in <span id="timerDisplay">3</span>s</span>
        <button id="cancelTimer" style="background:#d32f2f;color:#fff;border:none;padding:4px 10px;border-radius:4px;cursor:pointer;">Cancel</button>
    `;
    document.body.appendChild(box);

    const timerSpan = document.getElementById('timerDisplay');
    const cancelBtn = document.getElementById('cancelTimer');
    let countdown = 3;
    let timerId = null;

    // 3. Countdown logic
    function startCountdown() {
        timerId = setInterval(() => {
            countdown -= 1;
            if (countdown <= 0) {
                clearInterval(timerId);
                box.remove();               // remove notification
                GM_openInTab(searchUrl, { active: false });  // open in background
            } else {
                timerSpan.textContent = countdown;
            }
        }, 1000);
    }

    // 4. Cancel button: clear timer and remove box
    cancelBtn.addEventListener('click', () => {
        clearInterval(timerId);
        box.remove();
    });

    // 5. Start the timer
    startCountdown();
})();