]> git.wh0rd.org - tt-rss.git/blobdiff - tt-rss.js
schema: support for audio enclosure in ttrss_entries
[tt-rss.git] / tt-rss.js
index 638f066de3813a6e077defc4cbff3da7fabd4b93..5603c01cef3c6e7b7a3b6a65f699f15e6e559a06 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -72,6 +72,31 @@ function dlg_display_callback() {
        } 
 }
 
+function hide_unread_callback() {
+       if (xmlhttp.readyState == 4) {
+
+               try {
+
+                       var reply = xmlhttp.responseXML.firstChild.firstChild;
+                       var value = reply.getAttribute("value");
+                       var hide_read_feeds = (value != "false")
+                       var feeds_doc = window.frames["feeds-frame"].document;
+       
+                       hideOrShowFeeds(feeds_doc, hide_read_feeds);
+       
+                       if (hide_read_feeds) {
+                               setCookie("ttrss_vf_hreadf", 1);
+                       } else {
+                               setCookie("ttrss_vf_hreadf", 0);
+                       } 
+
+               } catch (e) {
+                       exception_error("hide_unread_callback", e);
+               }
+
+       } 
+}
+
 function refetch_callback() {
        if (xmlhttp.readyState == 4) {
                try {
@@ -96,7 +121,7 @@ function refetch_callback() {
        
                        var f_document = window.frames["feeds-frame"].document;
 
-                       parse_counters(reply, f_document);
+                       parse_counters(reply, f_document, window);
        
                        updateTitle("");
                        notify("All feeds updated.");
@@ -140,7 +165,7 @@ function backend_sanity_check_callback() {
 
 function scheduleFeedUpdate(force) {
 
-       notify("Updating feeds in background...");
+       notify("Updating feeds, please wait.");
 
 //     document.title = "Tiny Tiny RSS - Updating...";
 
@@ -241,7 +266,7 @@ function resetSearch() {
 }
 
 function search() {
-       closeDlg();
+       closeDlg();     
        viewCurrentFeed(0, "");
 }
 
@@ -386,7 +411,7 @@ function quickMenuGo() {
        }
 
        if (opid == "qmcSearch") {
-               displayDlg("search");
+               displayDlg("search", getActiveFeedId());
                return;
        }
 
@@ -504,6 +529,11 @@ function qaddFilter() {
 
 function displayDlg(id, param) {
 
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
        notify("");
 
        xmlhttp.open("GET", "backend.php?op=dlg&id=" +
@@ -524,6 +554,11 @@ function qfdDelete(feed_id) {
 
        notify("Removing feed...");
 
+       if (!xmlhttp_ready(xmlhttp)) {
+               printLockingError();
+               return
+       }
+
 //     var feeds_doc = window.frames["feeds-frame"].document;
 //     feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
 
@@ -563,19 +598,26 @@ function updateFeedTitle(t) {
 }
 
 function toggleDispRead() {
-       var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);
+       try {
 
-       hide_read_feeds = !hide_read_feeds;
+               if (!xmlhttp_ready(xmlhttp)) {
+                       printLockingError();
+                       return
+               }
 
-       var feeds_doc = window.frames["feeds-frame"].document;
+               var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);
 
-       hideOrShowFeeds(feeds_doc, hide_read_feeds);
+               hide_read_feeds = !hide_read_feeds;
+       
+               var query = "backend.php?op=rpc&subop=setpref" +
+                       "&key=HIDE_READ_FEEDS&value=" + param_escape(hide_read_feeds);
 
-       if (hide_read_feeds) {
-               setCookie("ttrss_vf_hreadf", 1);
-       } else {
-               setCookie("ttrss_vf_hreadf", 0);
+               xmlhttp.open("GET", query);
+               xmlhttp.onreadystatechange=hide_unread_callback;
+               xmlhttp.send(null);
+               
+       } catch (e) {
+               exception_error("toggleDispRead", e);
        }
-
 }