diff options
author | Andrew Dolgov <[email protected]> | 2021-03-10 10:01:22 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-03-10 10:01:22 +0300 |
commit | 0b93d8d0137c46ce153ca65fae3e22304cc80009 (patch) | |
tree | e5982313d7a47fa16dbdf8303e86bc8af0315373 /js | |
parent | 089fa5ec26abf064416222f9d3404d8b3bd871a6 (diff) |
add hotkey to toggle grid view
Diffstat (limited to 'js')
-rw-r--r-- | js/App.js | 6 | ||||
-rw-r--r-- | js/Feeds.js | 1 | ||||
-rwxr-xr-x | js/Headlines.js | 9 |
3 files changed, 12 insertions, 4 deletions
@@ -1102,6 +1102,12 @@ const App = { this.hotkey_actions["feed_reverse"] = () => { Headlines.reverse(); }; + this.hotkey_actions["feed_toggle_grid"] = () => { + xhr.json("backend.php", {op: "rpc", method: "togglepref", key: "CDM_ENABLE_GRID"}, (reply) => { + App.setInitParam("cdm_enable_grid", reply.value); + Headlines.renderAgain(); + }) + }; this.hotkey_actions["feed_toggle_vgroup"] = () => { xhr.post("backend.php", {op: "rpc", method: "togglepref", key: "VFEED_GROUP_BY_FEED"}, () => { Feeds.reloadCurrent(); diff --git a/js/Feeds.js b/js/Feeds.js index 9e65a06fd..46d978cb4 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -330,7 +330,6 @@ const Feeds = { container.setAttribute("data-feed-id", id); container.setAttribute("data-is-cat", is_cat ? "true" : "false"); - container.setAttribute("data-enable-grid", App.getInitParam("cdm_enable_grid") ? "true" : "false"); this.select(id, is_cat); diff --git a/js/Headlines.js b/js/Headlines.js index 8f104c951..fce371904 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -383,10 +383,13 @@ const Headlines = { return this.headlines[id]; }, setCommonClasses: function () { - App.byId("headlines-frame").removeClassName("cdm"); - App.byId("headlines-frame").removeClassName("normal"); + const container = App.byId("headlines-frame"); + + container.removeClassName("cdm"); + container.removeClassName("normal"); - App.byId("headlines-frame").addClassName(App.isCombinedMode() ? "cdm" : "normal"); + container.addClassName(App.isCombinedMode() ? "cdm" : "normal"); + container.setAttribute("data-enable-grid", App.getInitParam("cdm_enable_grid") ? "true" : "false"); // for floating title because it's placed outside of headlines-frame App.byId("main").removeClassName("expandable"); |