Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0

Merge branch 'dev' into filelist-fetching

Cette révision appartient à :
ewhal 2018-01-03 18:20:45 +10:00 révisé par GitHub
révision 1f2e85c1f5
Signature inconnue de Forgejo
ID de la clé GPG: 4AEE18F83AFDEB23
3 fichiers modifiés avec 36 ajouts et 11 suppressions

Voir le fichier

@ -7,26 +7,29 @@ import (
"github.com/NyaaPantsu/nyaa/controllers/router"
"github.com/NyaaPantsu/nyaa/utils/timeHelper"
"github.com/gin-gonic/gin"
"github.com/NyaaPantsu/nyaa/utils/publicSettings"
)
// toggleThemeHandler : Controller to switch between theme1 & theme2
func toggleThemeHandler(c *gin.Context) {
theme, err := c.Cookie("theme")
if err != nil {
theme = config.DefaultTheme(false)
}
DefaultTheme := config.DefaultTheme(false)
DefaultDarkTheme := config.DefaultTheme(true)
theme := publicSettings.GetThemeFromRequest(c)
theme2, err := c.Cookie("theme2")
if err != nil {
theme2 = config.DefaultTheme(true)
theme2 = publicSettings.GetDarkThemeFromRequest(c)
}
if theme != config.DefaultTheme(true) && theme2 != config.DefaultTheme(true) {
if theme != DefaultDarkTheme && theme2 != DefaultDarkTheme {
//None of the themes are dark ones, force the second one as the dark one
theme2 = config.DefaultTheme(true)
theme2 = DefaultDarkTheme
} else if theme == theme2 {
//Both theme are dark ones, force the second one as the default (light) theme
theme2 = config.DefaultTheme(false)
theme2 = DefaultTheme
}
//Get theme1 & theme2 value

Voir le fichier

@ -454,7 +454,7 @@ span.comment-user:hover {
float: right;
margin-top: 7px;
}
.torrent-buttons a, .torrent-buttons button {
.torrent-buttons a, .torrent-buttons button, .torrent-buttons input[type="submit"] {
height: 26px!important;
background: linear-gradient(to bottom, #33ca98 0%, #336867 72%);
color: white!important;
@ -465,9 +465,9 @@ span.comment-user:hover {
border: none;
padding: 2px 7px;
margin-right: 6px;
float: left;
float: left!important;
}
.sukebei .torrent-buttons a, .sukebei .torrent-buttons button {
.sukebei .torrent-buttons a, .sukebei .torrent-buttons button, .sukebei .torrent-buttons input[type="submit"] {
background: linear-gradient(to bottom, #CA3346 5%, #482120 80%);
}
.torrent-buttons a.hidden {
@ -476,6 +476,7 @@ span.comment-user:hover {
}
.torrent-buttons a:hover {
text-decoration: none;
cursor: pointer;
}
.torrent-buttons div {
margin-right: 0!important;
@ -733,6 +734,7 @@ span.tag {
.comment-form .editor-toolbar a {
width: 24px;
height: 20px;
background: #fbfbfb;
}
.editor-toolbar a:before {
line-height: 25px;

Voir le fichier

@ -195,6 +195,26 @@ function startupCode() {
//If user has no default theme, set these by default
if(getCookieValue("theme") == "") {
//User has no theme selected, we check if the domain name (without sub domain) includes the word "nyaa" and if it does, we set the theme as classic theme
var hostName = window.location.host
var lastDotIndex = hostName.lastIndexOf(".")
var secondLast = -1
for(var index = 0; index < lastDotIndex; index++) {
if(hostName[index] == '.')
secondLast = index
}
hostName = hostName.substr(secondLast == -1 ? 0 : secondLast)
if(hostName.includes("nyaa")) {
document.cookie = "theme=classic;path=/;expires=" + farFutureString + ";domain=" + domain
document.getElementById("theme").href = "/css/themes/classic.css";
}
}
if(document.cookie.includes("theme2=")) {
UserTheme[1] = getCookieValue("theme2")
//If user already has ran the ToggleTheme() function in the past, we get the value of the second theme (the one the script switches to)