1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-28 03:40:26 +00:00

Click hides notification

This commit is contained in:
jcorporation 2018-07-11 00:12:36 +01:00
parent 1c0c9aa14f
commit 69d95a8ab1

View File

@ -1389,6 +1389,9 @@ function showNotification(notificationTitle,notificationText,notificationHtml,no
if (!document.getElementById('alertBox')) { if (!document.getElementById('alertBox')) {
alertBox = document.createElement('div'); alertBox = document.createElement('div');
alertBox.setAttribute('id', 'alertBox'); alertBox.setAttribute('id', 'alertBox');
alertBox.addEventListener('click', function() {
hideNotification();
}, false);
} }
else { else {
alertBox = document.getElementById('alertBox'); alertBox = document.getElementById('alertBox');
@ -1400,12 +1403,17 @@ function showNotification(notificationTitle,notificationText,notificationHtml,no
if (alertTimeout) if (alertTimeout)
clearTimeout(alertTimeout); clearTimeout(alertTimeout);
alertTimeout = setTimeout(function() { alertTimeout = setTimeout(function() {
if (document.getElementById('alertBox')) hideNotification();
}, 3000);
}
}
function hideNotification() {
if (document.getElementById('alertBox')) {
document.getElementById('alertBox').classList.remove('alertBoxActive'); document.getElementById('alertBox').classList.remove('alertBoxActive');
setTimeout(function() { setTimeout(function() {
document.getElementById('alertBox').remove(); document.getElementById('alertBox').remove();
}, 600); }, 600);
}, 3000);
} }
} }