Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Make golang theme toggler behave exactly like JS one (#1648)

* Make golang theme toggler behave exactly like JS one

* fix red buttons with same red text color on sukebei
Cette révision appartient à :
kilo 2017-10-11 17:31:54 +02:00 révisé par GitHub
Parent 2044a3c98a
révision 0459475ed4
2 fichiers modifiés avec 12 ajouts et 11 suppressions

Voir le fichier

@ -15,22 +15,20 @@ func toggleThemeHandler(c *gin.Context) {
theme, err := c.Cookie("theme")
if err != nil {
theme = "g"
theme = config.DefaultTheme(false)
}
theme2, err := c.Cookie("theme2")
if err != nil {
theme2 = "tomorrow"
theme2 = config.DefaultTheme(true)
}
if theme == theme2 {
if theme == "tomorrow" {
theme2 = "g"
if theme != config.DefaultTheme(true) && theme2 != config.DefaultTheme(true) {
//None of the themes are dark ones, force the second one as the dark one
theme2 = config.DefaultTheme(true)
} else if theme == theme2 {
//Both theme are dark ones, force the second one as the default (light) theme
theme2 = config.DefaultTheme(false)
}
if theme != "tomorrow" {
theme2 = "tomorrow"
}
}
//Get theme1 & theme2 value, set g.css & tomorrow.css by default
//Also check if both theme are identical which can happen at time
//Get theme1 & theme2 value
// If logged in, update user theme (will not work otherwise)
user := router.GetUser(c)

Voir le fichier

@ -96,6 +96,9 @@ td.tr-le, .error-text {
.btn-red {
background-color: #cc6666;
}
.sukebei .btn-red {
color: #c5c8c6;
}
.alt-colors tr:nth-child(even) {
background: hsla(244, 11%, 21%, 0.2);