1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-19 02:01:29 +00:00

actions dropdown: add context-sensitive UI layout labels

This commit is contained in:
Andrew Dolgov
2022-02-25 18:45:00 +03:00
parent 39c0bd378a
commit a395574516
2 changed files with 43 additions and 11 deletions

View File

@@ -299,6 +299,21 @@ const App = {
Headlines.renderAgain();
})
},
isExpandedMode: function() {
return !!this.getInitParam("cdm_expanded");
},
setExpandedMode: function(expand) {
if (App.isCombinedMode()) {
const value = expand ? "true" : "false";
xhr.post("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => {
this.setInitParam("cdm_expanded", !this.getInitParam("cdm_expanded"));
Headlines.renderAgain();
});
} else {
alert(__("This function is only available in combined mode."));
}
},
getActionByHotkeySequence: function(sequence) {
const hotkeys_map = this.getInitParam("hotkeys");
@@ -1236,12 +1251,7 @@ const App = {
App.setCombinedMode(!App.isCombinedMode());
};
this.hotkey_actions["toggle_cdm_expanded"] = () => {
const value = this.getInitParam("cdm_expanded") ? "false" : "true";
xhr.post("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => {
this.setInitParam("cdm_expanded", !this.getInitParam("cdm_expanded"));
Headlines.renderAgain();
});
App.setExpandedMode(!App.isExpandedMode());
};
this.hotkey_actions["article_span_grid"] = () => {
Article.cdmToggleGridSpan(Article.getActive());
@@ -1307,6 +1317,9 @@ const App = {
case "qmcToggleCombined":
App.setCombinedMode(!App.isCombinedMode());
break;
case "qmcToggleExpanded":
App.setExpandedMode(!App.isExpandedMode());
break;
case "qmcHKhelp":
this.hotkeyHelp()
break;