jlelse
/
Indieroad
Archived
1
Fork 0

Remove theme toggle

This commit is contained in:
Jan-Lukas Else 2020-01-21 20:52:29 +01:00
parent ea844bce3d
commit 97a6f2c722
6 changed files with 2 additions and 63 deletions

View File

@ -71,18 +71,11 @@ $colors: (
* { * {
@include lightmode; @include lightmode;
@media (prefers-color-scheme: light) {
@include lightmode;
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
@include darkmode; @include darkmode;
} }
} }
.dark, .dark * {
@include darkmode;
}
/* Structure */ /* Structure */
$break1: 620px; $break1: 620px;
@ -874,21 +867,8 @@ textarea {
text-align: center; text-align: center;
} }
} }
.toggle {
order: 2;
&:hover {
cursor: pointer;
}
@media screen and (max-width: $break3) {
padding-bottom: 8px;
text-align: center;
}
.no-js & {
display: none;
}
}
.links { .links {
order: 3; order: 2;
a { a {
margin-left: 15px; margin-left: 15px;
&:first-child { &:first-child {

View File

@ -1,28 +0,0 @@
'use strict';
function toggleTheme(){
if (localStorage && localStorage.getItem("theme") === "dark"){
localStorage.setItem("theme", "default");
} else if (localStorage){
localStorage.setItem("theme", "dark");
}
checkTheme();
}
function checkTheme(){
if (localStorage && localStorage.getItem("theme") === "dark"){
document.body.className = "body dark";
} else if (localStorage){
document.body.className = "body";
}
}
function checkToggleAllowed(){
if(window.matchMedia("(prefers-color-scheme: dark)").matches || window.matchMedia("(prefers-color-scheme: light)").matches){
document.getElementById("theme-toggle").remove();
} else {
checkTheme();
}
}
checkToggleAllowed();

View File

@ -36,10 +36,6 @@
- id: 404_text - id: 404_text
translation: "Die gesuchte Seite existiert nicht, wurde verschoben oder gelöscht." translation: "Die gesuchte Seite existiert nicht, wurde verschoben oder gelöscht."
# Toggle theme
- id: toggle_theme
translation: Theme umschalten
# Webmention Form # Webmention Form
- id: wmform_label - id: wmform_label
translation: "Hast du eine Antwort hierzu veröffentlicht? Lass mich den Link wissen:" translation: "Hast du eine Antwort hierzu veröffentlicht? Lass mich den Link wissen:"

View File

@ -36,10 +36,6 @@
- id: 404_text - id: 404_text
translation: "The page you were looking for appears to have been moved, deleted or does not exist." translation: "The page you were looking for appears to have been moved, deleted or does not exist."
# Toggle theme
- id: toggle_theme
translation: Toggle theme
# Webmention Form # Webmention Form
- id: wmform_label - id: wmform_label
translation: "Have you published a response to this? Let me know the link:" translation: "Have you published a response to this? Let me know the link:"

View File

@ -1,11 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html class="no-js" lang="{{ .Site.LanguageCode | default "en-us" }}"> <html lang="{{ .Site.LanguageCode | default "en-us" }}">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ block "title" . }}{{ if not .IsHome }}{{ with .Title }}{{ . }} - {{end}}{{ end }}{{ .Site.Title }}{{ end }}</title> <title>{{ block "title" . }}{{ if not .IsHome }}{{ with .Title }}{{ . }} - {{end}}{{ end }}{{ .Site.Title }}{{ end }}</title>
<script>(function(d,e){d[e]=d[e].replace("no-js","js");})(document.documentElement,"className");</script>
<meta name="theme-color" content="{{ .Param "colors.main" | default "#0275D8" }}"> <meta name="theme-color" content="{{ .Param "colors.main" | default "#0275D8" }}">
<meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{else}}{{ .Params.Description }}{{end}}"> <meta name="description" content="{{ if .IsHome }}{{ .Site.Params.description }}{{else}}{{ .Params.Description }}{{end}}">
{{ template "_internal/opengraph.html" . }} {{ template "_internal/opengraph.html" . }}
@ -42,7 +41,6 @@
</div> </div>
{{ partial "footer" . }} {{ partial "footer" . }}
</div> </div>
{{ with resources.Get "js/theme.js" | minify }}<script>{{ .Content | safeJS }}</script>{{ end }}
{{ partial "custombodyend" . }} {{ partial "custombodyend" . }}
</body> </body>
</html> </html>

View File

@ -7,9 +7,6 @@
{{- end }} {{- end }}
</div> </div>
{{- end }} {{- end }}
<div class="toggle" id="theme-toggle">
<a onclick="toggleTheme();">{{ T "toggle_theme" }}</a>
</div>
<div class="copyright"> <div class="copyright">
&copy; {{ now.Format "2006" }} {{ .Site.Params.copyright | default .Site.Title }} &copy; {{ now.Format "2006" }} {{ .Site.Params.copyright | default .Site.Title }}
</div> </div>