From e745764fc55043f6107f68986f82845310537fee Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Fri, 21 Dec 2012 22:07:45 +0100 Subject: Added feedback and limits to searches. --- static/index.html | 1 + static/init.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'static') diff --git a/static/index.html b/static/index.html index b320435..0fc0023 100644 --- a/static/index.html +++ b/static/index.html @@ -52,6 +52,7 @@ + diff --git a/static/init.js b/static/init.js index 117e8d9..c4f6c2c 100644 --- a/static/init.js +++ b/static/init.js @@ -236,8 +236,17 @@ $(document).ready(function() { }); $('#search_box').keypress(function(event) { if(event.keyCode == 13) { + $('#search-results').empty(); + $('#search-results').append(''); var val = $(this).val(); - $.get('/json/search?q=' + encodeURIComponent(val), set_tracks($('#search-results'), $('#search-add')), 'json'); + $.get('/json/search?q=' + encodeURIComponent(val), function(data) { + var s = 'Showing ' + data.results.length; + if(data.total > data.results.length) + s += ' of ' + data.total; + s += ' results.'; + $('#search-info').text(s); + set_tracks($('#search-results'), $('#search-add'))(data.results); + }, 'json'); } }); $('#search-add').click(function(event) { -- cgit v1.2.3
Searching... Searching...