Advanced Clipboard Manager

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

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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);
    });

})();