]> git.wh0rd.org Git - tt-rss.git/commitdiff
code cleanups, make feedlist_callback async
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 24 Aug 2007 04:49:57 +0000 (05:49 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 24 Aug 2007 04:49:57 +0000 (05:49 +0100)
feedlist.js
prefs.js
tt-rss.js

index 3a44f331b281fa7b333420265a74d2ad654f3317..ec1a653de2d84a42bcfa8c80c7fe530f693d44d4 100644 (file)
@@ -10,10 +10,18 @@ function viewCategory(cat) {
 
 function feedlist_callback() {
        if (xmlhttp.readyState == 4) {
-               debug("feedlist_callback");
+               feedlist_callback2(xmlhttp);
+       }
+}
+
+function feedlist_callback2(transport) {
+       try {
+               debug("feedlist_callback2");
                var f = document.getElementById("feeds-frame");
-               f.innerHTML = xmlhttp.responseText;
+               f.innerHTML = transport.responseText;
                feedlist_init();
+       } catch (e) {
+               exception_error("feedlist_callback2", e);
        }
 }
 
index 40dd5ff53e16edb30524144cd6585e3a6082ac39..14f813bfa255767796382aefbf9b338f38f79ff0 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -48,7 +48,6 @@ function expand_feed_callback() {
                        var container = document.getElementById("BRDET-" + feed_to_expand);     
                        container.innerHTML=xmlhttp.responseText;
 //                     container.style.display = "block";
-//                     p_notify("");
                        Effect.Appear(container, {duration : 0.5});
                } catch (e) {
                        exception_error("expand_feed_callback", e);
@@ -248,10 +247,6 @@ function updateFeedList(sort_key) {
                return
        }
 
-//     document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
-
-//     p_notify("Loading, please wait...");
-
        var feed_search = document.getElementById("feed_search");
        var search = "";
        if (feed_search) { search = feed_search.value; }
@@ -279,10 +274,6 @@ function updateUsersList(sort_key) {
                return
        }
 
-//     document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
-
-//     p_notify("Loading, please wait...");
-
        xmlhttp.open("GET", "backend.php?op=pref-users&sort="
                + param_escape(sort_key), true);
        xmlhttp.onreadystatechange=userlist_callback;
@@ -1153,10 +1144,6 @@ function updateFilterList(sort_key) {
                return
        }
 
-//     document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
-
-//     p_notify("Loading, please wait...");
-
        xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" + 
                param_escape(sort_key), true);
        xmlhttp.onreadystatechange=filterlist_callback;
@@ -1171,10 +1158,6 @@ function updateLabelList(sort_key) {
                return
        }
 
-//     p_notify("Loading, please wait...");
-
-//     document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
-
        xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" + 
                param_escape(sort_key), true);
        xmlhttp.onreadystatechange=labellist_callback;
@@ -1188,8 +1171,6 @@ function updatePrefsList() {
                return
        }
 
-//     p_notify("Loading, please wait...");
-
        xmlhttp.open("GET", "backend.php?op=pref-prefs", true);
        xmlhttp.onreadystatechange=prefslist_callback;
        xmlhttp.send(null);
@@ -1467,8 +1448,6 @@ function updateBigFeedBrowser(limit) {
                return
        }
 
-//     p_notify("Loading, please wait...");
-
        var query = "backend.php?op=pref-feed-browser";
 
        var limit_sel = document.getElementById("feedBrowserLimit");
index 6a0ae0f9f757022dca805bb94d9ed7313b916a6b..3a134d613657e2c1a838e329cf2c1daf66c90aaa 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -219,14 +219,10 @@ function updateFeedList(silent, fetch) {
 
        debug("updateFeedList Q=" + query_str);
 
-       if (xmlhttp_ready(xmlhttp)) {
-               xmlhttp.open("GET", query_str, true);
-               xmlhttp.onreadystatechange=feedlist_callback;
-               xmlhttp.send(null);
-       } else {
-               debug("xmlhttp busy");
-               //printLockingError();
-       }   
+       new Ajax.Request(query_str, {
+               onComplete: function(transport) { 
+                       feedlist_callback2(transport); 
+               } });
 
 }
 
@@ -238,14 +234,10 @@ function catchupAllFeeds() {
 
        debug("catchupAllFeeds Q=" + query_str);
 
-       if (xmlhttp_ready(xmlhttp)) {
-               xmlhttp.open("GET", query_str, true);
-               xmlhttp.onreadystatechange=feedlist_callback;
-               xmlhttp.send(null);
-       } else {
-               debug("xmlhttp busy");
-               //printLockingError();
-       }   
+       new Ajax.Request(query_str, {
+               onComplete: function(transport) { 
+                       feedlist_callback2(transport); 
+               } });
 
        global_unread = 0;
        updateTitle("");
@@ -297,19 +289,6 @@ function search() {
        viewCurrentFeed(0, "");
 }
 
-function localPiggieFunction(enable) {
-       if (enable) {
-               var query_str = "backend.php?op=feeds&subop=piggie";
-
-               if (xmlhttp_ready(xmlhttp)) {
-
-                       xmlhttp.open("GET", query_str, true);
-                       xmlhttp.onreadystatechange=feedlist_callback;
-                       xmlhttp.send(null);
-               }
-       }
-}
-
 // if argument is undefined, current subtitle is not updated
 // use blank string to clear subtitle
 function updateTitle(s) {