From: Andrew Dolgov Date: Tue, 23 May 2006 06:32:22 +0000 (+0100) Subject: get rid of vf_hreadf cookie, move data to init-param X-Git-Tag: 1.2.0~30 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e8bd0da9526712b6a2baa453133380608cd57af6;p=tt-rss.git get rid of vf_hreadf cookie, move data to init-param --- diff --git a/backend.php b/backend.php index d48d8149..abc0988a 100644 --- a/backend.php +++ b/backend.php @@ -102,11 +102,6 @@ } 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); diff --git a/feedlist.js b/feedlist.js index 6be3816c..ae4c2322 100644 --- a/feedlist.js +++ b/feedlist.js @@ -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); diff --git a/functions.js b/functions.js index da5d9514..58d50eea 100644 --- a/functions.js +++ b/functions.js @@ -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); } diff --git a/functions.php b/functions.php index 99f749e1..5ec8d45f 100644 --- a/functions.php +++ b/functions.php @@ -1713,6 +1713,9 @@ print ""; + print ""; + print ""; } ?> diff --git a/tt-rss.js b/tt-rss.js index eefcd95f..3ffd04e8 100644 --- 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);