diff options
author | marudor <marudor@marudor.de> | 2019-05-16 15:22:47 +0200 |
---|---|---|
committer | marudor <marudor@marudor.de> | 2019-05-16 15:22:47 +0200 |
commit | 87e74ca90d4c13758461f380b00ed83b5a287da9 (patch) | |
tree | 545f0965a51987c9e61b3860f45a24b527bc1702 /templates/layouts/default.html.ep | |
parent | 5c2388d3a2092505aff9f7b2e78e561c4db65385 (diff) |
Add color switcher to toolbar
Diffstat (limited to 'templates/layouts/default.html.ep')
-rw-r--r-- | templates/layouts/default.html.ep | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 40793e1..54f9e1f 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -19,19 +19,21 @@ <link rel="apple-touch-icon" sizes="167x167" href="/static/<%= $av %>/icons/icon-167x167.png"> <link rel="manifest" href="/static/<%= $av %>/manifest.json"> <script> - function addStyleSheet(path) { - var st = document.createElement('link'); - st.href = path; - st.rel = 'stylesheet'; - document.head.appendChild(st); - } - - if (window.matchMedia('(prefers-color-scheme: dark').matches) { - addStyleSheet("/static/<%= $av %>/css/dark.min.css"); - } else { - addStyleSheet("/static/<%= $av %>/css/light.min.css"); + function addStyleSheet(name, id) { + var path = '/static/<%=$av%>/css/' + name + '.css'; + var old = document.getElementById(id); + if (old) { + old.href = path; + } else { + var st = document.createElement('link'); + st.id = id; + st.href = "/static/<%=$av%>/css/" + name + '.css'; + st.rel = 'stylesheet'; + document.head.appendChild(st); + } } </script> + %= javascript "/static/${av}/js/theme.min.js" <noscript> %= stylesheet "/static/${av}/css/light.min.css" </noscript> @@ -67,6 +69,9 @@ </div> </div> </li> + <li class="waves-effect waves-light"> + <a onClick="javascript:toggleTheme()"><i class="material-icons">invert_colors</i></a> + </li> % if (is_user_authenticated()) { <li class="<%= navbar_class('/history') %>"><a href='/history' title="History"><i class="material-icons">history</i></a></li> <li class="<%= navbar_class('/account') %>"><a href="/account" title="Account"><i class="material-icons">account_circle</i></a></li> |