summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-04-30 15:33:31 +0200
committerLars-Dominik Braun <lars@6xq.net>2015-04-30 15:33:31 +0200
commitaeb5666b39103f5419d5d006dec54a07e35a8528 (patch)
treec597e30d776be64b9ccfe03b9142ab65a27de26f
parent3b36848573d07b8b6600df0e0da777530cf23859 (diff)
downloadcomatose-aeb5666b39103f5419d5d006dec54a07e35a8528.tar.gz
comatose-aeb5666b39103f5419d5d006dec54a07e35a8528.tar.bz2
comatose-aeb5666b39103f5419d5d006dec54a07e35a8528.zip
Auto-sort/filter when loading document
-rw-r--r--data/script.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/data/script.js b/data/script.js
index f1e9a68..d680225 100644
--- a/data/script.js
+++ b/data/script.js
@@ -13,11 +13,8 @@ $(document).ready (function () {
});
protolist.append (items);
}
- $('#sort').change (function () {
- sortproto ($(this).val ());
- });
- $('#filter').keyup (function () {
- var search = $(this).val ().toLowerCase ();
+ function filterproto (search) {
+ search = search.toLowerCase ()
var items = $('#protocols .protocol');
for (var i = 0; i < items.length; i++) {
var e = $(items[i]);
@@ -27,7 +24,14 @@ $(document).ready (function () {
e.hide ();
}
}
+ }
+ $('#sort').change (function () {
+ sortproto ($(this).val ());
+ });
+ $('#filter').keyup (function () {
+ filterproto ($(this).val ());
});
$('#protosort').show ();
- sortproto ('name');
+ sortproto ($('#sort').val ());
+ filterproto ($('#filter').val ());
});