add hotkey to toggle grid view

This commit is contained in:
Andrew Dolgov
2021-03-10 10:01:22 +03:00
parent 089fa5ec26
commit 0b93d8d013
4 changed files with 15 additions and 5 deletions
+6
View File
@@ -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();
-1
View File
@@ -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);
+6 -3
View File
@@ -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");
App.byId("headlines-frame").addClassName(App.isCombinedMode() ? "cdm" : "normal");
container.removeClassName("cdm");
container.removeClassName("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");