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") theme, err := c.Cookie("theme")
if err != nil { if err != nil {
theme = "g" theme = config.DefaultTheme(false)
} }
theme2, err := c.Cookie("theme2") theme2, err := c.Cookie("theme2")
if err != nil { if err != nil {
theme2 = "tomorrow" theme2 = config.DefaultTheme(true)
} }
if theme == theme2 { if theme != config.DefaultTheme(true) && theme2 != config.DefaultTheme(true) {
if theme == "tomorrow" { //None of the themes are dark ones, force the second one as the dark one
theme2 = "g" theme2 = config.DefaultTheme(true)
} } else if theme == theme2 {
if theme != "tomorrow" { //Both theme are dark ones, force the second one as the default (light) theme
theme2 = "tomorrow" theme2 = config.DefaultTheme(false)
}
} }
//Get theme1 & theme2 value, set g.css & tomorrow.css by default //Get theme1 & theme2 value
//Also check if both theme are identical which can happen at time
// If logged in, update user theme (will not work otherwise) // If logged in, update user theme (will not work otherwise)
user := router.GetUser(c) user := router.GetUser(c)

Voir le fichier

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