Skip to content

Nyaa DeeperDark by spiritomb10

Details

Authorspiritomb10

LicenseNo License

Categorynyaa.si

Created

Updated

Size35 kB

Statistics

Learn how we calculate statistics in the FAQ.

Failed to fetch stats.

Description

Tweaks to the existing Nyaa DeepDark userstyle

Notes

Userstyle doesn't have notes.

Source code

Source code has over 10K characters, so we truncated it. You can inspect the full source code on install link.
/* ==UserStyle==
@name Nyaa DeeperDark
@description Combination of "DeepDark" by RaitaroH and "Nyaa.si Dark" by Coordinates
@namespace github.com/ShadyDeth/Nyaa-DeeperDark
@homepageURL https://github.com/ShadyDeth/Nyaa-DeeperDark
@version 1.0.7
@author ShadyDeth
@license GNU-V3.0

@preprocessor stylus

@var select stylus-deepdark-style "Preset themes" [
	"Deep-Dark",
	"Inspired-Dark",
	"Breeze-Dark",
	"HavocOS",
	"Arc-Dark",
	"Adapta-Nokto",
	"Adapta-Breath-Nokto",
	"Gruvbox-Dark",
	"Gruvbox-Light",
	"NierAutomata-Dark",
	"NierAutomata-Light",
	"Solarized-Dark",
	"Solarized-Light",
	"Vertex-Dark",
	"Mint-Y-Dark",
	"9anime",
	"Firefox-Dark",
	"Firefox-57",
	"Discord",
	"YouTube-Dark",
	"Black-and-White",
	"Yellow",
	"Yellow-2",
	"Ubuntu-Grey",
	"Ubuntu-Purple",
	"Orange",
	"Jisho"
]

@var checkbox hide-comments "Hide Comments" 0
@var checkbox hide-fap "Hide Fap Link" 0

function actual_main(ids) {
    if (window.location.href.match("view")) {
        set_view_blue(ids)
    } else {
        set_search_blue(ids)
    }
}

function set_view_blue(ids) {
    let page_id = window
        .location
        .href
        .match("view/([0-9]+)")[1]
    if (ids.has(page_id)) {
        document.getElementsByClassName("panel-title")[0].parentNode.parentNode.className = "panel panel-info";
    }
}

function set_search_blue(ids) {
    let torrentlist = document.getElementsByClassName("torrent-list")[0].tBodies[0].childNodes
    let i
    for (i in torrentlist) {
        let id;
        try {
            id = torrentlist[i]
                .cells[1]
                .childNodes[1]
                .attributes
                .href
                .value
                .match("view/([0-9]+)")[1]
        } catch {
            continue;
        }
        if (ids.has(id)) {
            torrentlist[i].className = "info"
        }
    }
}

function main() {
    GM.xmlHttpRequest({
        headers: {
            "Accept": "application/json",
            "User-Agent": "nyaablue.user.js"
        },
        method: "GET",
        url: encodeURI(dex + "api/public/nyaa"),
        onload: function(response) {
            let entries = JSON.parse(response.responseText);
            let ids = new Array()
            for (let i in entries) {
                for (let j in entries[i].nyaaIDs) {
                  ids.push(String(entries[i].nyaaIDs[j]))
                }
            }
            GM.setValue("ids", ids)
            GM.setValue("last_update", Date.now())
            ids = new Set(ids)
            actual_main(ids) // i would've much preferred to just get the output as a variable in actual_main but GM_xhr says no
        }
    })
}

async function check_cache() {
    try {
        const last_update = await GM.getValue("last_update")
        if (typeof last_update !== "number") {
            throw "no_time"
        }
        if (Date.now() > last_update + 3600000) { // not updated in 1 hour
            //("cache old")
            main()
        } else {
            //console.log("cache fine")
            const cached_ids = await GM.getValue("ids")
            if (typeof cached_ids !== "object") {throw "bad data"}
            actual_main(new Set(cached_ids))
        }
    } catch {
        console.log("ooer")
        main()
    }
}

// dark theme "support" (thanks olli)
document.head.insertAdjacentHTML('beforeend', '<style id="css_blue" type="text/css">body.dark .torrent-list > tbody > tr.info > td {color: inherit; background-color: rgba(0, 172, 255, 0.12);} body.dark .torrent-list > tbody > tr.info:hover > td {background-color: rgba(0, 172, 255, 0.18);} body.dark div.panel-info, body.dark div.panel-info > .panel-heading {border-color: #2c414b;} body.dark div.panel-info > .panel-heading {background-color: #2a3f4a;}</style>');

// yes its jank
// i blame greasemonkey
check_cache()


==/UserStyle== */
@-moz-document domain("nyaa.si") {

    /*GNU General Public License v3.0*/
    /*Main color variables*/
    :root {
        if stylus-deepdark-style=="Deep-Dark" {
            --main-color: #00adee;
            --main-background: #111;
            --second-background: #181818;
            --hover-background: #232323;
            --main-text: #eff0f1;
            --dimmer-text: #ccc;
            --editor-background: #181818;
            --select-background: #232323;
            --shadow: 0 1px 0.5px rgba(0, 0, 0, .3);
            --even-entry-background: rgba(0, 0, 0, .6);
        }
        else if stylus-deepdark-style=="Inspired-Dark" {
            --main-color: #5e8acc;
            --main-background: #232629;
            --second-background: #181818;
            --hover-background: #515254;
            --main-text: #eee;
            --dimmer-text: #ccc;
            --editor-background: #181818;
            --select-background: #232323;
            --shadow: 0 1px 0.5px rgba(0, 0, 0, .13);
            --even-entry-background: rgba(0, 0, 0, .16);
        }
        else if stylus-deepdark-style=="Breeze-Dark" {
            --main-color: #3daee9;
            --main-background: #232629;
            --second-background: #2a2e32;
            --hover-background: #31363b;
            --main-text: #eff0f1;
            --dimmer-text: #bdc3c7;
            --editor-background: #2a2e32;
            --select-background: #31363b;
            --shadow: 0 1px 0.5px rgba(0, 0, 0, .13);
            --even-entry-background: rgba(0, 0, 0, .16);
        }
        else if stylus-deepdark-style=="Breeze-Light" {
            --main-color: #3daee9;
            --main-background: #eff0f1;
            --second-background: #fcfcfc;
            --hover-background: #dcdee0;
            --main-text: #2a2e32;
            --dimmer-text: #31363b;
            --editor-background: #fcfcfc;
            --select-background: #dcdee0;
            --shadow: 0 1px 0.5px rgba(0, 0, 0, .13);
            --even-entry-background: rgba(0, 0, 0, .16);
        }
        else if stylus-deepdark-style=="Vertex-Dark" {
            --main-color: #4080fb;
            --main-background: #2b2b2c;
            --second-background: #353638;
            --hover-background: #515254;
            --main-text: #f3f3f5;
            --dimmer-text: #aeafb0;
            --editor-background: #2b2b2c;
            --select-background: #515254;
            --shadow: 0 1px 0.5px rgba(0, 0, 0, .13);
            --even-entry-background: rgba(0, 0, 0, .2);
        }
        else if stylus-deepdark-style=="Arc-Dark" {
            --main-color: #5294e2;
            --main-background: #343944;
            --second-background: #383c4a;
            --hover-background: #414a59;
            --main-text: #c1c8d1;
            --dimmer-text: #b3bac5;
            --editor-background: #343944;
            --select-background: #414a59;
            --shadow: 0 1px 0.5px rgba(0, 0, 0, .13);
            --even-entry-background: rgba(0, 0, 0, .16);
        }
        else if stylus-deepdark-style=="Firefox-Dark" {
            --main-color: #5675b9;
            --main-background: #272b35;
            --second-background: #181d20;
            --hover-background: #353a44;
            --main-text: #e3eef9;
            --dimmer-text: #bec0cc;
            --editor-background: #181d20;
            --select-background: #353a44;
            --shadow: 0 1px 0.5px rgba(0, 0, 0, .13);
            --even-entry-background: rgba(0, 0, 0, .16);
        }
        else if stylus-deepdark-style=="Firefox-57" {
            --main-color: #4080fb;
            --main-background: #0c0c0d;
            --second-background: #252526;
            --hover-background: #323234;
            --main-text: #f9f9fa;
            --dimmer-text: #d0d0d0;
            --editor-background: #252526;
            --select-background: #323234;
            --shadow: 0 1px 0.5px rgba(54, 54, 54, .2);
            --even-entry-background: rgba(54, 54, 54, .4);
        }
        else if stylus-deepdark-style=="Discord" {
            --main-color: #7289da;
            --main-background: #1e2124;
            --second-background: #2f3136;
            --hover-background: #484b51;
            --main-text: #fff;
            --dimmer-text: #ada8aa;
            --editor-background: #2f3136;
            --select-background: #484b51;
            --shadow: 0 1px 0.5px rgba(47, 49, 54, .23);
            --even-entry-background: rgba(47, 49, 54, .49);
        }
        else if stylus-deepdark-style=="YouTube-Dark" {
            --main-color: #e52117;
            --main-background: #111;
            --second-background: #232323;
            --hover-background: #343434;
            --main-text: #e1e1e1;
            --dimmer-text: #7f7f7f;
            --editor-background: #111;
            --select-background: #343434;
            --shadow: 0 1px 0.5px rgba(54, 54, 54, .2);
            --even-entry-background: rgba(54, 54, 54, .4);
        }
        else if stylus-deepdark-style=="Mint-Y-Dark" {
            --main-color: #9ab87c;
            --main-background: #2f2f2f;
            --second-background: #383838;
            --hover-background: #404040;
            --main-text: #fff;
            --dimmer-text: #d5dada;
            --editor-background: #2f2f2f;
            --select-background: #404040;
            --shadow: 0 1px 0.5px rgba(0, 0, 0, .13);
            --even-entry-background: rgba(0, 0, 0, .23);
        }
        else if stylus-deepdark-style=="9anime" {
            --main-color: #723f8c;
            --main-background: #0b0a0d;
            --second-background: #17151c;
            --hover-background: #1E1c25;
            --main-text: #f9f6fb;
            --dimmer-text: #cac0cf;
            --editor-background: #17151c;
            --select-background: #160a1d;
            --shadow: 0 1px 0.5px rgba(54, 54, 54, .13);
            --even-entry-background: rgba(54, 54, 54, .36);
        }
        else if stylus-deepdark-style=="Black-and-White" {
            --main-color: #fff;
            --main-background: #000;
            --second-background: #1e1e1e;
            --hover-background: #3...

Reviews

No reviews yet.