Advanced Clipboard Manager

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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

})();