Add to watch list directly from eBay search result; also, stop redirecting to similar item.
当前为
// ==UserScript==
// @name eBay Watch
// @namespace eBay
// @version 1.2.1
// @description Add to watch list directly from eBay search result; also, stop redirecting to similar item.
// @author denis hebert
// @license GNU GPL-3.0-or-later
// @match *://*/mye/*
// @match *://*/itm/*
// @match *://*/sch/i.html*
// @icon https://www.google.com/s2/favicons?sz=64&domain=ebay.ca
// @grant none
// ==/UserScript==
'use strict';
(function(w, d, list, n, i, e) {
// 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" : "?nordt=true";
}
// 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
}
else {
list = d.getElementsByClassName("SECONDARY_INFO");
n = list.length;
for (i = 0; i < n; i++) // Add an "Add to watch list" link for each item of the page
list[i].innerHTML += " <a target='eBay item to watch' href='" + list[i].parentNode.previousSibling.href + "'>Add to watch list</a>"
}
})(window, document);