mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-04 22:33:15 +00:00
fix darkmode toggle
This commit is contained in:
parent
3cb8b19a4e
commit
88aff9cbe9
10
routes.go
10
routes.go
|
@ -772,14 +772,14 @@ func Settings(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|||
setCookie(w, "", name, r.FormValue(name))
|
||||
}
|
||||
state.Dark = new(bool)
|
||||
if r.FormValue("undarkmode") == "" {
|
||||
dark := r.FormValue("darkmode")
|
||||
undark := r.FormValue("undarkmode")
|
||||
if dark == "0" && undark != "0" {
|
||||
} else if dark == "0" && undark == "0" {
|
||||
setCookie(w, "", "Dark", "0")
|
||||
} else if r.FormValue("darkmode") != "" {
|
||||
} else {
|
||||
setCookie(w, "", "Dark", "1")
|
||||
*state.Dark = true
|
||||
} else {
|
||||
setCookie(w, "", "Dark", "0")
|
||||
*state.Dark = false
|
||||
}
|
||||
if r.FormValue("shownsfw") != "" {
|
||||
setCookie(w, "", "ShowNSFW", "1")
|
||||
|
|
|
@ -111,12 +111,16 @@
|
|||
dark mode
|
||||
</label>
|
||||
<input type="checkbox" name="darkmode" {{ if is .Dark }}checked{{end}}>
|
||||
<input type="hidden" name="darkmode" value="0">
|
||||
</div>
|
||||
<div id="undarkmode">
|
||||
<label>
|
||||
dark mode
|
||||
</label>
|
||||
{{ if not .Dark }}
|
||||
<input type="checkbox" name="undarkmode" checked>
|
||||
{{ end }}
|
||||
<input type="hidden" name="undarkmode" value="0">
|
||||
</div>
|
||||
<div class="scripting">
|
||||
<label>
|
||||
|
|
Loading…
Reference in a new issue