mirror of
https://github.com/SuperBFG7/ympd
synced 2025-04-13 06:13:15 +00:00
Fix: variuous cleanups
This commit is contained in:
parent
0cc0e54e0c
commit
cd7cf572f0
@ -136,7 +136,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<button type="button" class="btn btn-secondary material-icons" data-href='{"cmd": "sendAPI", "options": [{"cmd": "MPD_API_QUEUE_CLEAR"}]}' title="Clear queue">clear_all</button>
|
||||
<button id="clearQueueBtn" class="btn btn-secondary dropdown-toggle dropdown-toggle-split rounded-right" type="button" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu bg-dark dropdown-menu-right px-2" id="clearQueueDropdown">
|
||||
<div class="dropdown-menu bg-dark px-2" id="clearQueueDropdown">
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block" data-href='{"cmd": "sendAPI", "options": [{"cmd": "MPD_API_QUEUE_CLEAR"}]}' >Clear queue</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block" data-href='{"cmd": "sendAPI", "options": [{"cmd": "MPD_API_QUEUE_CROP"}]}' >Crop queue</button>
|
||||
</div>
|
||||
@ -144,15 +144,16 @@
|
||||
</div>
|
||||
<form id="searchqueue" class="flex-grow-1">
|
||||
<div class="input-group mr-2">
|
||||
<input type="text" class="form-control" placeholder="Search Queue" id="searchqueuestr"/>
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-prepend">
|
||||
<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="searchqueuetagsdesc">Any Tag</span>
|
||||
</button>
|
||||
<div class="dropdown-menu bg-dark dropdown-menu-right px-2" id="searchqueuetags">
|
||||
<div class="dropdown-menu bg-dark px-2" id="searchqueuetags">
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="form-control" placeholder="Search Queue" id="searchqueuestr"/>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<div id="QueueCurrentPaginationTop" class="btn-group mr-2 hide">
|
||||
@ -447,7 +448,7 @@
|
||||
<div class="input-group-prepend">
|
||||
<button data-href='{"cmd": "addAllFromBrowseFilesystem", "options": []}' id="BrowseFilesystemAddAllSongs" class="btn btn-secondary material-icons">library_add</button>
|
||||
<button id="BrowseFilesystemAddAllSongsBtn" class="btn btn-secondary dropdown-toggle dropdown-toggle-split rounded-right" type="button" data-toggle="dropdown"></button>
|
||||
<div class="dropdown-menu bg-dark dropdown-menu-right px-2" id="BrowseFilesystemAddAllSongsDropdown">
|
||||
<div class="dropdown-menu bg-dark px-2" id="BrowseFilesystemAddAllSongsDropdown">
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block">Add all to queue</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm btn-block featPlaylists">Add all to playlist</button>
|
||||
</div>
|
||||
|
@ -90,6 +90,8 @@ domCache.currentTitle = document.getElementById('currentTitle');
|
||||
domCache.btnVoteUp = document.getElementById('btnVoteUp');
|
||||
domCache.btnVoteDown = document.getElementById('btnVoteDown');
|
||||
domCache.badgeQueueItems = document.getElementById('badgeQueueItems');
|
||||
domCache.searchstr = document.getElementById('searchstr');
|
||||
domCache.searchCrumb = document.getElementById('searchCrumb');
|
||||
|
||||
var modalConnectionError = new Modal(document.getElementById('modalConnectionError'), { backdrop: 'static', keyboard: false});
|
||||
var modalSettings = new Modal(document.getElementById('modalSettings'));
|
||||
@ -274,8 +276,7 @@ function appRoute() {
|
||||
doSetFilterLetter('BrowseFilesystemFilter');
|
||||
}
|
||||
else if (app.current.app == 'Search') {
|
||||
var searchstrEl = document.getElementById('searchstr');
|
||||
searchstrEl.focus();
|
||||
domCache.searchstr.focus();
|
||||
if (settings.featAdvsearch) {
|
||||
var crumbs = '';
|
||||
var elements = app.current.search.substring(1, app.current.search.length - 1).split(' AND ');
|
||||
@ -283,12 +284,12 @@ function appRoute() {
|
||||
var value = elements[i].substring(1, elements[i].length - 1);
|
||||
crumbs += '<button data-filter="' + encodeURI(value) + '" class="btn btn-light mr-2">' + value + '<span class="ml-2 badge badge-secondary">×</span></button>';
|
||||
}
|
||||
document.getElementById('searchCrumb').innerHTML = crumbs;
|
||||
if (searchstrEl.value == '' && elements.length >= 1) {
|
||||
domCache.searchCrumb.innerHTML = crumbs;
|
||||
if (domCache.searchstr.value == '' && elements.length >= 1) {
|
||||
var lastEl = elements[elements.length - 1].substring(1, elements[elements.length - 1].length - 1);
|
||||
var lastElValue = lastEl.substring(lastEl.indexOf('\'') + 1, lastEl.length - 1);
|
||||
if (searchstrEl.value != lastElValue)
|
||||
document.getElementById('searchCrumb').innerHTML += '<button data-filter="' + encodeURI(lastEl) +'" class="btn btn-light mr-2">' + lastEl + '<span href="#" class="ml-2 badge badge-secondary">×</span></button>';
|
||||
if (domCache.searchstr.value != lastElValue)
|
||||
domCache.searchCrumb.innerHTML += '<button data-filter="' + encodeURI(lastEl) +'" class="btn btn-light mr-2">' + lastEl + '<span href="#" class="ml-2 badge badge-secondary">×</span></button>';
|
||||
var match = lastEl.substring(lastEl.indexOf(' ') + 1);
|
||||
match = match.substring(0, match.indexOf(' '));
|
||||
if (match == '')
|
||||
@ -297,8 +298,8 @@ function appRoute() {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (searchstrEl.value == '' && app.current.search != '')
|
||||
searchstrEl.value = app.current.search;
|
||||
if (domCache.searchstr.value == '' && app.current.search != '')
|
||||
domCache.searchstr.value = app.current.search;
|
||||
}
|
||||
if (app.last.app != app.current.app) {
|
||||
if (app.current.search != '') {
|
||||
@ -310,7 +311,7 @@ function appRoute() {
|
||||
}
|
||||
}
|
||||
|
||||
if (app.current.search.length >= 2) {
|
||||
if (domCache.searchstr.value.length >= 2 || domCache.searchCrumb.children.length > 0) {
|
||||
if (settings.featAdvsearch) {
|
||||
var sort = document.getElementById('SearchList').getAttribute('data-sort');
|
||||
var sortdesc = false;
|
||||
@ -648,7 +649,7 @@ function appInit() {
|
||||
return false;
|
||||
}, false);
|
||||
|
||||
document.getElementById('searchstr').addEventListener('keyup', function(event) {
|
||||
domCache.searchstr.addEventListener('keyup', function(event) {
|
||||
if (event.key == 'Escape')
|
||||
this.blur();
|
||||
else if (event.key == 'Enter' && settings.featAdvsearch) {
|
||||
@ -659,7 +660,7 @@ function appInit() {
|
||||
li.setAttribute('data-filter', encodeURI(app.current.filter + ' ' + match.options[match.selectedIndex].value +' \'' + this.value + '\''));
|
||||
li.innerHTML = app.current.filter + ' ' + match.options[match.selectedIndex].value + ' \'' + this.value + '\'<span class="ml-2 badge badge-secondary">×</span>';
|
||||
this.value = '';
|
||||
document.getElementById('searchCrumb').appendChild(li);
|
||||
domCache.searchCrumb.appendChild(li);
|
||||
}
|
||||
else
|
||||
search(this.value);
|
||||
@ -668,7 +669,7 @@ function appInit() {
|
||||
search(this.value);
|
||||
}, false);
|
||||
|
||||
document.getElementById('searchCrumb').addEventListener('click', function(event) {
|
||||
domCache.searchCrumb.addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if (event.target.nodeName == 'SPAN') {
|
||||
@ -677,19 +678,19 @@ function appInit() {
|
||||
}
|
||||
else if (event.target.nodeName == 'BUTTON') {
|
||||
var value = decodeURI(event.target.getAttribute('data-filter'));
|
||||
document.getElementById('searchstr').value = value.substring(value.indexOf('\'') + 1, value.length - 1);
|
||||
domCache.searchstr.value = value.substring(value.indexOf('\'') + 1, value.length - 1);
|
||||
var filter = value.substring(0, value.indexOf(' '));
|
||||
selectTag('searchtags', 'searchtagsdesc', filter);
|
||||
var match = value.substring(value.indexOf(' ') + 1);
|
||||
match = match.substring(0, match.indexOf(' '));
|
||||
document.getElementById('searchMatch').value = match;
|
||||
event.target.remove();
|
||||
search(document.getElementById('searchstr').value);
|
||||
search(domCache.searchstr.value);
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.getElementById('searchMatch').addEventListener('change', function(event) {
|
||||
search(document.getElementById('searchstr').value);
|
||||
search(domCache.searchstr.value);
|
||||
}, false);
|
||||
|
||||
document.getElementById('SearchList').getElementsByTagName('tr')[0].addEventListener('click', function(event) {
|
||||
@ -831,7 +832,7 @@ function parseCmd(event, href) {
|
||||
function search(x) {
|
||||
if (settings.featAdvsearch) {
|
||||
var expression = '(';
|
||||
var crumbs = document.getElementById('searchCrumb').children;
|
||||
var crumbs = domCache.searchCrumb.children;
|
||||
for (var i = 0; i < crumbs.length; i++) {
|
||||
expression += '(' + decodeURI(crumbs[i].getAttribute('data-filter')) + ')';
|
||||
if (x != '') expression += ' AND ';
|
||||
@ -3107,7 +3108,7 @@ function focusSearch() {
|
||||
if (app.current.app == 'Queue')
|
||||
document.getElementById('searchqueuestr').focus();
|
||||
else if (app.current.app == 'Search')
|
||||
document.getElementById('searchstr').focus();
|
||||
domCache.searchstr.focus();
|
||||
else
|
||||
appGoto('Search');
|
||||
}
|
||||
|
@ -2053,7 +2053,7 @@ int mympd_put_playlists(char *buffer, unsigned int offset, char *filter) {
|
||||
entity_count++;
|
||||
if (entity_count > offset && entity_count <= offset + config.max_elements_per_page) {
|
||||
plpath = mpd_playlist_get_path(pl);
|
||||
if (strncmp(filter,"-",1) == 0 || strncasecmp(filter, plpath, 1) == 0 ||
|
||||
if (strncmp(filter, "-", 1) == 0 || strncasecmp(filter, plpath, 1) == 0 ||
|
||||
(strncmp(filter, "0", 1) == 0 && isalpha(*plpath) == 0 )
|
||||
) {
|
||||
if (entities_returned++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user