]> git.wh0rd.org Git - tt-rss.git/commitdiff
functions: code cleanup
authorAndrew Dolgov <fox@bah.org.ru>
Mon, 13 Sep 2010 11:40:35 +0000 (15:40 +0400)
committerAndrew Dolgov <fox@bah.org.ru>
Mon, 13 Sep 2010 11:40:35 +0000 (15:40 +0400)
feedlist.js
functions.js
viewfeed.js

index 8860424b1947a863ceeca12a149a8a56f2abe30c..3d9acafd1667e8c4f2f70bae7ee00bb43f5fbacd 100644 (file)
@@ -163,14 +163,22 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
        
                                        var feedlist = $('feedList');
                                
-                                       var next_unread_feed = getRelativeFeedId(feedlist,
-                                                       feed, "next", true);
-       
+                                       var next_unread_feed = getRelativeFeedId2(feed, false,
+                                                       "next", true);
+
+                                       /* gRFI2 also returns categories which we don't really 
+                                        * need here, so we skip them */
+
+                                       while (next_unread_feed && next_unread_feed.match("CAT:")) 
+                                               next_unread_feed = getRelativeFeedId2(
+                                                               next_unread_feed.replace("CAT:", ""),
+                                                               true, "next", true);
+                                       
                                        if (!next_unread_feed) {
-                                               next_unread_feed = getRelativeFeedId(feedlist,
-                                                       -3, "next", true);
+                                               next_unread_feed = getRelativeFeedId2(-3, true,
+                                                       "next", true);
                                        }
-               
+       
                                        if (next_unread_feed) {
                                                query = query + "&nuf=" + param_escape(next_unread_feed);
                                                //setActiveFeedId(next_unread_feed);
index 2266bfc25e528aa774e8317f2c5b912a816403f1..43de38c98689b3581d8da6fc4da583db8d7de3ac 100644 (file)
@@ -1093,70 +1093,6 @@ function getRelativeFeedId2(id, is_cat, direction, unread_only) {
        }
 }
 
-function getRelativeFeedId(list, id, direction, unread_only) { 
-       var rows = list.getElementsByTagName("LI");
-       var feeds = new Array();
-
-       for (var i = 0; i < rows.length; i++) {
-               if (rows[i].id.match("FEEDR-")) {
-
-                       if (rows[i].id == "FEEDR-" + id || (Element.visible(rows[i]) && Element.visible(rows[i].parentNode))) {
-
-                               if (!unread_only || 
-                                               (rows[i].className.match("Unread") || rows[i].id == "FEEDR-" + id)) {
-                                       feeds.push(rows[i].id.replace("FEEDR-", ""));
-                               }
-                       }
-               }
-       }
-
-       if (!id) {
-               if (direction == "next") {
-                       return feeds.shift();
-               } else {
-                       return feeds.pop();
-               }
-       } else {
-               if (direction == "next") {
-                       var idx = feeds.indexOf(id);
-                       if (idx != -1 && idx < feeds.length) {
-                               return feeds[idx+1];                                    
-                       } else {
-                               return getRelativeFeedId(list, false, direction, unread_only);
-                       }
-               } else {
-                       var idx = feeds.indexOf(id);
-                       if (idx > 0) {
-                               return feeds[idx-1];
-                       } else {
-                               return getRelativeFeedId(list, false, direction, unread_only);
-                       }
-               }
-
-       }
-}
-
-function showBlockElement(id, h_id) {
-       var elem = $(id);
-
-       if (elem) {
-               elem.style.display = "block";
-
-               if (h_id) {
-                       elem = $(h_id);
-                       if (elem) {
-                               elem.style.display = "none";
-                       }
-               }
-       } else {
-               alert("[showBlockElement] can't find element with id " + id);
-       } 
-}
-
-function appearBlockElement_afh(effect) {
-
-}
-
 function checkboxToggleElement(elem, id) {
        if (elem.checked) {
                Effect.Appear(id, {duration : 0.5});
@@ -1165,23 +1101,6 @@ function checkboxToggleElement(elem, id) {
        }
 }
 
-function appearBlockElement(id, h_id) {
-
-       try {
-               if (h_id) {
-                       Effect.Fade(h_id);
-               }
-               Effect.SlideDown(id, {duration : 1.0, afterFinish: appearBlockElement_afh});
-       } catch (e) {
-               exception_error("appearBlockElement", e);
-       }
-
-}
-
-function hideParentElement(e) {
-       e.parentNode.style.display = "none";
-}
-
 function dropboxSelect(e, v) {
        for (i = 0; i < e.length; i++) {
                if (e[i].value == v) {
index 4a7cc9e7ffd097a61fd9685ec1ff24fa4227d60d..73ad35f0a95abf7db50636c34d182539f6b9bce3 100644 (file)
@@ -2062,7 +2062,7 @@ function cdmExpandArticle(a_id) {
 
 
        } catch (e) {
-               exception_error("appearBlockElementF", e);
+               exception_error("cdmExpandArticle", e);
        }
 
 }