jklm.fun embed

Embed of any desired game/site with cycling toggle buttons for jklm.fun

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         jklm.fun embed
// @namespace    http://tampermonkey.net
// @version      1.0
// @description  Embed of any desired game/site with cycling toggle buttons for jklm.fun
// @author       HA_LOL_XD
// @match        *://*.jklm.fun/*
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 1. DUAL-WINDOW PROTECTION: Only run on the main JKLM page, not inside its game iframes
    if (window.self !== window.top) return;

    // 2. GAME LIST
    const games = [
        { name: '🐠 Orb Farm', url: 'https://orb.farm' },
        { name: '⏳ Sandspiel', url: 'https://sandspiel.club' }
    ];
    let currentGameIndex = 0;

    function init() {
        // Prevent duplicate buttons if they already exist
        if (document.getElementById('jklm-embed-controls')) return;

        // 3. UI Container (Top-Right)
        const container = document.createElement('div');
        container.id = 'jklm-embed-controls';
        container.style.cssText = 'position:fixed; top:10px; right:10px; z-index:10001; display:flex; gap:5px;';

        // 4. Cycle/Toggle Button
        const btn = document.createElement('button');
        btn.innerHTML = games[currentGameIndex].name;
        btn.style.cssText = 'padding:8px 12px; cursor:pointer; background:#222; color:#fff; border:1px solid #444; border-radius:5px; font-weight:bold; font-family:sans-serif; min-width:110px;';

        // 5. Reload Button
        const reloadBtn = document.createElement('button');
        reloadBtn.innerHTML = '🔄';
        reloadBtn.style.cssText = 'padding:8px 10px; cursor:pointer; background:#333; color:#fff; border:1px solid #444; border-radius:5px;';

        // 6. Close Button
        const closeBtn = document.createElement('button');
        closeBtn.innerHTML = '✖';
        closeBtn.style.cssText = 'padding:8px 12px; cursor:pointer; background:#800; color:#fff; border:1px solid #444; border-radius:5px; font-weight:bold;';

        // 7. Game Wrapper (Bottom-Left)
        const wrapper = document.createElement('div');
        wrapper.id = 'jklm-game-wrapper';
        wrapper.style.cssText = 'position:fixed; bottom:20px; left:20px; width:400px; height:500px; z-index:10000; display:none; background:#000; border:2px solid #555; border-radius:8px; overflow:hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.8);';

        const iframe = document.createElement('iframe');
        iframe.src = games[currentGameIndex].url;
        iframe.style.cssText = 'width:800px; height:1000px; border:none; transform:scale(0.5); transform-origin:0 0;';

        // LOGIC: Toggle and Cycle
        btn.onclick = () => {
            if (wrapper.style.display === 'none') {
                wrapper.style.display = 'block';
            } else {
                currentGameIndex = (currentGameIndex + 1) % games.length;
                iframe.src = games[currentGameIndex].url;
                btn.innerHTML = games[currentGameIndex].name;
            }
            btn.style.background = '#007bff';
        };

        // LOGIC: Close
        closeBtn.onclick = () => {
            wrapper.style.display = 'none';
            btn.style.background = '#222';
        };

        // LOGIC: Reload current iframe
        reloadBtn.onclick = () => {
            iframe.src = games[currentGameIndex].url;
            reloadBtn.style.background = '#28a745';
            setTimeout(() => reloadBtn.style.background = '#333', 500);
        };

        // Append everything
        wrapper.appendChild(iframe);
        container.appendChild(btn);
        container.appendChild(reloadBtn);
        container.appendChild(closeBtn);
        document.body.appendChild(container);
        document.body.appendChild(wrapper);
    }

    // Run on load
    init();

    // Watch for JKLM page transitions to re-inject buttons if they get wiped
    const observer = new MutationObserver(() => {
        if (!document.getElementById('jklm-embed-controls')) {
            init();
        }
    });
    observer.observe(document.body, { childList: true, subtree: true });
})();