]> git.wh0rd.org Git - tt-rss.git/commitdiff
storeInitParam: only store changed params on server
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 24 May 2006 03:55:13 +0000 (04:55 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 24 May 2006 03:55:13 +0000 (04:55 +0100)
feedlist.js
functions.js
tt-rss.js

index 355b4d88544b2f8e29e56bd61b5e71bec34841e7..97d74ba2b4227e16f107fd3aa4dfeb34e1708fef 100644 (file)
@@ -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);
index 59684b0231ab5360f88e39a85eb222174f12d61e..2d04c02a1e24438346380057f0c17f8708338049 100644 (file)
@@ -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");
index bbe91ee03bc6996d665932bf5b6fbcb2650eaa8b..f6a50733e8efc81423ecf0fda113821764456b44 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -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;