eBay Filter Active Inventory

Search filter for the current inventory

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        eBay Filter Active Inventory
// @namespace   riceball
// @description Search filter for the current inventory
// @include     http://my.ebay.com/*
// @version     1
// @grant       none
// @resource $ 
// ==/UserScript==

/*
  This is a script for people selling things on eBay.
  
  This script adds a "filter" box to the table of active listings.
  You can type in a search term, and everything matching the term
  will be filtered in.  Everything else will be deleted from the 
  list.  After you filter, you cannot "undo" or remove the filter
  to see all the rows again.  You need to refresh the page.
  
  Display a lot of rows to have more stuff to filter.
  
  The best way to use this is to title your listings consistently,
  so you can quickly find subsets of your listings.  
*/

function mytool($) {
    function myfilter(evt) {
        evt.preventDefault();
        console.log("myfilter called");
        var search = new RegExp($("#mysearchfield").val(), 'iu');
        $(".my_itl-itR").each(function (idx, el) {
            var title = $(this).find("td").eq(3).find("div>div>a.g-asm").attr("title");
            if (! title.match(search)) {
                console.log( title, " did not match");
                //$(this).hide();
                $(this).remove();
            } else {
                console.log( title, " matches");
            }
        });
    }

    function button_attacher() {
        console.log("button_attacher trying to attach");
        if ($('#ItemDisplayContainer_SellingNext').length > 0) {
	        $mybutton = $('<input id="mysearchfield" value="" style="margin-left: 7px;" /><button id="mysearchbutton" style="margin-right: 9px;">Filter</button>');
	        $mybutton.click(myfilter);
	        $thing = $('#ItemDisplayContainer_SellingNext').find('.r3_hm>table>tbody>tr>td>h2:first');
	        $thing.append($mybutton);
	        window.clearInterval(myattacher);
	        myattacher = undefined;
        } else {
	        console.log("found no dialog - skipping");
        }
    }

    myattacher = window.setInterval(button_attacher, 1000); // every 10 seconds, try to attach the button to the dialog.

}

// Check if jQuery's loaded
function GM_wait() {
    if (typeof window.jQuery == 'undefined') {
        window.setTimeout(GM_wait, 100);
    } else {
        mytool(window.jQuery);
    }
}

GM_wait();