Pokellector Toggle Visibility Script

Add a toggle button to show/hide cards checked with the class 'checked' on Pokellector.

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         Pokellector Toggle Visibility Script
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Add a toggle button to show/hide cards checked with the class 'checked' on Pokellector.
// @author       ArthurShelby
// @match        https://www.pokellector.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pokellector.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Create the toggle button
    const toggleButton = document.createElement('button');
    toggleButton.textContent = 'Hide Completed'; // Initial text
    toggleButton.style.position = 'fixed';
    toggleButton.style.top = '10px';
    toggleButton.style.right = '10px';
    toggleButton.style.zIndex = '1000';
    toggleButton.style.padding = '10px';
    toggleButton.style.backgroundColor = '#007bff';
    toggleButton.style.color = 'white';
    toggleButton.style.border = 'none';
    toggleButton.style.borderRadius = '5px';
    toggleButton.style.cursor = 'pointer';

    // Add the button to the page
    document.body.appendChild(toggleButton);

    // Add toggle functionality
    let isHidden = false; // Initial state: visible
    toggleButton.addEventListener('click', () => {
        document.querySelectorAll('.checked').forEach(el => {
            el.style.display = isHidden ? '' : 'none'; // Toggle visibility
        });
        isHidden = !isHidden; // Update toggle state
        toggleButton.textContent = isHidden ? 'Show Completed' : 'Hide Completed'; // Update button text
    });
})();