]> git.wh0rd.org Git - tt-rss.git/commitdiff
headline inline search: automatically fix odd/even classes
authorAndrew Dolgov <fox@madoka.spb.ru>
Sun, 4 May 2008 07:41:51 +0000 (08:41 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Sun, 4 May 2008 07:41:51 +0000 (08:41 +0100)
viewfeed.js

index 4a192a35e5e3da105857175698ec7053c56ab4a7..e6e4729f4e87ed6d81dc64df23715d53b87b0a7f 100644 (file)
@@ -1679,6 +1679,24 @@ function cdmExpandArticle(a_id) {
 
 }
 
+function fixHeadlinesOrder(ids) {
+       try {
+               for (var i = 0; i < ids.length; i++) {
+                       var e = document.getElementById("RROW-" + ids[i]);
+
+                       if (e) {
+                               if (i % 2 == 0) {
+                                       e.className = e.className.replace("even", "odd");
+                               } else {
+                                       e.className = e.className.replace("odd", "even");
+                               }
+                       }
+               }
+       } catch (e) {
+               exception_error("fixHeadlinesOrder", e);
+       }
+}
+
 function subtoolbarSearch() {
 
        try {
@@ -1690,6 +1708,7 @@ function subtoolbarSearch() {
                q = q.value.toUpperCase();
 
                var ids = false;
+               var vis_ids = new Array();
 
                if (document.getElementById("headlinesList")) {
                        ids = getVisibleHeadlineIds();
@@ -1705,10 +1724,13 @@ function subtoolbarSearch() {
                                        Element.hide(document.getElementById("RROW-" + ids[i]));
                                } else {
                                        Element.show(document.getElementById("RROW-" + ids[i]));
+                                       vis_ids.push(ids[i]);
                                }
                        }
                }
 
+               fixHeadlinesOrder(vis_ids);
+
        } catch (e) {
                exception_error("subtoolbarSearch", e);
        }