eBay Watch

Add to watch list directly from eBay search result; also, stop redirecting to similar item.

目前為 2022-09-25 提交的版本,檢視 最新版本

// ==UserScript==
// @name         eBay Watch
// @namespace    eBay
// @version      1.1.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(d, c, n, i, e) {
    c = d.getElementsByTagName("a");
    n = c.length;
    for (i = 0; i < n; i++) {
        e = c[i];
        if ( "href" in e && e.href.includes("/itm/") )
            e.href += e.href.includes("?") ? "&nordt=true" : "?nordt=true";
    }

    if (name === "eBay item to watch") {
       d.getElementById("atl_-99").click();
       window.close();
   }
   else {
       c = d.getElementsByClassName("SECONDARY_INFO");
       n = c.length;
       for (i = 0; i < n; i++)
           c[i].innerHTML += " <a target='eBay item to watch' href='" + c[i].parentNode.previousSibling.href + "'>Add to watch list</a>"
   }
})(document);