add hotkey (a N) to toggle night.css
This commit is contained in:
parent
a5813bb766
commit
1c8593c1fa
|
@ -1831,6 +1831,11 @@ body#sharepopup input {
|
||||||
.flat label.dijitButton:hover {
|
.flat label.dijitButton:hover {
|
||||||
background-color: #f5f5f5;
|
background-color: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
.flat .dijitTree .dijitTreeNode .dijitTreeRow {
|
||||||
|
padding: 4px 0px 4px;
|
||||||
|
border-width: 1px;
|
||||||
|
color: #555555;
|
||||||
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
@ -1873,11 +1878,6 @@ body#sharepopup input {
|
||||||
.flat .dijitCheckBox {
|
.flat .dijitCheckBox {
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
}
|
}
|
||||||
.flat .dijitTree .dijitTreeNode .dijitTreeRow {
|
|
||||||
padding: 4px 0px 4px;
|
|
||||||
border-width: 1px;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
body.ttrss_zoom {
|
body.ttrss_zoom {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -132,4 +132,13 @@
|
||||||
label.dijitButton:hover {
|
label.dijitButton:hover {
|
||||||
background-color : @color-panel-bg;
|
background-color : @color-panel-bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dijitTree {
|
||||||
|
.dijitTreeNode .dijitTreeRow {
|
||||||
|
padding : 4px 0px 4px;
|
||||||
|
border-width : 1px;
|
||||||
|
color : @default-text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -11,12 +11,4 @@
|
||||||
.dijitCheckBox {
|
.dijitCheckBox {
|
||||||
background : #ccc;
|
background : #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dijitTree {
|
|
||||||
.dijitTreeNode .dijitTreeRow {
|
|
||||||
padding : 4px 0px 4px;
|
|
||||||
border-width : 1px;
|
|
||||||
color : #333;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,10 +233,12 @@ function print_feed_cat_select($id, $default_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stylesheet_tag($filename) {
|
function stylesheet_tag($filename, $id = false) {
|
||||||
$timestamp = filemtime($filename);
|
$timestamp = filemtime($filename);
|
||||||
|
|
||||||
return "<link rel=\"stylesheet\" type=\"text/css\" href=\"$filename?$timestamp\"/>\n";
|
$id_part = $id ? "id=\"$id\"" : "";
|
||||||
|
|
||||||
|
return "<link rel=\"stylesheet\" $id_part type=\"text/css\" href=\"$filename?$timestamp\"/>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function javascript_tag($filename) {
|
function javascript_tag($filename) {
|
||||||
|
|
|
@ -1174,6 +1174,7 @@
|
||||||
"create_label" => __("Create label"),
|
"create_label" => __("Create label"),
|
||||||
"create_filter" => __("Create filter"),
|
"create_filter" => __("Create filter"),
|
||||||
"collapse_sidebar" => __("Un/collapse sidebar"),
|
"collapse_sidebar" => __("Un/collapse sidebar"),
|
||||||
|
"toggle_night_mode" => __("Toggle night mode"),
|
||||||
"help_dialog" => __("Show help dialog"))
|
"help_dialog" => __("Show help dialog"))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1245,6 +1246,7 @@
|
||||||
"c l" => "create_label",
|
"c l" => "create_label",
|
||||||
"c f" => "create_filter",
|
"c f" => "create_filter",
|
||||||
"c s" => "collapse_sidebar",
|
"c s" => "collapse_sidebar",
|
||||||
|
"a *n" => "toggle_night_mode",
|
||||||
"^(191)|Ctrl+/" => "help_dialog",
|
"^(191)|Ctrl+/" => "help_dialog",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,9 @@
|
||||||
<?php if ($_SESSION["uid"]) {
|
<?php if ($_SESSION["uid"]) {
|
||||||
$theme = get_pref("USER_CSS_THEME", false, false);
|
$theme = get_pref("USER_CSS_THEME", false, false);
|
||||||
if ($theme && theme_exists("$theme")) {
|
if ($theme && theme_exists("$theme")) {
|
||||||
echo stylesheet_tag(get_theme_path($theme));
|
echo stylesheet_tag(get_theme_path($theme), 'theme_css');
|
||||||
} else {
|
} else {
|
||||||
echo stylesheet_tag("css/default.css");
|
echo stylesheet_tag("css/default.css", 'theme_css');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -51,8 +51,9 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
if (dijit.byId("loading_bar"))
|
if (dijit.byId("loading_bar"))
|
||||||
dijit.byId("loading_bar").update({progress: loading_progress});
|
dijit.byId("loading_bar").update({progress: loading_progress});
|
||||||
|
|
||||||
if (loading_progress >= 90)
|
if (loading_progress >= 90) {
|
||||||
Element.hide("overlay");
|
$("overlay").hide();
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
keyeventToAction: function(event) {
|
keyeventToAction: function(event) {
|
||||||
|
@ -351,6 +352,29 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
|
|
||||||
this.initSecondStage();
|
this.initSecondStage();
|
||||||
},
|
},
|
||||||
|
toggleNightMode: function() {
|
||||||
|
const link = $("theme_css");
|
||||||
|
|
||||||
|
if (link) {
|
||||||
|
|
||||||
|
let user_theme = "";
|
||||||
|
let user_css = "";
|
||||||
|
|
||||||
|
if (link.getAttribute("href").indexOf("themes/night.css") == -1) {
|
||||||
|
user_css = "themes/night.css?" + Date.now();
|
||||||
|
user_theme = "night.css";
|
||||||
|
} else {
|
||||||
|
user_theme = "default.php";
|
||||||
|
user_css = "css/default.css?" + Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch(user_css).then(() => {
|
||||||
|
link.setAttribute("href", user_css);
|
||||||
|
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "USER_CSS_THEME", value: user_theme});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
explainError: function(code) {
|
explainError: function(code) {
|
||||||
return this.displayDlg(__("Error explained"), "explainError", code);
|
return this.displayDlg(__("Error explained"), "explainError", code);
|
||||||
},
|
},
|
||||||
|
|
|
@ -132,6 +132,8 @@ require(["dojo/_base/kernel",
|
||||||
case "help_dialog":
|
case "help_dialog":
|
||||||
App.helpDialog("main");
|
App.helpDialog("main");
|
||||||
return false;
|
return false;
|
||||||
|
case "toggle_night_mode":
|
||||||
|
App.toggleNightMode();
|
||||||
default:
|
default:
|
||||||
console.log("unhandled action: " + action_name + "; keycode: " + event.which);
|
console.log("unhandled action: " + action_name + "; keycode: " + event.which);
|
||||||
}
|
}
|
||||||
|
|
|
@ -466,6 +466,9 @@ require(["dojo/_base/kernel",
|
||||||
Feeds.reloadCurrent();
|
Feeds.reloadCurrent();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
this.hotkey_actions["toggle_night_mode"] = function () {
|
||||||
|
App.toggleNightMode();
|
||||||
|
};
|
||||||
},
|
},
|
||||||
onActionSelected: function(opid) {
|
onActionSelected: function(opid) {
|
||||||
switch (opid) {
|
switch (opid) {
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
<?php if ($_SESSION["uid"]) {
|
<?php if ($_SESSION["uid"]) {
|
||||||
$theme = get_pref("USER_CSS_THEME", false, false);
|
$theme = get_pref("USER_CSS_THEME", false, false);
|
||||||
if ($theme && theme_exists("$theme")) {
|
if ($theme && theme_exists("$theme")) {
|
||||||
echo stylesheet_tag(get_theme_path($theme));
|
echo stylesheet_tag(get_theme_path($theme), 'theme_css');
|
||||||
} else {
|
} else {
|
||||||
echo stylesheet_tag("css/default.css");
|
echo stylesheet_tag("css/default.css", 'theme_css');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1831,6 +1831,11 @@ body#sharepopup input {
|
||||||
.flat label.dijitButton:hover {
|
.flat label.dijitButton:hover {
|
||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
}
|
}
|
||||||
|
.flat .dijitTree .dijitTreeNode .dijitTreeRow {
|
||||||
|
padding: 4px 0px 4px;
|
||||||
|
border-width: 1px;
|
||||||
|
color: #cccccc;
|
||||||
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Material Icons';
|
font-family: 'Material Icons';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue