1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-05 22:36:16 +00:00

Fix: optimize code

This commit is contained in:
jcorporation 2018-11-11 23:56:42 +00:00
parent 83cb02c370
commit 0aa60f820f

View File

@ -565,42 +565,15 @@ function appInit() {
appGoto(app.current.app, app.current.tab, app.current.view, app.current.page + '/' + event.target.getAttribute('data-tag') + '/' + app.current.search);
}, false);
document.getElementById('QueueColsDropdown').addEventListener('click', function(event) {
if (event.target.nodeName == 'INPUT') {
event.stopPropagation();
}
}, false);
var dropdowns = ['QueueColsDropdown', 'BrowseFilesystemColsDropdown', 'SearchColsDropdown', 'BrowsePlaylistsDetailColsDropdown',
'BrowseDatabaseColsDropdown', 'PlaybackColsDropdown'];
for (var i = 0; i < dropdowns.length; i++) {
document.getElementById(dropdowns[i]).addEventListener('click', function(event) {
if (event.target.nodeName == 'INPUT')
event.stopPropagation();
}, false);
}
document.getElementById('BrowseFilesystemColsDropdown').addEventListener('click', function(event) {
if (event.target.nodeName == 'INPUT') {
event.stopPropagation();
}
}, false);
document.getElementById('SearchColsDropdown').addEventListener('click', function(event) {
if (event.target.nodeName == 'INPUT') {
event.stopPropagation();
}
}, false);
document.getElementById('BrowsePlaylistsDetailColsDropdown').addEventListener('click', function(event) {
if (event.target.nodeName == 'INPUT') {
event.stopPropagation();
}
}, false);
document.getElementById('BrowseDatabaseColsDropdown').addEventListener('click', function(event) {
if (event.target.nodeName == 'INPUT') {
event.stopPropagation();
}
}, false);
document.getElementById('PlaybackColsDropdown').addEventListener('click', function(event) {
if (event.target.nodeName == 'INPUT') {
event.stopPropagation();
}
}, false);
document.getElementById('search').addEventListener('submit', function() {
return false;
}, false);
@ -699,7 +672,6 @@ function appInit() {
function parseCmd(event, href) {
event.preventDefault();
event.stopPropagation();
var cmd = href;
if (typeof(href) == 'string')
cmd = JSON.parse(href);