Add to watch list directly from eBay search result + Stop redirecting to similar item + skip the sponsor items
当前为
// ==UserScript==
// @name eBay Watch
// @namespace eBay
// @version 1.4.0
// @description Add to watch list directly from eBay search result + Stop redirecting to similar item + skip the sponsor items
// @author denis hebert
// @license GNU GPL-3.0-or-later
// @match *://*/mye/*
// @match *://*/itm/*
// @match *://*/sch/i.html*
// @match *://*/d/*
// @run-at document-end
// @icon https://www.google.com/s2/favicons?sz=64&domain=ebay.ca
// @grant none
// ==/UserScript==
'use strict';
(function(w, d, list, n, i, e) {
// If we're in our named pop-up window (see the else below to know where it comes from)
if (w.name === "eBay item to watch") { // if it's our temporary named window containing an item
d.getElementById("atl_-99").click(); // Activate the item "Add to watch list"
w.close(); // Close that temporary window
}
// Add an "Add to watch list" link for each item of the page
list = d.getElementsByClassName("SECONDARY_INFO");
n = list.length;
for (i = 0; i < n; i++)
list[i].innerHTML += " <a target='eBay item to watch' href='" + list[i].parentNode.previousSibling.href + "'>Add to watch list</a>";
// Remove some sponsors
if ( e = d.getElementById("placement_html_101197") ) e.remove(); // Remove Similar sponsors
if ( e = d.getElementById("placement_html_101198") ) e.remove(); // Remove Related sponsors
// Add a No redirecting to similar item at the end of all item href found
list = d.getElementsByTagName("a");
n = list.length;
for (i = 0; i < n; i++) {
e = list[i];
if ( "href" in e && e.href.includes("/itm/") )
e.href += (e.href.includes("?") ? "&" : "?") + "nordt=true#CenterPanelInternal";
}
location.replace("#s0-28_2-9-0-1[0]-0-0") // Skip the sponsor items
})(window, document);