Skip to content

Instantly share code, notes, and snippets.

@henno
Last active February 2, 2025 16:39
Show Gist options
  • Save henno/61a018aed71bcdea8613c123090364aa to your computer and use it in GitHub Desktop.
Save henno/61a018aed71bcdea8613c123090364aa to your computer and use it in GitHub Desktop.
Tampermonkey skript, mis eemaldab eBay kuulutused sellistest riikidest, kus kasutatakse eestlase jaoks ebasobivat klaviatuuripaigutust (UK, US, Itaalia)
// ==UserScript==
// @name Remove US and UK Listings on eBay
// @namespace http://tampermonkey.net/
// @version 1.2
// @description Eemalda eBay kuulutused, mis asuvad Ameerikas ja Ühendkuningriigis
// @author Henno Täht
// @match https://www.ebay.de/*
// @match https://www.ebay.com/*
// @match https://www.ebay.co.uk/*
// @match https://www.ebay.ie/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Riigid, mille kuulutusi peidame
const blockedLocations = ['United States', 'Vereinigte Staaten von Amerika', 'United Kingdom', 'Großbritannien', 'China', 'Italien', 'Italy'];
// Funktsioon kuulutuste eemaldamiseks
function removeListings() {
console.log('Running removeListings');
let items = document.querySelectorAll('.s-item');
items.forEach(item => {
let locationElement = item.querySelector('.s-item__itemLocation');
if (locationElement) {
if (blockedLocations.some(location => locationElement.textContent.includes(location))) {
console.log('Hiding item:', locationElement.textContent);
item.style.display = 'none';
}
}
});
}
// Wait until the content is fully loaded
window.addEventListener('load', () => {
console.log('Page fully loaded');
removeListings();
const observer = new MutationObserver(() => {
removeListings();
});
observer.observe(document.body, {
childList: true,
subtree: true,
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment