]> git.wh0rd.org - tt-rss.git/blobdiff - tt-rss.js
tweak README
[tt-rss.git] / tt-rss.js
index e6dbc1b9c81d76bc83679381b377a3ed6083a7b2..0af11bfca9d9a4e40e3f8b109c30f64a9ff32eac 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -1,8 +1,3 @@
-/*
-       This program is Copyright (c) 2003-2005 Andrew Dolgov <cthulhoo@gmail.com>              
-       Licensed under GPL v.2 or (at your preference) any later version.
-*/
-
 var xmlhttp = false;
 
 var total_unread = 0;
@@ -12,6 +7,10 @@ var display_tags = false;
 
 var global_unread = 0;
 
+var active_title_text = "";
+
+var current_subtitle = "";
+
 /*@cc_on @*/
 /*@if (@_jscript_version >= 5)
 // JScript gives us Conditional compilation, we can cope with old IE versions.
@@ -70,7 +69,7 @@ function refetch_callback() {
                        notify("refetch_callback: backend did not return valid XML");
                        return;
                }
-
+       
                var reply = xmlhttp.responseXML.firstChild;
 
                if (!reply) {
@@ -78,6 +77,12 @@ function refetch_callback() {
                        return;
                } 
 
+               var error_code = reply.getAttribute("error-code");
+       
+               if (error_code && error_code != 0) {
+                       return fatalError(error_code);
+               }
+
                var f_document = window.frames["feeds-frame"].document;
 
                for (var l = 0; l < reply.childNodes.length; l++) {
@@ -133,7 +138,7 @@ function backend_sanity_check_callback() {
                        return;
                }
 
-               var error_code = reply.getAttribute("code");
+               var error_code = reply.getAttribute("error-code");
        
                if (error_code && error_code != 0) {
                        return fatalError(error_code);
@@ -143,6 +148,7 @@ function backend_sanity_check_callback() {
        } 
 }
 
+/* wtf this is obsolete
 function updateFeed(feed_id) {
 
        var query_str = "backend.php?op=rpc&subop=updateFeed&feed=" + feed_id;
@@ -156,6 +162,7 @@ function updateFeed(feed_id) {
        }   
 
 }
+*/
 
 function scheduleFeedUpdate(force) {
 
@@ -163,7 +170,7 @@ function scheduleFeedUpdate(force) {
 
 //     document.title = "Tiny Tiny RSS - Updating...";
 
-       updateTitle("Updating...");
+       updateTitle("Updating");
 
        var query_str = "backend.php?op=rpc&subop=";
 
@@ -226,7 +233,7 @@ function catchupAllFeeds() {
        feeds_frame.src = query_str;
 
        global_unread = 0;
-       updateTitle();
+       updateTitle("");
 
 }
 
@@ -306,14 +313,23 @@ function localHotkeyHandler(keycode) {
 
 function updateTitle(s) {
        var tmp = "Tiny Tiny RSS";
-       
+
+       if (s && s.length > 0) {
+               current_subtitle = s;
+       }
+
        if (global_unread > 0) {
                tmp = tmp + " (" + global_unread + ")";
        }
 
        if (s) {
-               tmp = tmp + " - " + s;
+               tmp = tmp + " - " + current_subtitle;
        }
+
+       if (active_title_text.length > 0) {
+               tmp = tmp + " > " + active_title_text;
+       }
+
        document.title = tmp;
 }
 
@@ -514,13 +530,18 @@ function allFeedsMenuGo() {
                return;
        }
 
-       if (opname == "Show only read") {
+       if (opname == "Show only unread") {
                toggleDispRead();
                return;
        }
 
 }
 
+function updateFeedTitle(t) {
+       active_title_text = t;
+       updateTitle();
+}
+
 function toggleDispRead() {
        var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);