Pokellector Toggle Visibility Script

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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