summaryrefslogtreecommitdiff
path: root/plugins/newmail_notifier/newmail_notifier.js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-09-12 12:06:12 +0200
committerAleksander Machniak <alec@alec.pl>2013-09-12 12:06:12 +0200
commitf806ed5c9e66e970efb958f087530b1b75afcd78 (patch)
tree8ee50bf2413ba1c470704c761b64a8bf9bef777a /plugins/newmail_notifier/newmail_notifier.js
parent44cb96ad6f75eb4a666067c062e8618b3f35fb60 (diff)
Implemented configurable timeout for desktop notification (#1489205)
Diffstat (limited to 'plugins/newmail_notifier/newmail_notifier.js')
-rw-r--r--plugins/newmail_notifier/newmail_notifier.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/plugins/newmail_notifier/newmail_notifier.js b/plugins/newmail_notifier/newmail_notifier.js
index b00f33d10..846bc94c3 100644
--- a/plugins/newmail_notifier/newmail_notifier.js
+++ b/plugins/newmail_notifier/newmail_notifier.js
@@ -90,13 +90,11 @@ function newmail_notifier_sound()
// - Require Chrome or Firefox latest version (22+) / 21.0 or older with a plugin
function newmail_notifier_desktop(body)
{
+ var timeout = rcmail.env.newmail_notifier_timeout || 10;
-/**
- * Fix: As of 17 June 2013, Chrome/Chromium does not implement Notification.permission correctly that
- * it gives 'undefined' until an object has been created:
- * https://code.google.com/p/chromium/issues/detail?id=163226
- *
- */
+ // As of 17 June 2013, Chrome/Chromium does not implement Notification.permission correctly that
+ // it gives 'undefined' until an object has been created:
+ // https://code.google.com/p/chromium/issues/detail?id=163226
try {
if (Notification.permission == 'granted' || Notification.permission == undefined) {
var popup = new Notification(rcmail.gettext('title', 'newmail_notifier'), {
@@ -109,7 +107,7 @@ function newmail_notifier_desktop(body)
popup.onclick = function() {
this.close();
}
- setTimeout(function() { popup.close(); }, 10000); // close after 10 seconds
+ setTimeout(function() { popup.close(); }, timeout * 1000);
if (popup.permission == 'granted') return true;
}
}
@@ -125,7 +123,7 @@ function newmail_notifier_desktop(body)
this.cancel();
}
popup.show();
- setTimeout(function() { popup.cancel(); }, 10000); // close after 10 seconds
+ setTimeout(function() { popup.cancel(); }, timeout * 1000);
rcmail.newmail_popup = popup;
return true;
}