Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Merge pull request #159 from sfan5/changes

Changes
Cette révision appartient à :
keo 2017-05-07 22:22:42 +03:00 révisé par GitHub
révision 6e50f44799
6 fichiers modifiés avec 70 ajouts et 47 suppressions

Voir le fichier

@ -1,10 +1,13 @@
/* Night mode image */
#sunmoon {
position: fixed;
top: 10px;
height: 30px;
/* Night mode switcher */
.nightswitch {
position: fixed;
top: 12px;
right: 48px;
}
.nightswitch > a > img {
width: 24px;
}
/* Torrent status colors */
.remake {
background-color: #795c46;
@ -55,12 +58,8 @@ body {
text-align: center;
}
.pagination {
background-color: #264040;
}
.pagination > .active > a {
background-color: #ececec;
background: #ececec;
border-color: #ececec;
color: #337ab7; /* restore usual text color */
}
@ -115,6 +114,12 @@ a {
padding: 4px;
}
.captcha-container {
display: grid;
grid-template-rows: auto;
grid-template-columns: 240px;
}
tr.torrent-info td.date {
white-space: nowrap;
}
@ -154,13 +159,23 @@ div.container div.blockBody:nth-of-type(2) table tr:first-of-type th:last-of-typ
.table > tbody > tr > td {
border: none;
}
#container.cont-home {
background: #29363d url(/img/megumin.png) no-repeat;
}
#container.cont-view {
background: #29363d url(/img/megumin.png) no-repeat;
background-size: 75px, 100px;
}
}
/* Credit to bootsnipp.com for the css for the color graph */
.colorgraph {
height: 5px;
border-top: 0;
background: #c4e17f;
border-radius: 5px;
background-image: -webkit-linear-gradient(left, #c4e17f, #c4e17f 12.5%, #f7fdca 12.5%, #f7fdca 25%, #fecf71 25%, #fecf71 37.5%, #f0776c 37.5%, #f0776c 50%, #db9dbe 50%, #db9dbe 62.5%, #c49cde 62.5%, #c49cde 75%, #669ae1 75%, #669ae1 87.5%, #62c2e4 87.5%, #62c2e4);
background-image: -moz-linear-gradient(left, #c4e17f, #c4e17f 12.5%, #f7fdca 12.5%, #f7fdca 25%, #fecf71 25%, #fecf71 37.5%, #f0776c 37.5%, #f0776c 50%, #db9dbe 50%, #db9dbe 62.5%, #c49cde 62.5%, #c49cde 75%, #669ae1 75%, #669ae1 87.5%, #62c2e4 87.5%, #62c2e4);
background-image: -o-linear-gradient(left, #c4e17f, #c4e17f 12.5%, #f7fdca 12.5%, #f7fdca 25%, #fecf71 25%, #fecf71 37.5%, #f0776c 37.5%, #f0776c 50%, #db9dbe 50%, #db9dbe 62.5%, #c49cde 62.5%, #c49cde 75%, #669ae1 75%, #669ae1 87.5%, #62c2e4 87.5%, #62c2e4);
background-image: linear-gradient(to right, #c4e17f, #c4e17f 12.5%, #f7fdca 12.5%, #f7fdca 25%, #fecf71 25%, #fecf71 37.5%, #f0776c 37.5%, #f0776c 50%, #db9dbe 50%, #db9dbe 62.5%, #c49cde 62.5%, #c49cde 75%, #669ae1 75%, #669ae1 87.5%, #62c2e4 87.5%, #62c2e4);
}
.center-image {
max-width: 100%;
max-height: 80vh;
}
.navbar {

Voir le fichier

@ -1,9 +1,13 @@
/* Night mode image */
#sunmoon {
position: fixed;
top: 10px;
height: 30px;
/* Night mode switcher */
.nightswitch {
position: fixed;
top: 12px;
right: 48px;
}
.nightswitch > a > img {
width: 24px;
}
/* Torrent status colors */
.remake {
background-color: rgb(240, 176, 128);

Voir le fichier

@ -1,25 +1,20 @@
// Night mode
// also sorry that this code is soo bad, literally nothing else worked.. ima remake it in a near future
var night = localStorage.getItem("night");
if (night=="true") {
document.getElementById("style").href = "/css/style-night.css";
document.getElementById("nightbutton").innerHTML = "<img id='sunmoon' src='/img/sun.png' alt='Day!'>";
if (night == "true") {
$("#style")[0].href = "/css/style-night.css";
$("#nighticon")[0].src = "/img/sun.png";
}
function toggleNightMode() {
var styleshieeet = document.getElementById("style").href;
var styleshieet = new RegExp("style.css");
var stylesheet = styleshieet.test(styleshieeet);
if (stylesheet==true) {
document.getElementById("style").href = "/css/style-night.css";
document.getElementById("nightbutton").innerHTML = "<img id='sunmoon' src='/img/sun.png' alt='Day!'>";
localStorage.setItem("night", "true");
}
else {
document.getElementById("style").href = "/css/style.css";
document.getElementById("nightbutton").innerHTML = "<img id='sunmoon' src='/img/moon.png' alt='Night!'>";
localStorage.setItem("night", "false");
var night = localStorage.getItem("night");
if(night == "true") {
$("#style")[0].href = "/css/style.css";
$("#nighticon")[0].src = "/img/moon.png";
} else {
$("#style")[0].href = "/css/style-night.css";
$("#nighticon")[0].src = "/img/sun.png";
}
localStorage.setItem("night", (night == "true") ? "false" : "true");
}
// Used by spoiler tags
@ -30,6 +25,7 @@ function toggleLayer(elem) {
elem.classList.add("hide");
}
// Date formatting
function formatDate(date) { // thanks stackoverflow
var monthNames = [
"January", "February", "March",

Voir le fichier

@ -56,7 +56,13 @@ func GetTorrentsOrderBy(parameters *WhereParams, orderBy string, limit int, offs
var torrents []model.Torrents
var dbQuery *gorm.DB
var count int
conditions := "torrent_hash is not null" //filter out broken entries
conditions := "torrent_hash IS NOT NULL" // filter out broken entries
if strings.HasPrefix(orderBy, "filesize") {
// torrents w/ NULL filesize fuck up the sorting on postgres
// TODO: fix this properly
conditions += " AND filesize IS NOT NULL"
}
var params []interface{}
if parameters != nil { // if there is where parameters
conditions += " AND " + parameters.Conditions
@ -65,9 +71,9 @@ func GetTorrentsOrderBy(parameters *WhereParams, orderBy string, limit int, offs
db.ORM.Model(&torrents).Where(conditions, params...).Count(&count)
dbQuery = db.ORM.Model(&torrents).Where(conditions, params...)
if orderBy == "" {
if orderBy == "" { // default OrderBy
orderBy = "torrent_id DESC"
} // Default OrderBy
}
if limit != 0 || offset != 0 { // if limits provided
dbQuery = dbQuery.Limit(limit).Offset(offset)
}

Voir le fichier

@ -47,7 +47,6 @@
<li><a href="irc://irc.rizon.net/nyaapantsu">IRC</a></li>
<li><a href="{{ genRouteWithQuery "feed" .URL }}">RSS</a></li>
<li><a href="https://sukebei.pantsu.cat">Fap</a></li>
<li><a href="javascript:void(0);" id="nightbutton" onclick='toggleNightMode();'><img id="sunmoon" src="/img/moon.png" alt="Night!"></a></li>
</ul>
<form class="navbar-form navbar-right" role="search" action="/search" method="get">
@ -56,6 +55,9 @@
{{block "search_button" .}}{{end}}
</div>
</form>
<div class="nightswitch" style="position:absolute;right:1em">
<a href="javascript:toggleNightMode();" ><img id="nighticon" src="/img/moon.png"></a>
</div>
</div>
</div>
</nav>

Voir le fichier

@ -7,16 +7,16 @@ import (
func FormatFilesize(bytes int64) string {
var unit string
var value float64
if bytes > 1024*1024*1024*1024 {
if bytes >= 1024*1024*1024*1024 {
unit = "TiB"
value = float64(bytes) / (1024*1024*1024*1024)
} else if bytes > 1024*1024*1024 {
} else if bytes >= 1024*1024*1024 {
unit = "GiB"
value = float64(bytes) / (1024*1024*1024)
} else if bytes > 1024*1024 {
} else if bytes >= 1024*1024 {
unit = "MiB"
value = float64(bytes) / (1024*1024)
} else if bytes > 1024 {
} else if bytes >= 1024 {
unit = "KiB"
value = float64(bytes) / (1024)
} else {