Skip to content

Instantly share code, notes, and snippets.

@abudden
Last active April 20, 2022 16:14
Show Gist options
  • Save abudden/6528452cb9aa4367a6d6da7aed3a58af to your computer and use it in GitHub Desktop.
Save abudden/6528452cb9aa4367a6d6da7aed3a58af to your computer and use it in GitHub Desktop.
ebay.co.uk doesn't have a blacklist feature - this tampermonkey script allows me to avoid buying from blacklisted sellers again
// ==UserScript==
// @name Ebay Blacklist
// @namespace https://www.cgtk.co.uk
// @version 0.1
// @description Make it clear when ebay sellers are on a blacklist
// @author A. Budden
// @match https://*.ebay.co.uk/itm/*
// @icon https://www.google.com/s2/favicons?domain=ebay.co.uk
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Put the blacklisted seller names in here:
var blacklist = [
'seller1',
'seller2',
'seller3',
'seller4',
'seller5'
];
var sellerObjs = document.getElementsByClassName('ux-seller-section__item--seller');
var foundSeller = false;
for (var sellerObj of sellerObjs) {
var subElements = sellerObj.getElementsByClassName('ux-textspans ux-textspans--PSEUDOLINK ux-textspans--BOLD');
for (var subElement of subElements) {
var seller = subElement.innerHTML;
if (blacklist.indexOf(seller) === -1) {
return;
}
foundSeller = true;
sellerObj.innerHTML = '<span class="blacklistBanner"><font color="red">BLACKLISTED!</font> </span>' + seller;
}
}
if ( ! foundSeller) {
return;
}
var titleObj = document.getElementsByClassName('x-item-title__mainTitle')[0];
titleObj.innerHTML = '<span class="blacklistBanner"><font color="red">BLACKLISTED SELLER!</font> </span>' + titleObj.innerHTML;
var blink_speed = 250; // every 250 == 0.25 second
var t = setInterval(function () {
var eles = document.getElementsByClassName('blacklistBanner');
for (var ele of eles) {
ele.style.visibility = (ele.style.visibility == 'hidden' ? '' : 'hidden');
}
}, blink_speed);
})();
@abudden
Copy link
Author

abudden commented Apr 20, 2022

Updated to match changes to ebay website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment