Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/skins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2021-09-25 10:59:23 +0300
committerAleksander Machniak <alec@alec.pl>2021-09-25 10:59:23 +0300
commit5db6dd0317e7c0ae98bf5ce5d3e117b74803b86b (patch)
tree396d9b77e853e3b0a799381615b4c1638b264bca /skins
parent800832612c909735f15f95743b3c7a05fae56363 (diff)
Fix handling of dark_mode_support:false setting in skins meta.json (#8186)
Diffstat (limited to 'skins')
-rw-r--r--skins/elastic/ui.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js
index 699936e6a..967f3eb23 100644
--- a/skins/elastic/ui.js
+++ b/skins/elastic/ui.js
@@ -771,8 +771,12 @@ function rcube_elastic_ui()
return;
}
- var pref,
+ // We deliberately use only cookies here, not local storage
+ var pref = rcmail.get_cookie('colorMode'),
color_scheme = window.matchMedia('(prefers-color-scheme: dark)'),
+ reset_cookie = function() {
+ rcmail.set_cookie('colorMode', '', new Date()); // delete the cookie
+ },
switch_iframe_color_mode = function() {
try {
$(this.contentWindow.document).find('html')[color_mode == 'dark' ? 'addClass' : 'removeClass']('dark-mode');
@@ -793,6 +797,14 @@ function rcube_elastic_ui()
$('iframe').each(switch_iframe_color_mode);
};
+ if (rcmail.env.dark_mode_support === false) {
+ if (pref == 'dark') {
+ reset_cookie();
+ $('iframe').each(switch_iframe_color_mode);
+ }
+ return;
+ }
+
// Add onclick action to the menu button
$('#taskmenu a.theme').on('click', function() {
color_mode = $(this).is('.dark') ? 'dark' : 'light';
@@ -804,11 +816,10 @@ function rcube_elastic_ui()
color_scheme.addListener(function(e) {
color_mode = e.matches ? 'dark' : 'light';
switch_color_mode();
- rcmail.set_cookie('colorMode', '', new Date()); // delete the cookie
+ reset_cookie();
});
- // We deliberately use only cookies here, not local storage
- if (pref = rcmail.get_cookie('colorMode')) {
+ if (pref) {
color_mode = pref;
}
else if (color_scheme.matches) {