]> git.wh0rd.org - tt-rss.git/blobdiff - js/tt-rss.js
Merge branch 'master' of git.tt-rss.org:fox/tt-rss
[tt-rss.git] / js / tt-rss.js
index afbc775f21311cef7384df598e41e2e46f7b5c13..3f65a2cea0eff9f2227540538b14f5c1feb7ce83 100644 (file)
@@ -148,7 +148,7 @@ function viewCurrentFeed(method) {
 
 function timeout() {
        if (getInitParam("bw_limit") != "1") {
-               request_counters();
+               request_counters(true);
                setTimeout(timeout, 60*1000);
        }
 }
@@ -160,7 +160,7 @@ function search() {
        if (dijit.byId("searchDlg"))
                dijit.byId("searchDlg").destroyRecursive();
 
-       dialog = new dijit.Dialog({
+       var dialog = new dijit.Dialog({
                id: "searchDlg",
                title: __("Search"),
                style: "width: 600px",
@@ -228,6 +228,7 @@ function init() {
                        "dijit/form/Form",
                        "dijit/form/RadioButton",
                        "dijit/form/Select",
+               "dijit/form/MultiSelect",
                        "dijit/form/SimpleTextarea",
                        "dijit/form/TextBox",
                        "dijit/form/ComboBox",
@@ -244,6 +245,7 @@ function init() {
                        "dijit/tree/dndSource",
                        "dijit/tree/ForestStoreModel",
                        "dojo/data/ItemFileWriteStore",
+                       "fox/FeedStoreModel",
                        "fox/FeedTree" ], function (dojo, ready, parser) {
 
                        ready(function() {
@@ -364,7 +366,6 @@ function init_hotkey_actions() {
        hotkey_actions["open_in_new_window"] = function() {
                if (getActiveArticleId()) {
                        openArticleInNewWindow(getActiveArticleId());
-                       return;
                }
        };
        hotkey_actions["catchup_below"] = function() {
@@ -374,13 +375,9 @@ function init_hotkey_actions() {
                catchupRelativeToArticle(0);
        };
        hotkey_actions["article_scroll_down"] = function() {
-               var ctr = $("content_insert") ? $("content_insert") : $("headlines-frame");
-
                scrollArticle(40);
        };
        hotkey_actions["article_scroll_up"] = function() {
-               var ctr = $("content_insert") ? $("content_insert") : $("headlines-frame");
-
                scrollArticle(-40);
        };
        hotkey_actions["close_article"] = function() {
@@ -614,7 +611,7 @@ function init_second_stage() {
        dijit.getEnclosingWidget(toolbar.order_by).attr('value',
                getInitParam("default_view_order_by"));
 
-       feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
+       var feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
 
        var hash_feed_id = hash_get('f');
        var hash_feed_is_cat = hash_get('c') == "1";
@@ -632,8 +629,8 @@ function init_second_stage() {
        var hotkeys = getInitParam("hotkeys");
        var tmp = [];
 
-       for (sequence in hotkeys[1]) {
-               filtered = sequence.replace(/\|.*$/, "");
+       for (var sequence in hotkeys[1]) {
+               var filtered = sequence.replace(/\|.*$/, "");
                tmp[filtered] = hotkeys[1][sequence];
        }
 
@@ -756,7 +753,7 @@ function parse_runtime_info(data) {
 
        //console.log("parsing runtime info...");
 
-       for (k in data) {
+       for (var k in data) {
                var v = data[k];
 
 //             console.log("RI: " + k + " => " + v);
@@ -851,26 +848,15 @@ function hotkey_handler(e) {
        if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
 
        var keycode = false;
-       var shift_key = false;
-       var ctrl_key = false;
-       var alt_key = false;
-       var meta_key = false;
 
        var cmdline = $('cmdline');
 
-       shift_key = e.shiftKey;
-       ctrl_key = e.ctrlKey;
-       alt_key = e.altKey;
-       meta_key = e.metaKey;
-
        if (window.event) {
                keycode = window.event.keyCode;
        } else if (e) {
                keycode = e.which;
        }
 
-       var keychar = String.fromCharCode(keycode);
-
        if (keycode == 27) { // escape
                hotkey_prefix = false;
        }
@@ -878,9 +864,8 @@ function hotkey_handler(e) {
        if (keycode == 16) return; // ignore lone shift
        if (keycode == 17) return; // ignore lone ctrl
 
-       keychar = keychar.toLowerCase();
-
        var hotkeys = getInitParam("hotkeys");
+       var keychar = String.fromCharCode(keycode).toLowerCase();
 
        if (!hotkey_prefix && hotkeys[0].indexOf(keychar) != -1) {
 
@@ -894,7 +879,9 @@ function hotkey_handler(e) {
                Element.show(cmdline);
 
                e.stopPropagation();
-               return false;
+
+               // returning false here literally disables ctrl-c in browser lol (because C is a valid prefix)
+               return true;
        }
 
        Element.hide(cmdline);
@@ -902,10 +889,10 @@ function hotkey_handler(e) {
        var hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
 
        // ensure ^*char notation
-       if (shift_key) hotkey = "*" + hotkey;
-       if (ctrl_key) hotkey = "^" + hotkey;
-       if (alt_key) hotkey = "+" + hotkey;
-       if (meta_key) hotkey = "%" + hotkey;
+       if (e.shiftKey) hotkey = "*" + hotkey;
+       if (e.ctrlKey) hotkey = "^" + hotkey;
+       if (e.altKey) hotkey = "+" + hotkey;
+       if (e.metaKey) hotkey = "%" + hotkey;
 
        hotkey = hotkey_prefix ? hotkey_prefix + " " + hotkey : hotkey;
        hotkey_prefix = false;
@@ -913,7 +900,7 @@ function hotkey_handler(e) {
        var hotkey_action = false;
        var hotkeys = getInitParam("hotkeys");
 
-       for (sequence in hotkeys[1]) {
+       for (var sequence in hotkeys[1]) {
                if (sequence == hotkey) {
                        hotkey_action = hotkeys[1][sequence];
                        break;
@@ -1031,7 +1018,7 @@ function handle_rpc_json(transport, scheduled_call) {
 function switchPanelMode(wide) {
        if (isCdmMode()) return;
 
-       article_id = getActiveArticleId();
+       var article_id = getActiveArticleId();
 
        if (wide) {
                dijit.byId("headlines-wrap-inner").attr("design", 'sidebar');
@@ -1090,11 +1077,11 @@ function update_random_feed() {
 }
 
 function hash_get(key) {
-       kv = window.location.hash.substring(1).toQueryParams();
+       var kv = window.location.hash.substring(1).toQueryParams();
        return kv[key];
 }
 function hash_set(key, value) {
-       kv = window.location.hash.substring(1).toQueryParams();
+       var kv = window.location.hash.substring(1).toQueryParams();
        kv[key] = value;
        window.location.hash = $H(kv).toQueryString();
 }