]> git.wh0rd.org - tt-rss.git/blobdiff - offline.js
automatically extract i18n data from .js files
[tt-rss.git] / offline.js
index a509cebb02b84dadba6e5843e2199c4d10170b6d..010bbe05e2b94e00425face108b46890e497bb79 100644 (file)
@@ -658,8 +658,17 @@ function offline_download_parse(stage, transport) {
                        if (sync_ok.length > 0) {
                                for (var i = 0; i < sync_ok.length; i++) {
                                        var id = sync_ok[i].getAttribute("id");
+                                       var unread = sync_ok[i].getAttribute("unread");
+                                       var marked = sync_ok[i].getAttribute("marked");
+
                                        if (id) {
                                                debug("synced offline info for id " + id);
+
+                                               if (unread != undefined && marked != undefined) {
+                                                       db.execute("UPDATE articles SET "+
+                                                               "unread = ?, marked = ? WHERE id = ?", [unread, marked, id]);
+
+                                               }
                                                db.execute("UPDATE articles SET modified = '' WHERE id = ?", [id]);
                                        }
                                }
@@ -845,8 +854,6 @@ function update_offline_data(stage) {
 
                if (!db || offline_mode || getInitParam("offline_enabled") != "1") return;
 
-//             notify_progress("Updating offline data... (" + stage +")", true);
-
                var query = "backend.php?op=rpc&subop=download";
                
                var rs = db.execute("SELECT MAX(id), MIN(id) FROM articles");
@@ -1618,10 +1625,12 @@ function toggleOfflineModeInfo() {
        }
 }
 
-function offlineDownloadStart() {
+function offlineDownloadStart(stage) {
        try {
+               if (!stage) stage = 0;
+
                if (db && !sync_in_progress && getInitParam("offline_enabled") == "1") {
-                       window.setTimeout("update_offline_data(0)", 100);
+                       window.setTimeout("update_offline_data("+stage+")", 100);
                }
        } catch (e) {
                exception_error("offlineDownloadStart", e);