summaryrefslogtreecommitdiff
path: root/tt-rss.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-05-23 06:34:50 +0100
committerAndrew Dolgov <[email protected]>2006-05-23 06:34:50 +0100
commit3ac2b52019535cf6162bb2e5d95d46c591958ff8 (patch)
treeced74f86f07cfb7debd3c6b0b9cac726b84c27cd /tt-rss.js
parent3dd46f19db3d6ce71a65ea7c1013e16125a24ccc (diff)
move some cookies to init-params
Diffstat (limited to 'tt-rss.js')
-rw-r--r--tt-rss.js38
1 files changed, 32 insertions, 6 deletions
diff --git a/tt-rss.js b/tt-rss.js
index 98cb9c712..c7e6cbcd7 100644
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -13,6 +13,8 @@ var cookie_lifetime = 0;
var xmlhttp = Ajax.getTransport();
+var init_params = new Array();
+
function toggleTags() {
display_tags = !display_tags;
@@ -123,7 +125,7 @@ function backend_sanity_check_callback() {
return;
}
- var reply = xmlhttp.responseXML.firstChild;
+ var reply = xmlhttp.responseXML.firstChild.firstChild;
if (!reply) {
fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp.responseText);
@@ -138,6 +140,21 @@ function backend_sanity_check_callback() {
debug("sanity check ok");
+ var params = reply.nextSibling;
+
+ if (params) {
+ debug('reading init-params...');
+ var param = params.firstChild;
+
+ while (param) {
+ var k = param.getAttribute("key");
+ var v = param.getAttribute("value");
+ debug(k + " => " + v);
+ init_params[k] = v;
+ param = param.nextSibling;
+ }
+ }
+
init_second_stage();
} catch (e) {
@@ -259,9 +276,9 @@ function viewfeed(feed, skip, subop) {
function timeout() {
scheduleFeedUpdate(false);
- var refresh_time = getCookie('ttrss_vf_refresh');
+ var refresh_time = getInitParam("feeds_frame_refresh");
- if (!refresh_time) refresh_time = 600;
+ if (!refresh_time) refresh_time = 600;
setTimeout("timeout()", refresh_time*1000);
}
@@ -423,10 +440,10 @@ function init_second_stage() {
var tb = parent.document.forms["main_toolbar_form"];
- dropboxSelect(tb.view_mode, getCookie("ttrss_vf_vmode"));
- dropboxSelect(tb.limit, getCookie("ttrss_vf_limit"));
+ dropboxSelect(tb.view_mode, getInitParam("toolbar_view_mode"));
+ dropboxSelect(tb.limit, getInitParam("toolbar_limit"));
- daemon_enabled = getCookie("ttrss_vf_daemon");
+ daemon_enabled = getInitParam("daemon_enabled");
// FIXME should be callled after window resize
@@ -592,3 +609,12 @@ function fatalError(code, message) {
exception_error("fatalError", e);
}
}
+
+function getInitParam(key) {
+ return init_params[key];
+}
+
+function storeInitParam(key, value) {
+ new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" +
+ param_escape(key) + "&value=" + param_escape(value));
+}