mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-08 08:04:26 +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))
|
setCookie(w, "", name, r.FormValue(name))
|
||||||
}
|
}
|
||||||
state.Dark = new(bool)
|
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")
|
setCookie(w, "", "Dark", "0")
|
||||||
} else if r.FormValue("darkmode") != "" {
|
} else {
|
||||||
setCookie(w, "", "Dark", "1")
|
setCookie(w, "", "Dark", "1")
|
||||||
*state.Dark = true
|
*state.Dark = true
|
||||||
} else {
|
|
||||||
setCookie(w, "", "Dark", "0")
|
|
||||||
*state.Dark = false
|
|
||||||
}
|
}
|
||||||
if r.FormValue("shownsfw") != "" {
|
if r.FormValue("shownsfw") != "" {
|
||||||
setCookie(w, "", "ShowNSFW", "1")
|
setCookie(w, "", "ShowNSFW", "1")
|
||||||
|
|
|
@ -111,12 +111,16 @@
|
||||||
dark mode
|
dark mode
|
||||||
</label>
|
</label>
|
||||||
<input type="checkbox" name="darkmode" {{ if is .Dark }}checked{{end}}>
|
<input type="checkbox" name="darkmode" {{ if is .Dark }}checked{{end}}>
|
||||||
|
<input type="hidden" name="darkmode" value="0">
|
||||||
</div>
|
</div>
|
||||||
<div id="undarkmode">
|
<div id="undarkmode">
|
||||||
<label>
|
<label>
|
||||||
dark mode
|
dark mode
|
||||||
</label>
|
</label>
|
||||||
|
{{ if not .Dark }}
|
||||||
<input type="checkbox" name="undarkmode" checked>
|
<input type="checkbox" name="undarkmode" checked>
|
||||||
|
{{ end }}
|
||||||
|
<input type="hidden" name="undarkmode" value="0">
|
||||||
</div>
|
</div>
|
||||||
<div class="scripting">
|
<div class="scripting">
|
||||||
<label>
|
<label>
|
||||||
|
|
Loading…
Reference in a new issue