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