mirror of
https://github.com/SuperBFG7/ympd
synced 2025-10-23 18:07:42 +00:00
Fix notifications
This commit is contained in:
@@ -200,12 +200,10 @@ div#alertBox {
|
|||||||
opacity:0;
|
opacity:0;
|
||||||
visibility:visible;
|
visibility:visible;
|
||||||
transition:opacity 0.5s ease-in;
|
transition:opacity 0.5s ease-in;
|
||||||
display:none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.alertBoxActive {
|
div.alertBoxActive {
|
||||||
opacity:1 !important;
|
opacity:1 !important;
|
||||||
visibility:visible !important;
|
visibility:visible !important;
|
||||||
transition:opacity 0.5s ease-in;
|
transition:opacity 0.5s ease-in;
|
||||||
display:block !important;
|
|
||||||
}
|
}
|
@@ -463,10 +463,6 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<!-- Notifications -->
|
|
||||||
<div id="alertBox" class="alert alert-success"></div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal -->
|
<!-- Modal -->
|
||||||
<div class="modal" id="modalConnectionError" role="dialog">
|
<div class="modal" id="modalConnectionError" role="dialog">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
|
@@ -66,7 +66,6 @@ domCache.btnNext = document.getElementById('btnNext');
|
|||||||
domCache.progressBar = document.getElementById('progressBar');
|
domCache.progressBar = document.getElementById('progressBar');
|
||||||
domCache.volumeBar = document.getElementById('volumeBar');
|
domCache.volumeBar = document.getElementById('volumeBar');
|
||||||
domCache.outputs = document.getElementById('outputs');
|
domCache.outputs = document.getElementById('outputs');
|
||||||
domCache.alertBox = document.getElementById('alertBox');
|
|
||||||
|
|
||||||
function appPrepare() {
|
function appPrepare() {
|
||||||
if (app.current.app != app.last.app || app.current.tab != app.last.tab || app.current.view != app.last.view) {
|
if (app.current.app != app.last.app || app.current.tab != app.last.tab || app.current.view != app.last.view) {
|
||||||
@@ -243,7 +242,7 @@ function appRoute() {
|
|||||||
app.last.view = app.current.view;
|
app.last.view = app.current.view;
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function(){
|
function appInit() {
|
||||||
getSettings();
|
getSettings();
|
||||||
sendAPI({"cmd":"MPD_API_GET_OUTPUTNAMES"}, parseOutputnames);
|
sendAPI({"cmd":"MPD_API_GET_OUTPUTNAMES"}, parseOutputnames);
|
||||||
|
|
||||||
@@ -438,7 +437,7 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}, false);
|
}, false);
|
||||||
});
|
}
|
||||||
|
|
||||||
function webSocketConnect() {
|
function webSocketConnect() {
|
||||||
socket = new WebSocket(get_appropriate_ws_url());
|
socket = new WebSocket(get_appropriate_ws_url());
|
||||||
@@ -1246,12 +1245,25 @@ function showNotification(notificationTitle,notificationText,notificationHtml,no
|
|||||||
}, 3000, notification);
|
}, 3000, notification);
|
||||||
}
|
}
|
||||||
if (settings.notificationPage == 1) {
|
if (settings.notificationPage == 1) {
|
||||||
domCache.alertBox.innerHTML = '<strong>' + notificationTitle + '</strong>' + notificationHtml;
|
var alertBox;
|
||||||
domCache.alertBox.classList.add('alertBoxActive');
|
if (!document.getElementById('alertBox')) {
|
||||||
|
alertBox = document.createElement('div');
|
||||||
|
alertBox.setAttribute('id','alertBox');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alertBox = document.getElementById('alertBox');
|
||||||
|
}
|
||||||
|
alertBox.classList.add('alert','alert-' + notificationType);
|
||||||
|
alertBox.innerHTML = '<div><strong>' + notificationTitle + '</strong>' + notificationHtml + '</div>';
|
||||||
|
document.getElementsByTagName('main')[0].append(alertBox);
|
||||||
|
document.getElementById('alertBox').classList.add('alertBoxActive');
|
||||||
if (timeOut)
|
if (timeOut)
|
||||||
clearTimeout(timeOut);
|
clearTimeout(timeOut);
|
||||||
timeOut = setTimeout(function(notificationTitle) {
|
timeOut = setTimeout(function() {
|
||||||
domCache.alertBox.classList.remove('alertBoxActive');
|
document.getElementById('alertBox').classList.remove('alertBoxActive');
|
||||||
|
setTimeout(function() {
|
||||||
|
document.getElementById('alertBox').remove();
|
||||||
|
}, 600);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1367,3 +1379,6 @@ function beautifyDuration(x) {
|
|||||||
function genId(x) {
|
function genId(x) {
|
||||||
return 'id'+x.replace(/[^\w]/g,'');
|
return 'id'+x.replace(/[^\w]/g,'');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Init app
|
||||||
|
appInit();
|
Reference in New Issue
Block a user