summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend.php5
-rw-r--r--feedlist.js8
-rw-r--r--functions.js12
-rw-r--r--functions.php3
-rw-r--r--tt-rss.js39
5 files changed, 22 insertions, 45 deletions
diff --git a/backend.php b/backend.php
index d48d81497..abc0988ad 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 6be3816c1..ae4c23225 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 da5d95143..58d50eea9 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 99f749e1c..5ec8d45f4 100644
--- a/functions.php
+++ b/functions.php
@@ -1713,6 +1713,9 @@
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>";
}
?>
diff --git a/tt-rss.js b/tt-rss.js
index eefcd95fa..3ffd04e8f 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);