Skip to content

Instantly share code, notes, and snippets.

@NielsH
Created December 6, 2013 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NielsH/7822660 to your computer and use it in GitHub Desktop.
Save NielsH/7822660 to your computer and use it in GitHub Desktop.
First version that adds realtime filtering of middlecoin addresses.
// ==UserScript==
// @name Middlecoin utilities
// @namespace http://middlecoin.com/
// @version 0.1
// @description Some extras for middlecoin, i.e. table search filter
// @match http://middlecoin.com/
// @copyright 2012+, KamiNuvini
// @run-at document-end
// @require http://code.jquery.com/jquery-2.0.3.min.js
// ==/UserScript==
// Realtime address search
$('table').before('<div id="searchbox"><b>Search address: </b><input id="search" type="search"></div>');
// Search snippet, thanks to dfsq at StackOverflow - http://stackoverflow.com/questions/9127498/how-to-perform-a-real-time-search-and-filter-on-a-html-table
var $rows = $('table tbody tr');
$('#search').keyup(function() {
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
$rows.show().filter(function() {
var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
return !~text.indexOf(val);
}).hide();
});
// End of realtime address search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment