From 2dc740a27f3b9a3cff2798c35d2d8b379c2648f3 Mon Sep 17 00:00:00 2001 From: Mu-An Chiou Date: Fri, 3 Apr 2015 13:02:42 +0800 Subject: [PATCH 1/2] Add basic hash method --- index.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.html b/index.html index def31d3..f2ef0cd 100644 --- a/index.html +++ b/index.html @@ -218,6 +218,17 @@ numberOfSpots: gData.length }) $('#theNumberofSpots').html(theNumberofSpots) + + filterOnHash() + } + + window.onhashchange = filterOnHash + + function filterOnHash() { + if(window.location.hash) { + $('#tableFilter').val(window.location.hash.substring(1)).keyup() + $('.spotRow').first().click() + } } From 2d30417f38099c12bfdfb980f25f130643120f36 Mon Sep 17 00:00:00 2001 From: Mu-An Chiou Date: Fri, 3 Apr 2015 13:07:04 +0800 Subject: [PATCH 2/2] Change hash when filtering, select first after filter --- index.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index f2ef0cd..392eee9 100644 --- a/index.html +++ b/index.html @@ -219,17 +219,16 @@ }) $('#theNumberofSpots').html(theNumberofSpots) - filterOnHash() - } - - window.onhashchange = filterOnHash - - function filterOnHash() { if(window.location.hash) { $('#tableFilter').val(window.location.hash.substring(1)).keyup() $('.spotRow').first().click() } } + + $(document).on('keyup', '#tableFilter', function() { + window.location.hash = $(this).val() + $('.spotRow').first().click() + })