X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=js%2Ftt-rss.js;h=fca9dac199d9f06aaccb897c9bcbc57ca9901c8a;hb=e2b8c9273e09091c235959c25d8e4d8122aa6ca8;hp=5d316c856d1e9255d83e40ba533a792782f51e1b;hpb=fd752a79af51ee5403f9eb7953855bd715a1ec71;p=tt-rss.git diff --git a/js/tt-rss.js b/js/tt-rss.js index 5d316c85..fca9dac1 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -206,7 +206,7 @@ function init() { "dijit/form/Form", "dijit/form/RadioButton", "dijit/form/Select", - "dijit/form/MultiSelect", + "dijit/form/MultiSelect", "dijit/form/SimpleTextarea", "dijit/form/TextBox", "dijit/form/ComboBox", @@ -237,25 +237,25 @@ function init() { loading_set_progress(30); init_hotkey_actions(); - const a = document.createElement('audio'); - const hasAudio = !!a.canPlayType; - const hasSandbox = "sandbox" in document.createElement("iframe"); - const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); - const clientTzOffset = new Date().getTimezoneOffset() * 60; + const a = document.createElement('audio'); + const hasAudio = !!a.canPlayType; + const hasSandbox = "sandbox" in document.createElement("iframe"); + const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); + const clientTzOffset = new Date().getTimezoneOffset() * 60; - const params = { - op: "rpc", method: "sanityCheck", hasAudio: hasAudio, - hasMp3: hasMp3, - clientTzOffset: clientTzOffset, - hasSandbox: hasSandbox - }; + const params = { + op: "rpc", method: "sanityCheck", hasAudio: hasAudio, + hasMp3: hasMp3, + clientTzOffset: clientTzOffset, + hasSandbox: hasSandbox + }; xhrPost("backend.php", params, (transport) => { - try { - backend_sanity_check_callback(transport); - } catch (e) { - console.error(e); - } + try { + backend_sanity_check_callback(transport); + } catch (e) { + console.error(e); + } }); } catch (e) { @@ -299,32 +299,6 @@ function init_hotkey_actions() { hotkey_actions["prev_article_noexpand"] = function() { moveToPost('prev', true, true); }; - hotkey_actions["collapse_article"] = function() { - const id = getActiveArticleId(); - const elem = $("CICD-"+id); - - if (elem) { - if (elem.visible()) { - cdmCollapseArticle(null, id); - } - else { - cdmExpandArticle(id); - } - } - }; - hotkey_actions["toggle_expand"] = function() { - const id = getActiveArticleId(); - const elem = $("CICD-"+id); - - if (elem) { - if (elem.visible()) { - cdmCollapseArticle(null, id, false); - } - else { - cdmExpandArticle(id); - } - } - }; hotkey_actions["search_dialog"] = function() { search(); }; @@ -361,13 +335,7 @@ function init_hotkey_actions() { scrollArticle(-40); }; hotkey_actions["close_article"] = function() { - if (isCdmMode()) { - if (!getInitParam("cdm_expanded")) { - cdmCollapseArticle(false, getActiveArticleId()); - } - } else { - closeArticlePanel(); - } + closeArticlePanel(); }; hotkey_actions["email_article"] = function() { if (typeof emailArticle != "undefined") { @@ -475,10 +443,12 @@ function init_hotkey_actions() { if (row) { const cb = dijit.getEnclosingWidget( - row.getElementsByClassName("rchk")[0]); + row.select(".rchk")[0]); if (cb) { - cb.attr("checked", !cb.attr("checked")); + if (!row.hasClassName("active")) + cb.attr("checked", !cb.attr("checked")); + toggleSelectRowById(cb, "RROW-" + id); return false; } @@ -524,23 +494,13 @@ function init_hotkey_actions() { const value = isCdmMode() ? "false" : "true"; xhrPost("backend.php", {op: "rpc", method: "setpref", key: "COMBINED_DISPLAY_MODE", value: value}, () => { - setInitParam("combined_display_mode", - !getInitParam("combined_display_mode")); + setInitParam("combined_display_mode", + !getInitParam("combined_display_mode")); - closeArticlePanel(); - viewCurrentFeed(); + closeArticlePanel(); + viewCurrentFeed(); }) }; - hotkey_actions["toggle_cdm_expanded"] = function() { - notify_progress("Loading, please wait..."); - - const value = getInitParam("cdm_expanded") ? "false" : "true"; - - xhrPost("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => { - setInitParam("cdm_expanded", !getInitParam("cdm_expanded")); - viewCurrentFeed(); - }); - }; } function init_second_stage() { @@ -693,8 +653,8 @@ function toggleDispRead() { const hide = !(getInitParam("hide_read_feeds") == "1"); xhrPost("backend.php", {op: "rpc", method: "setpref", key: "HIDE_READ_FEEDS", value: hide}, () => { - hideOrShowFeeds(hide); - setInitParam("hide_read_feeds", hide); + hideOrShowFeeds(hide); + setInitParam("hide_read_feeds", hide); }); } @@ -765,16 +725,16 @@ function viewModeChanged() { function hotkey_handler(e) { if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return; - const action_name = keyevent_to_action(e); + const action_name = keyevent_to_action(e); - if (action_name) { - const action_func = hotkey_actions[action_name]; + if (action_name) { + const action_func = hotkey_actions[action_name]; - if (action_func != null) { - action_func(); - e.stopPropagation(); - return false; - } + if (action_func != null) { + action_func(); + e.stopPropagation(); + return false; + } } } @@ -857,11 +817,11 @@ function handle_rpc_json(transport, scheduled_call) { return reply; } else { - if (netalert) - netalert.show(); - else - notify_error("Communication problem with server."); - } + if (netalert) + netalert.show(); + else + notify_error("Communication problem with server."); + } } catch (e) { if (netalert)