]> git.wh0rd.org - tt-rss.git/commitdiff
offline: automatically set version of manifest.json (using filemtime)
authorAndrew Dolgov <fox@bah.org.ru>
Thu, 12 Feb 2009 10:59:00 +0000 (13:59 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Thu, 12 Feb 2009 10:59:00 +0000 (13:59 +0300)
functions.js
manifest.json.php [new file with mode: 0644]
offline.js

index 5c0564897f967130d05c5292caf3201bee26935b..8355deb04bcaa374828c784d7537aad8f6b6a6a6 100644 (file)
@@ -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 (file)
index 0000000..22ea4cd
--- /dev/null
@@ -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); ?>
+    ]
+}
index f20559f2fc3c4229596023c805e9e5060f8a3226..e6b77ed772881e47d961d5d8c9dfdfbcf0d28c8a 100644 (file)
@@ -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');