]> git.wh0rd.org - tt-rss.git/blobdiff - functions.js
pref-feeds tweaks
[tt-rss.git] / functions.js
index 47374ea4efbda6c538a76b7dec4b9bdc91e32a65..2857072b7854dd902dc191d595e79d642016bcc0 100644 (file)
@@ -209,7 +209,10 @@ function hotkey_handler(e) {
 
                }
        
-               if (!hotkeys_enabled) return;
+               if (!hotkeys_enabled) {
+                       debug("hotkeys disabled");
+                       return;
+               }
        
                if (window.event) {
                        keycode = window.event.keyCode;
@@ -329,6 +332,12 @@ function hotkey_handler(e) {
                        }
                }
 
+               if (keycode == 67 && shift_key) { // c
+                       if (typeof collapse_feedlist != 'undefined') {
+                               return collapse_feedlist();
+                       }
+               }
+
                if (typeof localHotkeyHandler != 'undefined') {
                        try {
                                return localHotkeyHandler(e);
@@ -778,6 +787,15 @@ function all_counters_callback2(transport) {
        }
 }
 
+function get_feed_unread(id) {
+       try {
+               return parseInt(document.getElementById("FEEDU-" + id).innerHTML);      
+       } catch (e) {
+               exception_error("get_feed_unread", e, true);
+               return -1;
+       }
+}
+
 function get_feed_entry_unread(doc, elem) {
 
        var id = elem.id.replace("FEEDR-", "");
@@ -919,6 +937,8 @@ function hideOrShowFeedsCategory(doc, node, hide, cat_node) {
                return;
        }
 
+//     debug("cat: " + node.id);
+
        if (node.hasChildNodes() && node.firstChild.nextSibling != false) {  
                for (i = 0; i < node.childNodes.length; i++) {
                        if (node.childNodes[i].nodeName != "LI") { continue; }
@@ -927,14 +947,18 @@ function hideOrShowFeedsCategory(doc, node, hide, cat_node) {
 
                                var has_unread = (node.childNodes[i].className != "feed" &&
                                        node.childNodes[i].className != "label" && 
-                                       node.childNodes[i].className != "virt" && 
+                                       !(!getInitParam("hide_read_shows_special") && 
+                                               node.childNodes[i].className == "virt") && 
+                                       node.childNodes[i].className != "error" && 
                                        node.childNodes[i].className != "tag");
        
-       //                      debug(node.childNodes[i].id + " --> " + has_unread);
+//                             debug(node.childNodes[i].id + " --> " + has_unread);
        
                                if (hide && !has_unread) {
                                        //node.childNodes[i].style.display = "none";
-                                       Effect.Fade(node.childNodes[i], {duration : 0.3});
+                                       var id = node.childNodes[i].id;
+                                       Effect.Fade(node.childNodes[i], {duration : 0.3, 
+                                               queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
                                }
        
                                if (!hide) {
@@ -952,6 +976,8 @@ function hideOrShowFeedsCategory(doc, node, hide, cat_node) {
                }
        }       
 
+//     debug("end cat: " + node.id + " unread " + cat_unread);
+
        if (cat_unread == 0) {
                if (cat_node.style == undefined) {
                        debug("ERROR: supplied cat_node " + cat_node + 
@@ -960,7 +986,8 @@ function hideOrShowFeedsCategory(doc, node, hide, cat_node) {
                }
                if (hide) {
                        //cat_node.style.display = "none";
-                       Effect.Fade(cat_node, {duration : 0.3});
+                       Effect.Fade(cat_node, {duration : 0.3, 
+                               queue: { position: 'end', scope: 'CFADE-' + node.id, limit: 1 }});
                } else {
                        cat_node.style.display = "list-item";
                }
@@ -1195,7 +1222,9 @@ function checkboxToggleElement(elem, id) {
 function appearBlockElement(id, h_id) {
 
        try {
-               Effect.Fade(h_id);
+               if (h_id) {
+                       Effect.Fade(h_id);
+               }
                Effect.SlideDown(id, {duration : 1.0, afterFinish: appearBlockElement_afh});
        } catch (e) {
                exception_error("appearBlockElement", e);
@@ -1203,7 +1232,6 @@ function appearBlockElement(id, h_id) {
 
 }
 
-
 function hideParentElement(e) {
        e.parentNode.style.display = "none";
 }
@@ -1712,3 +1740,58 @@ function getSelectedArticleIds2() {
 
        return ids;
 }
+
+function displayHelpInfobox(topic_id) {
+
+       var url = "backend.php?op=help&tid=" + param_escape(topic_id);
+
+       var w = window.open(url, "ttrss_help", 
+               "status=0,toolbar=0,location=0,width=450,height=500,scrollbars=1,menubar=0");
+
+       return false;
+}
+
+// http://www.dynamic-tools.net/toolbox/copyToClipboard/
+
+/*
+function copyToClipboard(s)
+{
+       if( window.clipboardData && clipboardData.setData )
+       {
+               clipboardData.setData("Text", s);
+       }
+       else
+       {
+               // You have to sign the code to enable this or allow the action in about:config by changing
+               user_pref("signed.applets.codebase_principal_support", true);
+               netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+
+               var clip Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard);
+               if (!clip) return;
+
+               // create a transferable
+               var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable);
+               if (!trans) return;
+
+               // specify the data we wish to handle. Plaintext in this case.
+               trans.addDataFlavor('text/unicode');
+
+               // To get the data from the transferable we need two new objects
+               var str = new Object();
+               var len = new Object();
+
+               var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString);
+
+               var copytext=meintext;
+
+               str.data=copytext;
+
+               trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]);
+
+               var clipid=Components.interfaces.nsIClipboard;
+
+               if (!clip) return false;
+
+               clip.setData(trans,null,clipid.kGlobalClipboard);          
+       }
+} */