]> git.wh0rd.org Git - tt-rss.git/commitdiff
get rid of vf_hreadf cookie, move data to init-param
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 23 May 2006 06:32:22 +0000 (07:32 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 23 May 2006 06:32:22 +0000 (07:32 +0100)
backend.php
feedlist.js
functions.js
functions.php
tt-rss.js

index d48d814971a1696c9bcf5c378e3af8d81313d625..abc0988adff6ff5abc829f403f1e5c70d0e6e734 100644 (file)
        }
 
        if ($_SESSION["uid"]) {
-               if (get_pref($link, "HIDE_READ_FEEDS") == "true") {
-                       setcookie("ttrss_vf_hreadf", 1);
-               } else {
-                       setcookie("ttrss_vf_hreadf", 0);
-               }  
 
 //             setcookie('ttrss_vf_refresh', FEEDS_FRAME_REFRESH);
 //             setcookie('ttrss_vf_daemon', ENABLE_UPDATE_DAEMON);
index 6be3816c1531e47a17133bd833f948a3f35530c0..ae4c23225fd9d516ebd36ab7be4d8b65f0cbeb2a 100644 (file)
@@ -189,10 +189,8 @@ function toggleCollapseCat(cat) {
                        }
                }
 
-               xmlhttp_rpc.open("GET", "backend.php?op=feeds&subop=collapse&cid=" + 
-                       param_escape(cat), true);
-               xmlhttp_rpc.onreadystatechange=rpc_pnotify_callback;
-               xmlhttp_rpc.send(null);
+               new Ajax.Request("backend.php?op=feeds&subop=collapse&cid=" + 
+                       param_escape(cat));
 
        } catch (e) {
                exception_error("toggleCollapseCat", e);
@@ -206,7 +204,7 @@ function init() {
                
                parent.debug("in feedlist init");
                
-               hideOrShowFeeds(document, getCookie("ttrss_vf_hreadf") == 1);
+               hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1);
                document.onkeydown = hotkey_handler;
                parent.setTimeout("timeout()", 0);
 
index da5d9514386463f71064acd9fa8efe1abc019989..58d50eea95d2894715e1d3cc026260ac37912725 100644 (file)
@@ -783,7 +783,7 @@ function getRelativeFeedId(list, id, direction, unread_only) {
                                        }
                                } else if (child.id.match("FEEDR-")) {
                                
-                                       if (getCookie("ttrss_vf_hreadf") == 1) {
+                                       if (getInitParam("hide_read_feeds") == 1) {
                                                if (child.className != "feed") {
                                                        alert(child.className);
                                                        return child.id.replace('FEEDR-', '');                                          
@@ -798,7 +798,7 @@ function getRelativeFeedId(list, id, direction, unread_only) {
        
                var feed = list.ownerDocument.getElementById("FEEDR-" + getActiveFeedId());
                
-               if (getCookie("ttrss_vf_hreadf") == 1) {
+               if (getInitParam("hide_read_feeds") == 1) {
                        unread_only = true;
                }
 
@@ -1098,11 +1098,13 @@ function getInitParam(key) {
 }
 
 // TODO: batch mode
-function storeInitParam(key, value) {
+function storeInitParam(key, value, is_client) {
        try {
                getMainContext().init_params[key] = value;
-               new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" + 
-                       param_escape(key) + "&value=" + param_escape(value));           
+               if (!is_client) {
+                       new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" + 
+                               param_escape(key) + "&value=" + param_escape(value));   
+               }
        } catch (e) {
                exception_error("storeInitParam", e);
        }
index 99f749e1ca88bf7cd249a9ccf2163d1f87d1ca7e..5ec8d45f464a3662ac23baa3b98fdee044907959 100644 (file)
                print "<param key=\"on_catchup_show_next_feed\" value=\"" . 
                        get_pref($link, "ON_CATCHUP_SHOW_NEXT_FEED") . "\"/>";
 
+               print "<param key=\"hide_read_feeds\" value=\"" . 
+                       sprintf("%d", get_pref($link, "HIDE_READ_FEEDS")) . "\"/>";
+
                print "</init-params>";
        }
 ?>
index eefcd95faae6190c1d56fae6faccb36455a2911f..3ffd04e8f01323c6f5dee1bb36f3109086b96f5a 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -44,31 +44,6 @@ function dlg_frefresh_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 {
@@ -563,16 +538,20 @@ function toggleDispRead() {
                        return
                }
 
-               var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);
+               var hide_read_feeds = (getInitParam("hide_read_feeds") == "1");
 
                hide_read_feeds = !hide_read_feeds;
-       
+
+               debug("toggle_disp_read => " + hide_read_feeds);
+
+               hideOrShowFeeds(getFeedsContext().document, hide_read_feeds);
+
                var query = "backend.php?op=rpc&subop=setpref" +
                        "&key=HIDE_READ_FEEDS&value=" + param_escape(hide_read_feeds);
 
-               xmlhttp.open("GET", query);
-               xmlhttp.onreadystatechange=hide_unread_callback;
-               xmlhttp.send(null);
+               storeInitParam("hide_read_feeds", hide_read_feeds, true);
+
+               new Ajax.Request(query);
                
        } catch (e) {
                exception_error("toggleDispRead", e);