diff --git a/public/css/style-night.css b/public/css/style-night.css index bee07f0a..ec5f2263 100644 --- a/public/css/style-night.css +++ b/public/css/style-night.css @@ -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 { diff --git a/public/css/style.css b/public/css/style.css index f3a6673d..7877c119 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -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); diff --git a/public/js/main.js b/public/js/main.js index f34c0abe..657a4909 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -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 = ""; +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 = ""; - localStorage.setItem("night", "true"); - } - else { - document.getElementById("style").href = "/css/style.css"; - document.getElementById("nightbutton").innerHTML = ""; - 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", diff --git a/service/torrent/torrent.go b/service/torrent/torrent.go index 89d4b049..d977ce94 100644 --- a/service/torrent/torrent.go +++ b/service/torrent/torrent.go @@ -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) } diff --git a/templates/index.html b/templates/index.html index bf00535a..112d8143 100755 --- a/templates/index.html +++ b/templates/index.html @@ -47,7 +47,6 @@