summaryrefslogtreecommitdiff
path: root/utils/notifier/background.html
diff options
context:
space:
mode:
Diffstat (limited to 'utils/notifier/background.html')
-rw-r--r--utils/notifier/background.html37
1 files changed, 34 insertions, 3 deletions
diff --git a/utils/notifier/background.html b/utils/notifier/background.html
index 751456766..f67523bad 100644
--- a/utils/notifier/background.html
+++ b/utils/notifier/background.html
@@ -2,6 +2,7 @@
<script type="text/javascript">
var last_updated = 0;
+var feeds_last_updated = 0;
var prefs_last_updated = 0;
function param_escape(arg) {
@@ -11,7 +12,24 @@ function param_escape(arg) {
return escape(arg);
}
+function update_feeds() {
+
+ console.log("feeds update");
+
+ var requestUrl = localStorage["site_url"] + "/public.php?op=globalUpdateFeeds";
+
+ var xhr = new XMLHttpRequest();
+
+ xhr.open("POST", requestUrl, true);
+ xhr.send();
+
+ var d = new Date();
+ localStorage["last_feeds_updated"] = d.getTime();
+}
+
function update() {
+ console.log("update");
+
var d = new Date();
var login = localStorage["login"];
var single_user = localStorage["single_user"];
@@ -23,7 +41,6 @@ function update() {
var xhr = new XMLHttpRequest();
-
xhr.open("POST", requestUrl, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(params);
@@ -109,6 +126,7 @@ function timeout() {
var update_interval;
var prefs_updated;
+ var feeds_update_interval = 30 * 60 * 1000;
if (localStorage["update_interval"])
update_interval = localStorage["update_interval"] * 60 * 1000;
@@ -126,14 +144,27 @@ function timeout() {
prefs_updated != prefs_last_updated) {
last_updated = d.getTime();
- prefs_last_updated = prefs_updated;
try {
update();
} catch (e) {
- //
+ console.warn(e);
+ }
+ }
+
+ if (localStorage['update_feeds'] == 1 && (d.getTime() > feeds_last_updated + feeds_update_interval || prefs_updated != prefs_last_updated)) {
+
+ feeds_last_updated = d.getTime();
+
+ try {
+ update_feeds();
+ } catch (e) {
+ console.warn(e);
}
+
}
+ prefs_last_updated = prefs_updated;
+
window.setTimeout("timeout()", 1000);
}