]> git.wh0rd.org - tt-rss.git/blobdiff - functions.js
pref-feeds tweaks
[tt-rss.git] / functions.js
index 8eb7cc60fcc4c51bba05d06f6265d111d6d4a7d1..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,7 +937,7 @@ function hideOrShowFeedsCategory(doc, node, hide, cat_node) {
                return;
        }
 
-       debug("cat: " + node.id);
+//     debug("cat: " + node.id);
 
        if (node.hasChildNodes() && node.firstChild.nextSibling != false) {  
                for (i = 0; i < node.childNodes.length; i++) {
@@ -929,7 +947,8 @@ 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");
        
@@ -957,7 +976,7 @@ function hideOrShowFeedsCategory(doc, node, hide, cat_node) {
                }
        }       
 
-       debug("end cat: " + node.id + " unread " + cat_unread);
+//     debug("end cat: " + node.id + " unread " + cat_unread);
 
        if (cat_unread == 0) {
                if (cat_node.style == undefined) {
@@ -1722,4 +1741,57 @@ 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);          
+       }
+} */