Fix #476 broken darktheme embeds

One tiny step toward #419 as well ;p
This commit is contained in:
2022-01-20 10:50:41 +00:00
parent a556b17d2d
commit cc6992976e
5 changed files with 35 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
{% load static %}
<script>
if({{ request.user.dark_theme|lower|default:'false' }} || window.matchMedia('(prefers-color-scheme: dark)').matches) {
$('<link>').prependTo('head').attr({type : 'text/css', rel : 'stylesheet'}).attr('href', '{% static "css/dark_screen.css" %}');
document.querySelector('head').innerHTML += '<link rel="stylesheet" href="{% static "css/dark_screen.css" %}" type="text/css"/>';
document.body.setAttribute('data-theme', 'dark');
}
</script>