1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-10-28 04:17:40 +00:00

cleanup: remove search from main menu

cleanup: coding style
This commit is contained in:
jcorporation
2018-07-16 00:56:58 +01:00
parent 9b71a5e6ae
commit 02c9a5635e
3 changed files with 35 additions and 63 deletions

View File

@@ -36,10 +36,6 @@ button {
min-width: 50px;
}
#search {
width: 200px;
}
.card {
min-height:350px;
}

View File

@@ -23,10 +23,6 @@
<span class="material-icons header-logo">play_circle_outline</span>myMPD
</a>
<div class="dropdown-menu bg-dark">
<form id="search" class="px-4 py-3" role="search">
<input id="inputSearch" type="text" class="form-control" placeholder="Search">
</form>
<div class="dropdown-divider"></div>
<a id="nav-addstream" class="dropdown-item text-light bg-dark" href="#" data-toggle="modal" data-target="#modalAddstream">Add Stream</a>
<a id="nav-updatedb" class="dropdown-item text-light bg-dark" href="#" data-href="{'cmd':'updateDB','options':[]}">Update Database</a>
<a id="nav-localplayer" class="dropdown-item text-light bg-dark" href="#" data-href="{'cmd':'openLocalPlayer','options':[]}">Local Player</a>
@@ -381,15 +377,15 @@
</div>
<div class="card-body">
<div class="btn-toolbar card-toolbar" id="SearchButtons" role="toolbar">
<form id="search2" role="search">
<form id="search" role="search">
<div class="input-group mr-2">
<input type="text" class="form-control" placeholder="Search" id="searchstr2"/>
<input type="text" class="form-control" placeholder="Search" id="searchstr"/>
<div class="input-group-append">
<button title="Select tags to search" class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown">
<span class="material-icons">search</span>
<span id="searchtags2desc">Any Tag</span>
<span id="searchtagsdesc">Any Tag</span>
</button>
<div class="dropdown-menu bg-dark dropdown-menu-right px-2" id="searchtags2">
<div class="dropdown-menu bg-dark dropdown-menu-right px-2" id="searchtags">
<h6 class="dropdown-header text-light">Search in Tag</h6>
<button type="button" class="btn btn-secondary active btn-block">Any Tag</button>
<button type="button" class="btn btn-secondary btn-block">Title</button>

View File

@@ -168,11 +168,13 @@ function appRoute() {
}
else if (app.current.app == 'Queue' ) {
document.getElementById('QueueList').classList.add('opacity05');
/*
if (app.last.app != app.current.app) {
if (app.current.search.length < 2) {
setPagination(app.current.page);
}
}
*/
var btns = document.getElementById('searchqueuetag').getElementsByTagName('button');
for (var i = 0; i < btns.length; i++) {
btns[i].classList.remove('active');
@@ -232,17 +234,17 @@ function appRoute() {
doSetFilterLetter('BrowseFilesystemFilter');
}
else if (app.current.app == 'Search') {
document.getElementById('searchstr2').focus();
document.getElementById('searchstr').focus();
document.getElementById('SearchList').classList.add('opacity05');
if (app.last.app != app.current.app) {
if (app.current.search != '')
document.getElementById('SearchList').getElementsByTagName('tbody')[0].innerHTML=
'<tr><td><span class="material-icons">search</span></td>' +
'<td colspan="5">Searching...</td></tr>';
else
setPagination(app.current.page);
// else
// setPagination(app.current.page);
document.getElementById('searchstr2').value = app.current.search;
// document.getElementById('searchstr').value = app.current.search;
}
if (app.current.search.length >= 2) {
@@ -251,17 +253,17 @@ function appRoute() {
document.getElementById('SearchList').getElementsByTagName('tbody')[0].innerHTML = '';
document.getElementById('searchAddAllSongs').setAttribute('disabled', 'disabled');
document.getElementById('panel-heading-search').innerText = '';
setPagination(app.current.page);
// setPagination(app.current.page);
document.getElementById('SearchList').classList.remove('opacity05');
}
var btns = document.getElementById('searchtags2').getElementsByTagName('button');
var btns = document.getElementById('searchtags').getElementsByTagName('button');
var btnsLen = btns.length;
for (var i = 0; i < btnsLen; i++) {
btns[i].classList.remove('active');
if (btns[i].innerText == app.current.filter) {
btns[i].classList.add('active');
document.getElementById('searchtags2desc').innerText = btns[i].innerText;
document.getElementById('searchtagsdesc').innerText = btns[i].innerText;
}
}
}
@@ -313,16 +315,6 @@ function appInit() {
addStream();
});
document.getElementById('mainMenu').addEventListener('shown.bs.dropdown', function () {
var si = document.getElementById('inputSearch');
si.value = '';
si.focus();
});
document.getElementById('inputSearch').addEventListener('click', function(event) {
event.stopPropagation();
});
addFilterLetter('BrowseFilesystemFilterLetters');
addFilterLetter('BrowseDatabaseFilterLetters');
addFilterLetter('BrowsePlaylistsFilterLetters');
@@ -418,7 +410,7 @@ function appInit() {
}
}, false);
document.getElementById('searchtags2').addEventListener('click', function(event) {
document.getElementById('searchtags').addEventListener('click', function(event) {
if (event.target.nodeName == 'BUTTON')
appGoto(app.current.app, app.current.tab, app.current.view, '0/' + event.target.innerText + '/' + app.current.search);
}, false);
@@ -432,19 +424,7 @@ function appInit() {
appGoto(app.current.app, app.current.tab, app.current.view, app.current.page + '/' + event.target.innerText + '/' + app.current.search);
}, false);
document.getElementById('inputSearch').addEventListener('keypress', function (event) {
if ( event.which == 13 )
mainMenu.toggle();
}, false);
document.getElementById('search').addEventListener('submit', function () {
var searchStr = document.getElementById('inputSearch').value;
appGoto('Search', undefined, undefined, app.current.page + '/Any Tag/' + searchStr);
document.getElementById('searchstr2').value = searchStr;
return false;
}, false);
document.getElementById('search2').addEventListener('submit', function () {
return false;
}, false);
@@ -452,7 +432,7 @@ function appInit() {
return false;
}, false);
document.getElementById('searchstr2').addEventListener('keyup', function (event) {
document.getElementById('searchstr').addEventListener('keyup', function (event) {
appGoto('Search', undefined, undefined, '0/' + app.current.filter + '/' + this.value);
}, false);