]> git.wh0rd.org - tt-rss.git/blobdiff - functions.js
fix indent
[tt-rss.git] / functions.js
index a3a46a9c9cd96080bc65cf5960319e2aaa2aa135..292612919184a5553b6545e2c61e72e6ecd25b3f 100644 (file)
@@ -11,6 +11,14 @@ function is_opera() {
        return navigator.userAgent.match("Opera");
 }
 
+function is_khtml() {
+       return navigator.userAgent.match("KHTML");
+}
+
+function is_safari() {
+       return navigator.userAgent.match("Safari");
+}
+
 function exception_error(location, e, silent) {
        var msg;
 
@@ -214,13 +222,13 @@ function hotkey_handler(e) {
                        if (new_feed) viewfeed(new_feed, '');
                }
 
-               if (keycode == 78 || keycode == 40) { // n, down
+               if (!is_safari() && (keycode == 78 || keycode == 40)) { // n, down
                        if (typeof moveToPost != 'undefined') {
                                return moveToPost('next');
                        }
                }
        
-               if (keycode == 80 || keycode == 38) { // p, up
+               if (!is_safari() && (keycode == 80 || keycode == 38)) { // p, up
                        if (typeof moveToPost != 'undefined') {
                                return moveToPost('prev');
                        }
@@ -237,10 +245,34 @@ function hotkey_handler(e) {
                        debug_mode_enabled = !debug_mode_enabled;
                }
 
-               if (keycode == 69 && shift_key) {
+               if (keycode == 190 && shift_key) { // >
+                       viewFeedGoPage(1);
+               }
+               
+               if (keycode == 188 && shift_key) { // <
+                       viewFeedGoPage(-1);
+               }
+
+               if (keycode == 191 && shift_key) { // ?
+                       viewFeedGoPage(0);
+               }
+
+               if (keycode == 69 && shift_key) { // e
                        return editFeedDlg(getActiveFeedId());
                }
 
+               if (keycode == 70 && shift_key) { // f
+                       if (getActiveFeedId()) {
+                               return catchupCurrentFeed();
+                       }
+               }
+
+               if (keycode == 80 && shift_key) { // p 
+                       if (getActiveFeedId()) {
+                               return catchupPage();
+                       }
+               }
+
                if (typeof localHotkeyHandler != 'undefined') {
                        try {
                                return localHotkeyHandler(e);
@@ -782,6 +814,18 @@ function update_all_counters(feed) {
                        query = query + "&aid=" + feed;
                }
 
+               if (tagsAreDisplayed()) {
+                       query = query + "&omode=lt";
+               } else {
+                       query = query + "&omode=flc";
+               }
+
+               debug("update_all_counters QUERY: " + query);
+
+               var date = new Date();
+               var timestamp = Math.round(date.getTime() / 1000);
+               query = query + "&ts=" + timestamp
+
                xmlhttp_rpc.open("GET", query, true);
                xmlhttp_rpc.onreadystatechange=all_counters_callback;
                xmlhttp_rpc.send(null);
@@ -1482,16 +1526,17 @@ function storeInitParams(params, is_client) {
 function fatalError(code, message) {
        try {   
 
-               if (code != 6) {
-
+               if (code == 6) {
+                       window.location.href = "login.php?rt=none";                     
+               } else if (code == 5) {
+                       window.location.href = "update.php";
+               } else {
                        var fe = document.getElementById("fatal_error");
                        var fc = document.getElementById("fatal_error_msg");
        
                        fc.innerHTML = "Code " + code + ": " + message;
        
                        fe.style.display = "block";
-               } else {
-                       window.location.href = "login.php?rt=none";                     
                }
 
        } catch (e) {
@@ -1519,3 +1564,44 @@ function getFeedName(id, is_cat) {
 function viewContentUrl(url) {
        getContentContext().location = url;
 }
+
+function filterDlgCheckAction(sender) {
+
+       try {
+
+               var action = sender[sender.selectedIndex].value;
+
+               var form = document.forms["filter_add_form"];
+       
+               if (!form) {
+                       form = document.forms["filter_edit_form"];
+               }
+
+               if (!form) {
+                       debug("filterDlgCheckAction: can't find form!");
+                       return;
+               }
+
+               var action_param = form.action_param;
+
+               if (!action_param) {
+                       debug("filterDlgCheckAction: can't find action param!");
+                       return;
+               }
+
+               // if selected action supports parameters, enable params field
+               if (action == 4) {
+                       action_param.disabled = false;
+               } else {
+                       action_param.disabled = true;
+               }
+
+       } catch (e) {
+               exception_error(e, "filterDlgCheckAction");
+       }
+
+}
+
+function explainError(code) {
+       return displayDlg("explainError", code);
+}