Greasy Fork is available in English.

Cookie Editor

Edit cookies, use in script menu

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         Cookie Editor
// @version      1.1
// @description  Edit cookies, use in script menu
// @author       DeepSeek
// @match        *://*/*
// @grant        GM_registerMenuCommand
// @run-at       document-end
// @namespace https://greatest.deepsurf.us/users/452911
// ==/UserScript==

(function() {
    'use strict';

    // Register menu command
    GM_registerMenuCommand('Edit Cookies', editCookiesPrecisely, 'e');

    function editCookiesPrecisely() {
        // Get all current cookies and convert to object
        const currentCookies = document.cookie.split(';').reduce((obj, cookie) => {
            const [name, value] = cookie.trim().split('=');
            if (name) obj[name] = value || '';
            return obj;
        }, {});

        // Convert to edit string (semicolon separated)
        const editText = Object.entries(currentCookies)
            .map(([name, value]) => `${name}=${value}`)
            .join('; ');

        // Use prompt dialog to edit
        const newText = prompt('Edit Cookies (semicolon separated format):\n\nNote: Any cookie not in the edit box will be deleted', editText);
        if (newText === null) return; // User cancelled

        try {
            // Parse new cookies
            const newCookies = newText.split(';').reduce((obj, cookie) => {
                const [name, value] = cookie.trim().split('=');
                if (name) obj[name] = value || '';
                return obj;
            }, {});

            // Find cookies to delete (existing but not in new list)
            Object.keys(currentCookies).forEach(name => {
                if (!(name in newCookies)) {
                    document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;
                }
            });

            // Set new or modified cookies
            Object.entries(newCookies).forEach(([name, value]) => {
                document.cookie = `${name}=${value}; path=/`;
            });

            // Show result and refresh
            const changedCount = Object.keys(newCookies).length;
            const deletedCount = Object.keys(currentCookies).length - changedCount;
            alert(`Cookie update complete:\nAdded/Modified: ${changedCount}\nDeleted: ${deletedCount}\nThe page will refresh...`);
            setTimeout(() => location.reload(), 500);

        } catch (e) {
            alert('Error: ' + e.message);
        }
    }
})();