]> git.wh0rd.org - tt-rss.git/blobdiff - functions.js
tweak quickAddFeed dialog
[tt-rss.git] / functions.js
index 4585b3baa30f4d7708a31857d5502aa6bb3cf1c0..732e73ec846a2b4853d1aa09df9787b0a07054cc 100644 (file)
@@ -686,7 +686,9 @@ function parse_counters(reply, scheduled_call) {
                                if (feedu.innerHTML != ctr && id == getActiveFeedId() && scheduled_call) {
                                        viewCurrentFeed();
                                }
-               
+
+                               var row_needs_hl = (ctr > 0 && ctr > parseInt(feedu.innerHTML));
+
                                feedu.innerHTML = ctr;
 
                                if (error) {
@@ -707,8 +709,12 @@ function parse_counters(reply, scheduled_call) {
                
                                                if (is_selected) {
                                                        feedr.className = feedr.className + "Selected";
-                                               }
-               
+                                               }       
+                                               
+                                       }
+
+                                       if (row_needs_hl) { 
+                                               new Effect.Highlight(feedr, {duration: 1, startcolor: "#fff7d5"});
                                        }
                                } else {
                                        feedctr.className = "invisible";
@@ -1004,6 +1010,7 @@ function hideOrShowFeedsCategory(doc, node, hide, cat_node) {
                        if (node.childNodes[i].style != undefined) {
 
                                var has_unread = (node.childNodes[i].className != "feed" &&
+                                       node.childNodes[i].className != "label" && 
                                        node.childNodes[i].className != "tag");
        
        //                      debug(node.childNodes[i].id + " --> " + has_unread);
@@ -1035,7 +1042,8 @@ function hideOrShowFeedsCategory(doc, node, hide, cat_node) {
                        return;
                }
                if (hide) {
-                       cat_node.style.display = "none";
+                       //cat_node.style.display = "none";
+                       Effect.Fade(cat_node, {duration : 0.3});
                } else {
                        cat_node.style.display = "list-item";
                }
@@ -1200,7 +1208,48 @@ function openExternalUrl(url) {
 }
 
 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);
+                       }
+               }
+
+       }
+
+/*     if (!id) {
                if (direction == "next") {
                        for (i = 0; i < list.childNodes.length; i++) {
                                var child = list.childNodes[i];
@@ -1220,7 +1269,7 @@ function getRelativeFeedId(list, id, direction, unread_only) {
                if (direction == "prev") {
                        for (i = list.childNodes.length-1; i >= 0; i--) {
                                var child = list.childNodes[i];                         
-                               if (child.id == "feedCatHolder" && child.className != "invisible") {
+                               if (child.id == "feedCatHolder" && Element.visible(child)) {
                                        if (child.firstChild) {
                                                var cr = getRelativeFeedId(child.firstChild, id, direction);
                                                if (cr) return cr;                                      
@@ -1278,8 +1327,8 @@ function getRelativeFeedId(list, id, direction, unread_only) {
                                if (e) {
                                        if (!unread_only || (unread_only && e.className != "feed" &&
                                                        e.className.match("feed")))     {
-                                               if (e.parentNode.parentNode && e.parentNode.parentNode.className 
-                                                       != "invisible") {
+                                               if (e.parentNode.parentNode && 
+                                                       Element.visible(e.parentNode.parentNode)) {
                                                        return e.id.replace("FEEDR-", "");
                                                }
                                        }
@@ -1318,15 +1367,15 @@ function getRelativeFeedId(list, id, direction, unread_only) {
                                if (e) {
                                        if (!unread_only || (unread_only && e.className != "feed" && 
                                                        e.className.match("feed")))     {
-                                               if (e.parentNode.parentNode && e.parentNode.parentNode.className 
-                                                       != "invisible") {
+                                               if (e.parentNode.parentNode && 
+                                                       Element.visible(e.parentNode.parentNode)) {
                                                        return e.id.replace("FEEDR-", "");
                                                }
                                        }
                                }
                        }
                }
-       }
+       } */
 }
 
 function showBlockElement(id, h_id) {
@@ -1346,6 +1395,30 @@ function showBlockElement(id, h_id) {
        } 
 }
 
+function appearBlockElement_afh(effect) {
+
+}
+
+function checkboxToggleElement(elem, id) {
+       if (elem.checked) {
+               Effect.SlideDown(id, {duration : 1.0});
+       } else {
+               Effect.SlideUp(id, {duration : 1.0});
+       }
+}
+
+function appearBlockElement(id, h_id) {
+
+       try {
+               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";
 }
@@ -1467,6 +1540,9 @@ function infobox_callback() {
                        var box = document.getElementById('infoBox');
                        var shadow = document.getElementById('infoBoxShadow');
                        if (box) {                      
+
+                               new Draggable(shadow);
+
                                box.innerHTML=xmlhttp.responseText;                     
                                if (shadow) {
                                        shadow.style.display = "block";
@@ -1517,7 +1593,7 @@ function addFilter() {
        var reg_exp = form.reg_exp.value;
 
        if (reg_exp == "") {
-               alert("Can't add filter: nothing to match on.");
+               alert(__("Can't add filter: nothing to match on."));
                return false;
        }
 
@@ -1553,7 +1629,7 @@ function qaddFeed() {
        var feed_url = form.feed_url.value;
 
        if (feed_url == "") {
-               alert("Can't subscribe: no feed URL given.");
+               alert(__("Can't subscribe: no feed URL given."));
                return false;
        }