Commit e4fae9ca authored by fionera's avatar fionera

Moved the if(enabled) to notification api

parent 4586e7e1
......@@ -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 {
......
......@@ -26,25 +26,27 @@ function toggleNotifications() {
function showNotification(name, body, icon, timeout) {
var instance = new Notification(
name, {
body: body,
icon: icon
}
);
if (enabledNotifications) {
var instance = new Notification(
name, {
body: body,
icon: icon
}
);
instance.onclick = function () {
// Something to do
};
instance.onerror = function () {
// Something to do
};
instance.onshow = function () {
setTimeout(function(){
instance.close();
}, timeout * 1000);
};
instance.onclose = function () {
// Something to do
};
instance.onclick = function () {
// Something to do
};
instance.onerror = function () {
// Something to do
};
instance.onshow = function () {
setTimeout(function(){
instance.close();
}, timeout * 1000);
};
instance.onclose = function () {
// Something to do
};
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment