// ==UserScript==
// @name eBay Hide Price Range Items
// @namespace http://tampermonkey.net/
// @version 2.1
// @description Hide eBay listings that have price ranges. Based on https://greasyfork.org/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
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
// Add CSS styles
$('head').append('');
function hideRangeItem($el) {
$el.addClass('hiddenRangeItem').hide().before('
ShowHide price range item
');
$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
});
})();