summaryrefslogtreecommitdiff
path: root/templates/layouts
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-05-16 20:39:54 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-05-16 20:39:54 +0200
commit681ecabdf685caa07ad555139f35f159e89be260 (patch)
tree3f4622472668918103e003cc687cf140e95a409d /templates/layouts
parent6457ef2f9d42475cf5794a6a6a697dae2db47ede (diff)
Provide light theme by default, avoid re-styling unless dark theme is active
This eliminates a large portion of main-thread work on page load
Diffstat (limited to 'templates/layouts')
-rw-r--r--templates/layouts/default.html.ep8
1 files changed, 4 insertions, 4 deletions
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index 9f858df..fd21635 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -18,12 +18,15 @@
<link rel="apple-touch-icon" sizes="152x152" href="/static/<%= $av %>/icons/icon-152x152.png">
<link rel="apple-touch-icon" sizes="167x167" href="/static/<%= $av %>/icons/icon-167x167.png">
<link rel="manifest" href="/static/<%= $av %>/manifest.json">
+ %= stylesheet "/static/${av}/css/light.min.css", id => 'theme'
<script>
function addStyleSheet(name, id) {
var path = '/static/<%=$av%>/css/' + name + '.css';
var old = document.getElementById(id);
if (old) {
- old.href = path;
+ if (old.href != path) {
+ old.href = path;
+ }
} else {
var st = document.createElement('link');
st.id = id;
@@ -48,9 +51,6 @@ function toggleTheme() {
addStyleSheet(currentTheme, 'theme');
}
</script>
- <noscript>
- %= stylesheet "/static/${av}/css/light.min.css"
- </noscript>
%= stylesheet "/static/${av}/css/material-icons.css"
%= stylesheet "/static/${av}/css/local.css"
%= javascript "/static/${av}/js/jquery-3.4.1.min.js"