Skip to content

Instantly share code, notes, and snippets.

@JanPokorny
Last active November 13, 2022 10:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JanPokorny/5283dd6a9c2698c5992aaa021767a8fd to your computer and use it in GitHub Desktop.
Save JanPokorny/5283dd6a9c2698c5992aaa021767a8fd to your computer and use it in GitHub Desktop.
UserScript to be used with Tampermonkey (Chrome) or Greasemonkey (Firefox). When searching for buy-it-now items on eBay, shows the actual price instead of the bogus item price that some shitty sellers add.
// ==UserScript==
// @name eBay quit your bullshit
// @namespace Puf
// @version 0.1
// @description When searching for buy-it-now items on eBay, shows the actual price instead of the bogus item price that some shitty sellers add
// @author Puf
// @match http://www.ebay.com/sch/*
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
var lis = document.querySelectorAll(".sresult.lvresult.clearfix.li");
for(var li of lis) {
handleLi(li);
}
function handleLi(li) {
var href = document.querySelector("#"+li.id+" > h3 > a").href;
GM_xmlhttpRequest({
method: "GET",
url: href,
onload: function(r) {
var re = /"convertedPrice":"(.+?)"/g, match, maxPrice = 0, maxPriceText = "";
while((match = re.exec(r.responseText))) {
var price = parseInt(match[1].split(" ")[0], 10);
if(price > maxPrice) {
maxPrice = price;
maxPriceText = match[1];
}
}
var span = document.querySelector("#"+li.id+" .lvprice.prc .bold");
if(span.innerText != maxPriceText)
span.innerHTML = "<span>" + maxPriceText + "</span> <small>("+span.innerText.trim()+")</small>";
},
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment