Greasy Fork

Greasy Fork is available in English.

Claude eBay Hide Price Range Items

Hide eBay listings that have price ranges. Based on http://greasyfork.icu/en/scripts/28968-pricerangeitemhider by Lars Simonsen, fixed with Claude.ai

当前为 2025-08-01 提交的版本,查看 最新版本

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

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

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

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

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

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Claude eBay Hide Price Range Items
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Hide eBay listings that have price ranges. Based on http://greasyfork.icu/en/scripts/28968-pricerangeitemhider by Lars Simonsen, fixed with Claude.ai
// @author       Claude
// @match        https://www.ebay.co.uk/*
// @match        https://www.ebay.com/*
// @license      MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Add CSS styles
    $('head').append('<style>' +
        '.hiddenRangeItem { background-color: #eee; }' +
        '.showHiddenRangeItem { cursor: pointer; background-color: #eee; border: 1px solid #ddd; margin: 1em; padding: 0.25em; text-align: center; }' +
        '.showHiddenRangeItem.showing { color: white; background-color: black; }' +
        '.showHiddenRangeItem.hiding .hideIt, .showHiddenRangeItem.showing .showIt { display: none; }' +
    '</style>');

    function hideRangeItem($el) {
        $el.addClass('hiddenRangeItem').hide().before('<div class="showHiddenRangeItem hiding"><span class="showIt">Show</span><span class="hideIt">Hide</span> price range item</div>');
        $el.prev('.showHiddenRangeItem').click(function() {
            $(this).toggleClass('showing hiding').next('.hiddenRangeItem').slideToggle();
        });
    }

    function hideRangeItems() {
        // Look for price rows that contain " to " text between price spans
        $('.s-card__attribute-row').each(function() {
            const $row = $(this);
            const $priceSpans = $row.find('.s-card__price');

            // Check if this row has multiple price spans and contains " to "
            if ($priceSpans.length > 1) {
                // Check if any span in this row contains " to "
                let hasToSpan = false;
                $priceSpans.each(function() {
                    if ($(this).text().trim() === 'to') {
                        hasToSpan = true;
                        return false; // break out of each loop
                    }
                });

                if (hasToSpan) {
                    // Find the parent li element (the actual item container)
                    const $item = $row.closest('li.s-card');
                    if ($item.length && !$item.hasClass('hiddenRangeItem')) {
                        console.log('Hiding price range item:', $item.find('.s-card__title').text().trim());
                        hideRangeItem($item);
                    }
                }
            }
        });
    }

    // Run initially and then periodically to catch dynamically loaded content
    $(document).ready(function() {
        hideRangeItems();
        setInterval(hideRangeItems, 2000);
    });

    // Also run when new content is loaded (for infinite scroll, etc.)
    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes.length) {
                setTimeout(hideRangeItems, 500);
            }
        });
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();