}
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);
}
}
- 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);
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);
}
} 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-', '');
var feed = list.ownerDocument.getElementById("FEEDR-" + getActiveFeedId());
- if (getCookie("ttrss_vf_hreadf") == 1) {
+ if (getInitParam("hide_read_feeds") == 1) {
unread_only = true;
}
}
// 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);
}
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>";
}
?>
}
}
-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 {
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);