diff options
author | Andrew Dolgov <[email protected]> | 2006-05-24 04:55:13 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2006-05-24 04:55:13 +0100 |
commit | 1035fcecd8700e90c9e940c667bc66a2a0a1b241 (patch) | |
tree | 65ec5985d3e0789e18ad6c3f19c3199597c83483 | |
parent | 1cb7492dc4749484dbe7b5f593e64bdb89243cfe (diff) |
storeInitParam: only store changed params on server
-rw-r--r-- | feedlist.js | 7 | ||||
-rw-r--r-- | functions.js | 32 | ||||
-rw-r--r-- | tt-rss.js | 2 |
3 files changed, 35 insertions, 6 deletions
diff --git a/feedlist.js b/feedlist.js index 355b4d885..97d74ba2b 100644 --- a/feedlist.js +++ b/feedlist.js @@ -27,7 +27,12 @@ function viewfeed(feed, skip, subop, doc, is_cat, subop_param) { toolbar_form.limit[toolbar_form.limit.selectedIndex].value); storeInitParam("toolbar_view_mode", - toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); + toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); + +/* var sp = new Object(); + sp["toolbar_limit"] = toolbar_form.limit[toolbar_form.limit.selectedIndex].value; + sp["toolbar_view_mode"] = toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value; + storeInitParams(sp); */ var query = "backend.php?op=viewfeed&feed=" + feed + "&" + toolbar_query + "&subop=" + param_escape(subop); diff --git a/functions.js b/functions.js index 59684b023..2d04c02a1 100644 --- a/functions.js +++ b/functions.js @@ -1162,19 +1162,43 @@ function getInitParam(key) { return getMainContext().init_params[key]; } -// TODO: batch mode function storeInitParam(key, value, is_client) { try { - getMainContext().init_params[key] = value; if (!is_client) { - new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" + - param_escape(key) + "&value=" + param_escape(value)); + if (getMainContext().init_params[key] != value) { + debug("storeInitParam: " + key + " => " + value); + new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" + + param_escape(key) + "&value=" + param_escape(value)); + } } + getMainContext().init_params[key] = value; } catch (e) { exception_error("storeInitParam", e); } } +/* +function storeInitParams(params, is_client) { + try { + var s = ""; + + for (k in params) { + if (getMainContext().init_params[k] != params[k]) { + s += k + "=" + params[k] + ";"; + getMainContext().init_params[k] = params[k]; + } + } + + debug("storeInitParams: " + s); + + if (!is_client) { + new Ajax.Request("backend.php?op=rpc&subop=storeParams&str=" + s); + } + } catch (e) { + exception_error("storeInitParams", e); + } +}*/ + function fatalError(code, message) { try { var fe = document.getElementById("fatal_error"); @@ -14,7 +14,7 @@ var active_feed_id = 0; var xmlhttp = Ajax.getTransport(); -var init_params = new Array(); +var init_params = new Object(); function toggleTags() { display_tags = !display_tags; |