Advanced Clipboard Manager

Son 10 kopyalamayı saklar ve hızlı erişim sağlar.

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         Advanced Clipboard Manager
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Son 10 kopyalamayı saklar ve hızlı erişim sağlar.
// @author       Mustafa Hakan
// @match        *://*/*
// @grant        GM_addStyle
// @grant        GM_setClipboard
// @grant        GM_getValue
// @grant        GM_setValue
// ==/UserScript==

(function() {
    'use strict';

    GM_addStyle(`
        #clip-panel {
            position: fixed;
            top: 50%;
            right: 0;
            transform: translateY(-50%);
            z-index: 2147483647;
            background: #1a1a1b;
            border: 1px solid #343435;
            border-right: none;
            border-radius: 8px 0 0 8px;
            width: 250px;
            transition: all 0.3s ease;
            font-family: sans-serif;
            box-shadow: -4px 0 15px rgba(0,0,0,0.5);
            display: flex;
            flex-direction: column;
            max-height: 80vh;
            margin-right: -250px;
        }
        #clip-panel.open {
            margin-right: 0;
        }
        #clip-handle {
            position: absolute;
            left: -35px;
            top: 50%;
            transform: translateY(-50%);
            width: 35px;
            height: 60px;
            background: #1a1a1b;
            border: 1px solid #343435;
            border-right: none;
            border-radius: 8px 0 0 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-size: 20px;
        }
        #clip-list {
            overflow-y: auto;
            padding: 10px;
            flex-grow: 1;
        }
        .clip-item {
            background: #272729;
            padding: 8px 12px;
            margin-bottom: 8px;
            border-radius: 4px;
            font-size: 12px;
            color: #d7dadc;
            cursor: pointer;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            transition: background 0.2s;
            border: 1px solid transparent;
        }
        .clip-item:hover {
            background: #343435;
            border-color: #444;
        }
        #clip-header {
            padding: 10px;
            border-bottom: 1px solid #343435;
            font-size: 13px;
            font-weight: bold;
            color: #fff;
            text-align: center;
        }
    `);

    let history = GM_getValue('clipHistory', []);

    const saveHistory = (text) => {
        if (!text || text === history[0]) return;
        history.unshift(text);
        if (history.length > 10) history.pop();
        GM_setValue('clipHistory', history);
        renderList();
    };

    const renderList = () => {
        const list = document.getElementById('clip-list');
        if (!list) return;
        list.innerHTML = '';
        history.forEach((text) => {
            const item = document.createElement('div');
            item.className = 'clip-item';
            item.innerText = text;
            item.title = text;
            item.onclick = () => {
                GM_setClipboard(text);
                document.getElementById('clip-panel').classList.remove('open');
            };
            list.appendChild(item);
        });
    };

    const panel = document.createElement('div');
    panel.id = 'clip-panel';
    panel.innerHTML = `
        <div id="clip-handle">📋</div>
        <div id="clip-header">Kopyalananlar</div>
        <div id="clip-list"></div>
    `;

    document.body.appendChild(panel);
    renderList();

    panel.querySelector('#clip-handle').onclick = () => {
        panel.classList.toggle('open');
    };

    document.addEventListener('copy', () => {
        setTimeout(async () => {
            const text = await navigator.clipboard.readText();
            saveHistory(text);
        }, 100);
    });

})();