Pokellector Toggle Visibility Script

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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
    });
})();