This commit is contained in:
Stabosa87
2026-05-07 07:43:05 +00:00
committed by GitHub
parent 2159526b5d
commit e15300ddc8
+48
View File
@@ -0,0 +1,48 @@
// ==UserScript==
// @name ebay pricer
// @namespace ebay-pricer
// @version 1.0
// @description Adds shipping costs into the displayed ebay listing price.
// @author Stabosa87
// @match https://www.ebay.com/*
// @grant none
// ==/UserScript==
(function () {
function money(text) {
let m = text.match(/\$([\d.]+)/);
return m ? parseFloat(m[1]) : 0;
}
function update() {
document.querySelectorAll("li.s-card").forEach(card => {
if (card.dataset.priced) return;
let pricel = card.querySelector(".s-card__price");
if (!pricel) return;
let price = money(pricel.textContent);
let shipping = 0;
card.querySelectorAll(".s-card__attribute-row").forEach(row => {
if (row.textContent.includes("delivery") && row.textContent.includes("+$")) {
shipping = money(row.textContent);
}
});
if (shipping > 0) {
pricel.innerHTML += ` <span style="font-size:.85em;color:#666;">(or $${(price + shipping).toFixed(2)} total)</span>`;
}
card.dataset.priced = 1;
});
}
update();
new MutationObserver(update).observe(document.body, {
childList: true,
subtree: true
});
})();