summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-02-12 13:59:00 +0300
committerAndrew Dolgov <[email protected]>2009-02-12 13:59:00 +0300
commit0cd6bb46f7d8b8c11a8704603f9816e9f78d1ec9 (patch)
tree41981c9150e1ab67a3911541d2819f560b3c588e
parent5fe4848b5a734bf48c118730af15d2497c1f3261 (diff)
offline: automatically set version of manifest.json (using filemtime)
-rw-r--r--functions.js7
-rw-r--r--manifest.json.php96
-rw-r--r--offline.js2
3 files changed, 104 insertions, 1 deletions
diff --git a/functions.js b/functions.js
index 5c0564897..8355deb04 100644
--- a/functions.js
+++ b/functions.js
@@ -458,6 +458,13 @@ function parse_counters(reply, scheduled_call) {
var xmsg = elems[l].getAttribute("xmsg");
if (id == "global-unread") {
+
+ if (ctr > global_unread) {
+ if (db && getInitParam("offline_enabled") == "1") {
+ window.setTimeout("update_offline_data(0)", 100);
+ }
+ }
+
global_unread = ctr;
updateTitle();
continue;
diff --git a/manifest.json.php b/manifest.json.php
new file mode 100644
index 000000000..22ea4cda2
--- /dev/null
+++ b/manifest.json.php
@@ -0,0 +1,96 @@
+<?php
+ header("Content-Type: text/plain");
+
+ $manifest_formatted = array();
+ $manifest_files = array(
+ "tt-rss.php",
+ "tt-rss.css",
+ "viewfeed.js",
+ "feedlist.js",
+ "functions.js",
+ "offline.js",
+ "tt-rss.js",
+ "images/art-inline.png",
+ "images/art-zoom.png",
+ "images/blank_icon.gif",
+ "images/button.png",
+ "images/c1.png",
+ "images/c2.png",
+ "images/c3.png",
+ "images/c4.png",
+ "images/cat-collapse.png",
+ "images/down_arrow.png",
+ "images/favicon.png",
+ "images/feed-icon-12x12.png",
+ "images/feed-icon-64x64.png",
+ "images/footer.png",
+ "images/fresh_new.png",
+ "images/fresh.png",
+ "images/indicator_white.gif",
+ "images/label.png",
+ "images/mark_set.gif",
+ "images/mark_set.png",
+ "images/mark_unset.gif",
+ "images/mark_unset.png",
+ "images/new_version.png",
+ "images/offline.png",
+ "images/offline-sync.gif",
+ "images/online.png",
+ "images/overlay.png",
+ "images/piggie_icon.png",
+ "images/piggie.png",
+ "images/prefs-content.png",
+ "images/pub_set.gif",
+ "images/pub_unset.gif",
+ "images/resize_handle_horiz.png",
+ "images/resize_horiz.png",
+ "images/resizer.png",
+ "images/score_half_high.png",
+ "images/score_half_low.png",
+ "images/score_high.png",
+ "images/score_low.png",
+ "images/score_neutral.png",
+ "images/shadow_dark.png",
+ "images/shadow-grid.gif",
+ "images/shadow.png",
+ "images/shadow_white.png",
+ "images/sign_excl.gif",
+ "images/sign_info.gif",
+ "images/sign_quest.gif",
+ "images/small_question.png",
+ "images/tag.png",
+ "images/toolbar.png",
+ "images/ttrss_logo_big.png",
+ "images/ttrss_logo_blackred.png",
+ "images/ttrss_logo.png",
+ "images/ttrss_logo_small.png",
+ "images/updated.png",
+ "images/www.png",
+ "extras/button/musicplayer_f6.swf",
+ "extras/button/musicplayer.swf",
+ "lib/scriptaculous/effects.js",
+ "lib/scriptaculous/controls.js",
+ "lib/scriptaculous/dragdrop.js",
+ "lib/scriptaculous/scriptaculous.js",
+ "lib/prototype.js",
+ "gears_init.js");
+
+ $mtime_max = 0;
+
+ foreach ($manifest_files as $f) {
+ $tmp = filemtime($f);
+ if ($tmp > $mtime) {
+ $mtime_max = $tmp;
+ }
+
+ array_push($manifest_formatted, "{ \"url\": \"$f\" }");
+ }
+?>
+
+{
+ "betaManifestVersion": 1,
+ "version": "<?php echo $mtime_max ?>",
+ "entries": [
+ <?php echo join(",\n ", $manifest_formatted); ?>
+ ]
+}
diff --git a/offline.js b/offline.js
index f20559f2f..e6b77ed77 100644
--- a/offline.js
+++ b/offline.js
@@ -974,7 +974,7 @@ function init_gears() {
if (window.google && google.gears) {
localServer = google.gears.factory.create("beta.localserver");
store = localServer.createManagedStore("tt-rss");
- store.manifestUrl = "manifest.json";
+ store.manifestUrl = "manifest.json.php";
store.checkForUpdate();
db = google.gears.factory.create('beta.database');