]> git.wh0rd.org - tt-rss.git/blobdiff - tt-rss.js
fix feedlist layout bug (take two) - remove unneeded CRs
[tt-rss.git] / tt-rss.js
index 0e71c0ecd97b5fe4fbc343402ad5680840a936fc..7b96bf3854c5962227a5a8fae74a9beb6a268f2e 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -5,8 +5,9 @@ var display_tags = false;
 var global_unread = -1;
 var active_title_text = "";
 var current_subtitle = "";
-
+var daemon_enabled = false;
 var _qfd_deleted_feed = 0;
+var firsttime_update = true;
 
 /*@cc_on @*/
 /*@if (@_jscript_version >= 5)
@@ -123,9 +124,11 @@ function refetch_callback() {
                        var f_document = window.frames["feeds-frame"].document;
 
                        parse_counters(reply, f_document, window);
-       
-                       updateTitle("");
-                       notify("All feeds updated.");
+
+                       if (!daemon_enabled) {
+                               notify("All feeds updated.");
+                               updateTitle("");
+                       }
                } catch (e) {
                        exception_error("refetch_callback", e);
                        updateTitle("");
@@ -167,11 +170,10 @@ function backend_sanity_check_callback() {
 
 function scheduleFeedUpdate(force) {
 
-       notify("Updating feeds, please wait.");
-
-//     document.title = "Tiny Tiny RSS - Updating...";
-
-       updateTitle("Updating");
+       if (!daemon_enabled) {
+               notify("Updating feeds, please wait.");
+               updateTitle("Updating");
+       }
 
        var query_str = "backend.php?op=rpc&subop=";
 
@@ -183,13 +185,20 @@ function scheduleFeedUpdate(force) {
 
        var omode;
 
-       if (display_tags) {
-               omode = "t";
+       if (firsttime_update) {
+               firsttime_update = false;
+               omode = "T";
        } else {
-               omode = "fl";
+               if (display_tags) {
+                       omode = "t";
+               } else {
+                       omode = "flc";
+               }
        }
-
+       
        query_str = query_str + "&omode=" + omode;
+       query_str = query_str + "&uctr=" + global_unread;
+
 
        if (xmlhttp_ready(xmlhttp)) {
                xmlhttp.open("GET", query_str, true);
@@ -292,14 +301,6 @@ function localPiggieFunction(enable) {
 
 function localHotkeyHandler(keycode) {
 
-/*     if (keycode == 78) {
-               return moveToPost('next');
-       }
-
-       if (keycode == 80) {
-               return moveToPost('prev');
-       } */
-
        if (keycode == 82) { // r
                return scheduleFeedUpdate(true);
        }
@@ -338,7 +339,7 @@ function localHotkeyHandler(keycode) {
 function updateTitle(s) {
        var tmp = "Tiny Tiny RSS";
 
-       if (s && s.length > 0) {
+       if (s != undefined) {
                current_subtitle = s;
        }
 
@@ -346,7 +347,7 @@ function updateTitle(s) {
                tmp = tmp + " (" + global_unread + ")";
        }
 
-       if (s) {
+       if (current_subtitle) {
                tmp = tmp + " - " + current_subtitle;
        }
 
@@ -374,6 +375,11 @@ function init() {
 
        try {
 
+               // this whole shebang is based on http://www.birnamdesigns.com/misc/busted2.html
+
+               if (arguments.callee.done) return;
+               arguments.callee.done = true;           
+
                disableContainerChildren("headlinesToolbar", true);
 
                if (!genericSanityCheck()) 
@@ -402,6 +408,8 @@ function init_second_stage() {
 
                dropboxSelect(viewbox, getCookie("ttrss_vf_vmode"));
                dropboxSelect(limitbox, getCookie("ttrss_vf_limit"));
+
+               daemon_enabled = getCookie("ttrss_vf_daemon");
        
        } catch (e) {
                exception_error("init_second_stage", e);