]> git.wh0rd.org - tt-rss.git/blobdiff - tt-rss.js
toggle hide/display only unread feeds, All feeds: button ops changed into selector
[tt-rss.git] / tt-rss.js
index c49a52c136a7ccdc847d33ca1b014e6ba3887a9b..0fb61a117526bee3b22094a74f47dd70c8724d54 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -12,6 +12,7 @@ var search_query = "";
 var search_mode = "";
 
 var display_tags = false;
+//var display_read_feeds = true;
 
 var global_unread = 0;
 
@@ -48,7 +49,7 @@ function toggleTags() {
        updateFeedList();
 }
 
-function qaf_add_callback() {
+function dlg_frefresh_callback() {
        if (xmlhttp.readyState == 4) {
                updateFeedList(false, false);
                closeDlg();
@@ -150,6 +151,16 @@ function scheduleFeedUpdate(force) {
                query_str = query_str + "updateAllFeeds";
        }
 
+       var omode;
+
+       if (display_tags) {
+               omode = "t";
+       } else {
+               omode = "fl";
+       }
+
+       query_str = query_str + "&omode=" + omode;
+
        if (xmlhttp_ready(xmlhttp)) {
                xmlhttp.open("GET", query_str, true);
                xmlhttp.onreadystatechange=refetch_callback;
@@ -201,6 +212,9 @@ function viewCurrentFeed(skip, subop) {
 
        if (getActiveFeedId()) {
                viewfeed(getActiveFeedId(), skip, subop);
+       } else {
+               disableContainerChildren("headlinesToolbar", false, document);
+               viewfeed(-1, skip, subop); // FIXME
        }
 }
 
@@ -432,8 +446,26 @@ function quickMenuGo() {
                gotoPreferences();
        }
 
-       if (opname == "Add new feed") {
+       if (opname == "Extended search") {
+               displayDlg("search");
+               return;
+       }
+
+       if (opname.match("Add new feed")) {
                displayDlg("quickAddFeed");
+               return;
+       }
+
+       if (opname.match("Remove this feed")) {
+               var actid = getActiveFeedId();
+
+               if (!actid) {
+                       notify("Please select some feed first.");
+                       return;
+               }
+       
+               displayDlg("quickDelFeed", actid);
+               return;
        }
 }
 
@@ -457,7 +489,7 @@ function qafAdd() {
 
                xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
                        param_escape(link.value), true);
-               xmlhttp.onreadystatechange=qaf_add_callback;
+               xmlhttp.onreadystatechange=dlg_frefresh_callback;
                xmlhttp.send(null);
 
                link.value = "";
@@ -465,10 +497,12 @@ function qafAdd() {
        }
 }
 
-function displayDlg(id) {
+function displayDlg(id, param) {
+
+       notify("");
 
        xmlhttp.open("GET", "backend.php?op=dlg&id=" +
-               param_escape(id), true);
+               param_escape(id) + "&param=" + param_escape(param), true);
        xmlhttp.onreadystatechange=dialog_refresh_callback;
        xmlhttp.send(null);
 
@@ -479,3 +513,54 @@ function closeDlg() {
        dlg.style.display = "none";
 }
 
+function qfdDelete(feed_id) {
+
+       notify("Removing feed...");
+
+       var feeds_doc = window.frames["feeds-frame"].document;
+       feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
+
+       xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids=" + feed_id);
+       xmlhttp.onreadystatechange=dlg_frefresh_callback;
+       xmlhttp.send(null);
+}
+
+
+function allFeedsMenuGo() {
+       var chooser = document.getElementById("allFeedsChooser");
+
+       var opname = chooser[chooser.selectedIndex].text;
+
+       if (opname == "Update") {
+               scheduleFeedUpdate(true);
+               return;
+       }
+
+       if (opname == "Mark as read") {
+               catchupAllFeeds();
+               return;
+       }
+
+       if (opname == "Toggle display read") {
+               toggleDispRead();
+               return;
+       }
+
+}
+
+function toggleDispRead() {
+       var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);
+
+       hide_read_feeds = !hide_read_feeds;
+
+       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);
+       }
+
+}