1
0
mirror of https://github.com/SuperBFG7/ympd synced 2025-05-23 17:44:09 +00:00

Feat: jukebox mode #37

Fix: append song after playing song
This commit is contained in:
jcorporation 2018-09-17 23:25:50 +01:00
parent d49baea123
commit 355b4000b3

View File

@ -777,7 +777,7 @@ function toggleBtn(btn, state) {
if (state == undefined) if (state == undefined)
state = b.classList.contains('active') ? 0 : 1; state = b.classList.contains('active') ? 0 : 1;
if (state == 1) if (state == 1 || state == true)
b.classList.add('active'); b.classList.add('active');
else else
b.classList.remove('active'); b.classList.remove('active');
@ -788,6 +788,7 @@ function parseSettings(obj) {
toggleBtn('btnConsume', obj.data.consume); toggleBtn('btnConsume', obj.data.consume);
toggleBtn('btnSingle', obj.data.single); toggleBtn('btnSingle', obj.data.single);
toggleBtn('btnRepeat', obj.data.repeat); toggleBtn('btnRepeat', obj.data.repeat);
toggleBtn('btnJukebox', obj.data.jukeboxMode);
if (obj.data.crossfade != undefined) { if (obj.data.crossfade != undefined) {
document.getElementById('inputCrossfade').removeAttribute('disabled'); document.getElementById('inputCrossfade').removeAttribute('disabled');
@ -821,7 +822,7 @@ function parseSettings(obj) {
toggleBtn('btnnotifyWeb', 1); toggleBtn('btnnotifyWeb', 1);
} else { } else {
toggleBtn('btnnotifyWeb', 0); toggleBtn('btnnotifyWeb', 0);
obj.data.notificationWeb = 0; obj.data.notificationWeb = true;
} }
}); });
} }
@ -942,7 +943,7 @@ function parseState(obj) {
playstate = 'pause'; playstate = 'pause';
} }
if (obj.data.nextSongPos == -1) if (obj.data.nextSongPos == -1 && settings.jukeboxMode == false)
domCache.btnNext.setAttribute('disabled','disabled'); domCache.btnNext.setAttribute('disabled','disabled');
else else
domCache.btnNext.removeAttribute('disabled'); domCache.btnNext.removeAttribute('disabled');
@ -1692,7 +1693,7 @@ function showMenu(el, event) {
} }
if (lastState) if (lastState)
nextsongpos = lastState.data.nextsongpos; nextsongpos = lastState.data.nextSongPos;
var menu = ''; var menu = '';
if ((app.current.app == 'Browse' && app.current.tab == 'Filesystem') || app.current.app == 'Search' || if ((app.current.app == 'Browse' && app.current.tab == 'Filesystem') || app.current.app == 'Search' ||
@ -1924,8 +1925,9 @@ function confirmSettings() {
"crossfade": document.getElementById('inputCrossfade').value, "crossfade": document.getElementById('inputCrossfade').value,
"mixrampdb": (settings.mixramp == true ? document.getElementById('inputMixrampdb').value : settings.mixrampdb), "mixrampdb": (settings.mixramp == true ? document.getElementById('inputMixrampdb').value : settings.mixrampdb),
"mixrampdelay": (settings.mixramp == true ? document.getElementById('inputMixrampdelay').value : settings.mixrampdelay), "mixrampdelay": (settings.mixramp == true ? document.getElementById('inputMixrampdelay').value : settings.mixrampdelay),
"notificationWeb": (document.getElementById('btnnotifyWeb').classList.contains('active') ? 1 : 0), "notificationWeb": (document.getElementById('btnnotifyWeb').classList.contains('active') ? true : false),
"notificationPage": (document.getElementById('btnnotifyPage').classList.contains('active') ? 1 : 0) "notificationPage": (document.getElementById('btnnotifyPage').classList.contains('active') ? true : false),
"jukeboxMode": (document.getElementById('btnJukebox').classList.contains('active') ? true : false)
}}, getSettings); }}, getSettings);
modalSettings.hide(); modalSettings.hide();
} else } else
@ -1986,13 +1988,13 @@ function saveQueue() {
} }
function showNotification(notificationTitle,notificationText,notificationHtml,notificationType) { function showNotification(notificationTitle,notificationText,notificationHtml,notificationType) {
if (settings.notificationWeb == 1) { if (settings.notificationWeb == true) {
var notification = new Notification(notificationTitle, {icon: 'assets/favicon.ico', body: notificationText}); var notification = new Notification(notificationTitle, {icon: 'assets/favicon.ico', body: notificationText});
setTimeout(function(notification) { setTimeout(function(notification) {
notification.close(); notification.close();
}, 3000, notification); }, 3000, notification);
} }
if (settings.notificationPage == 1) { if (settings.notificationPage == true) {
var alertBox; var alertBox;
if (!document.getElementById('alertBox')) { if (!document.getElementById('alertBox')) {
alertBox = document.createElement('div'); alertBox = document.createElement('div');