Skip to content

Commit

Permalink
Fixed issue #11 Pressing "Enter" in search field navigates to Playbac…
Browse files Browse the repository at this point in the history
…k tab

Fixed issue #12 Show search results for words with two characters
  • Loading branch information
jcorporation committed Jun 5, 2018
1 parent 8bf7729 commit 5cf9b5f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions htdocs/js/mpd.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var app = $.sammy(function() {
$('#cardQueue').removeClass('hide');
$('#navQueue').addClass('active');
}
if (searchstr.length >= 3) {
if (searchstr.length >= 2) {
socket.send('MPD_API_SEARCH_QUEUE,' + mpdtag + ','+pagination+',' + searchstr);
}
else {
Expand Down Expand Up @@ -191,7 +191,7 @@ var app = $.sammy(function() {
$('#cardSearch').removeClass('hide');
$('#navSearch').addClass('active');
}
if (searchstr.length >= 3) {
if (searchstr.length >= 2) {
socket.send('MPD_API_SEARCH,' + mpdtag + ','+pagination+',' + searchstr);
} else {
$('#searchList > tbody').empty();
Expand Down Expand Up @@ -1069,13 +1069,17 @@ function doSearch(searchstr) {
app.setLocation('#/search/' + pagination + '/' + mpdtag + '/' + searchstr);
}

$('#search2').submit(function () {
return false;
});

function addAllFromSearch() {
var mpdtag='Any Tag';
$('#searchtags2 > button').each(function() {
if ($(this).hasClass('btn-success')) { mpdtag=$(this).text(); }
});
var searchstr=$('#searchstr2').val();
if (searchstr.length >= 3) {
if (searchstr.length >= 2) {
socket.send('MPD_API_SEARCH_ADD,' + mpdtag + ',' + searchstr);
var rowCount = $('#searchList >tbody >tr').length;
showNotification('Added '+rowCount+' songs from search','','','success');
Expand Down Expand Up @@ -1119,6 +1123,10 @@ $('#searchqueue').submit(function () {
return false;
});

$('#searchqueue').submit(function () {
return false;
});

function scrollToTop() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
Expand Down

0 comments on commit 5cf9b5f

Please sign in to comment.