eBay Filter Active Inventory

Search filter for the current inventory

  1. // ==UserScript==
  2. // @name eBay Filter Active Inventory
  3. // @namespace riceball
  4. // @description Search filter for the current inventory
  5. // @include http://my.ebay.com/*
  6. // @version 1
  7. // @grant none
  8. // @resource $
  9. // ==/UserScript==
  10.  
  11. /*
  12. This is a script for people selling things on eBay.
  13. This script adds a "filter" box to the table of active listings.
  14. You can type in a search term, and everything matching the term
  15. will be filtered in. Everything else will be deleted from the
  16. list. After you filter, you cannot "undo" or remove the filter
  17. to see all the rows again. You need to refresh the page.
  18. Display a lot of rows to have more stuff to filter.
  19. The best way to use this is to title your listings consistently,
  20. so you can quickly find subsets of your listings.
  21. */
  22.  
  23. function mytool($) {
  24. function myfilter(evt) {
  25. evt.preventDefault();
  26. console.log("myfilter called");
  27. var search = new RegExp($("#mysearchfield").val(), 'iu');
  28. $(".my_itl-itR").each(function (idx, el) {
  29. var title = $(this).find("td").eq(3).find("div>div>a.g-asm").attr("title");
  30. if (! title.match(search)) {
  31. console.log( title, " did not match");
  32. //$(this).hide();
  33. $(this).remove();
  34. } else {
  35. console.log( title, " matches");
  36. }
  37. });
  38. }
  39.  
  40. function button_attacher() {
  41. console.log("button_attacher trying to attach");
  42. if ($('#ItemDisplayContainer_SellingNext').length > 0) {
  43. $mybutton = $('<input id="mysearchfield" value="" style="margin-left: 7px;" /><button id="mysearchbutton" style="margin-right: 9px;">Filter</button>');
  44. $mybutton.click(myfilter);
  45. $thing = $('#ItemDisplayContainer_SellingNext').find('.r3_hm>table>tbody>tr>td>h2:first');
  46. $thing.append($mybutton);
  47. window.clearInterval(myattacher);
  48. myattacher = undefined;
  49. } else {
  50. console.log("found no dialog - skipping");
  51. }
  52. }
  53.  
  54. myattacher = window.setInterval(button_attacher, 1000); // every 10 seconds, try to attach the button to the dialog.
  55.  
  56. }
  57.  
  58. // Check if jQuery's loaded
  59. function GM_wait() {
  60. if (typeof window.jQuery == 'undefined') {
  61. window.setTimeout(GM_wait, 100);
  62. } else {
  63. mytool(window.jQuery);
  64. }
  65. }
  66.  
  67. GM_wait();