Add instant search to the market list

This commit is contained in:
Trever Fischer
2012-11-17 16:26:42 -05:00
parent 58e4d2d9dd
commit 1158858b7c
2 changed files with 26 additions and 3 deletions

13
static/js/market.js Normal file
View File

@@ -0,0 +1,13 @@
$(document).ready(function() {
$('#market-search').keypress(function() {
var needle = $(this).val().toLowerCase();
$('#market-prices tr.market-item').each(function (idx, item) {
var haystack = $(item).find('[class|="inventory-item"] .name').text().toLowerCase();
if (haystack.search(needle) == -1) {
item.style.display = "none";
} else {
item.style.display = null;
}
});
});
});