Dexscreener Hide Rows in Screener

When in Dexscreener and you have are browsing coins that match your favorite set of filters, isn't it annoying to see the same coins you have deemed of no value? Use this extension to hide those away.

目前為 2025-01-28 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Dexscreener Hide Rows in Screener
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  When in Dexscreener and you have are browsing coins that match your favorite set of filters, isn't it annoying to see the same coins you have deemed of no value? Use this extension to hide those away.
// @match        https://dexscreener.com/*
// @grant        none
// @author       @pseudo_echoo
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function addXButtons() {
        const rows = document.querySelectorAll('.ds-dex-table-row.ds-dex-table-row-top');
        rows.forEach((row) => {
            if (!row.querySelector('.hide-row-button')) {
                const buttonContainer = document.createElement('div');
                buttonContainer.style.display = 'flex';
                buttonContainer.style.alignItems = 'center';
                buttonContainer.style.marginRight = '10px';
                buttonContainer.style.position = 'relative';
                buttonContainer.style.zIndex = '9999';

                const button = document.createElement('button');
                button.textContent = 'X';
                button.className = 'hide-row-button';
                button.style.cursor = 'pointer';
                button.style.padding = '2px 6px';
                button.style.backgroundColor = '#ff4444';
                button.style.color = 'white';
                button.style.border = 'none';
                button.style.borderRadius = '3px';
                button.style.position = 'relative';
                button.style.zIndex = '9999';

                button.onclick = function(e) {
                    e.preventDefault();
                    e.stopPropagation();
                    row.style.display = 'none';
                    const href = row.getAttribute('href');
                    localStorage.setItem(`hiddenRow_${href}`, 'true');
                };

                buttonContainer.appendChild(button);
                const firstCell = row.querySelector('div');
                if (firstCell) {
                    firstCell.style.display = 'flex';
                    firstCell.style.alignItems = 'center';
                    firstCell.insertBefore(buttonContainer, firstCell.firstChild);
                }
            }

            const href = row.getAttribute('href');
            if (localStorage.getItem(`hiddenRow_${href}`) === 'true') {
                row.style.display = 'none';
            }
        });
    }

    // Run the function initially
    setTimeout(addXButtons, 1000);

    // Use a MutationObserver to handle dynamically loaded content
    const observer = new MutationObserver((mutations) => {
        setTimeout(addXButtons, 500);
    });
    observer.observe(document.body, { childList: true, subtree: true });
})();