// ==UserScript== // @name SGW Menu Filterer // @namespace greasyfork.org // @version 1.4.1 // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js // @include https://sellers.shopgoodwill.com/* // @include http://*shopgoodwill.com* // @exclude https://sellers.shopgoodwill.com/sellers/newAuctionItem-catsel.asp* // @exclude https://sellers.shopgoodwill.com/sellers/fileUpload/* // @description Adds simple filters to menus on shopgoodwill // @downloadURL none // ==/UserScript== this.$ = this.jQuery = jQuery.noConflict(true); jQuery.fn.filterByText = function(textbox, selectSingleMatch) { return this.each(function() { var select = this; var options = []; $(select).find('option').each(function() { options.push({value: $(this).val(), text: $(this).text()}); }); $(select).data('options', options); $(textbox).bind('change keyup', function() { var options = $(select).empty().scrollTop(0).data('options'); var search = $.trim($(this).val()); var regex = new RegExp(search,'gi'); $.each(options, function(i) { var option = options[i]; if(option.text.match(regex) !== null) { $(select).append( $('