summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-10 10:01:22 +0300
committerAndrew Dolgov <[email protected]>2021-03-10 10:01:22 +0300
commit0b93d8d0137c46ce153ca65fae3e22304cc80009 (patch)
treee5982313d7a47fa16dbdf8303e86bc8af0315373 /js
parent089fa5ec26abf064416222f9d3404d8b3bd871a6 (diff)
add hotkey to toggle grid view
Diffstat (limited to 'js')
-rw-r--r--js/App.js6
-rw-r--r--js/Feeds.js1
-rwxr-xr-xjs/Headlines.js9
3 files changed, 12 insertions, 4 deletions
diff --git a/js/App.js b/js/App.js
index 20498e692..82c84ce3c 100644
--- a/js/App.js
+++ b/js/App.js
@@ -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");