Moved the if(enabled) to notification api

This commit is contained in:
Tim Windelschmidt 2016-01-06 08:28:39 +01:00
parent 4586e7e12a
commit e4fae9ca53
2 changed files with 24 additions and 22 deletions

View File

@ -86,10 +86,10 @@ gpower = new JustGage({
});
function stateNotification(state) {
if (state == true && laststate != true && laststate != null && enabledNotifications) {
if (state == true && laststate != true && laststate != null) {
laststate = true;
showNotification("CTDO - Status", "Der Chaostreff ist nun offen.", "/img/green.png", 4);
} else if (state == false && laststate != false && laststate != null && enabledNotifications) {
} else if (state == false && laststate != false && laststate != null) {
laststate = false;
showNotification("CTDO - Staus", "Der Chaostreff ist nun geschlossen", "/img/red.png", 4);
} else {

View File

@ -26,6 +26,7 @@ function toggleNotifications() {
function showNotification(name, body, icon, timeout) {
if (enabledNotifications) {
var instance = new Notification(
name, {
body: body,
@ -47,4 +48,5 @@ function showNotification(name, body, icon, timeout) {
instance.onclose = function () {
// Something to do
};
}
}