diff --git a/classes/rpc.php b/classes/rpc.php index 47fdf105a..59349a5f7 100755 --- a/classes/rpc.php +++ b/classes/rpc.php @@ -603,6 +603,7 @@ class RPC extends Handler_Protected { "feed_catchup" => __("Mark as read"), "feed_reverse" => __("Reverse headlines"), "feed_toggle_vgroup" => __("Toggle headline grouping"), + "feed_toggle_grid" => __("Toggle grid view"), "feed_debug_update" => __("Debug feed update"), "feed_debug_viewfeed" => __("Debug viewfeed()"), "catchup_all" => __("Mark all feeds as read"), @@ -676,8 +677,9 @@ class RPC extends Handler_Protected { "f q" => "feed_catchup", "f x" => "feed_reverse", "f g" => "feed_toggle_vgroup", + "f G" => "feed_toggle_grid", "f D" => "feed_debug_update", - "f G" => "feed_debug_viewfeed", + "f %" => "feed_debug_viewfeed", "f C" => "toggle_combined_mode", "f c" => "toggle_cdm_expanded", "Q" => "catchup_all", 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"); - 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");