diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/index.html | 1 | ||||
-rw-r--r-- | static/init.js | 11 |
2 files changed, 11 insertions, 1 deletions
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 @@ <input type="text" id="search_box" /> <span> <input type="button" id="search-add" value="Add selected" /> + <span id="search-info"></span> </span> <table class="track-table"> <thead> 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('<tr><td colspan="3"><img src="/static/icons/loading.gif" alt="Searching..." /> Searching...</td></tr>'); 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) { |