nyaa show

自动加载nyaa图片并显示!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         nyaa show
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  自动加载nyaa图片并显示!
// @author       You
// @grant        GM_xmlhttpRequest
// @include      https://sukebei.nyaa.si/*
// @require https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js
// ==/UserScript==
(function () {
    var a = document.getElementById("torrent-description");
    var patt1 = new RegExp("https://hentai-covers.site/image/[0-9a-zA-Z]*");
    if (patt1.test(a.innerHTML)) {
        var im = patt1.exec(a.innerHTML);
        GM_xmlhttpRequest({
            method: "GET",
            url: im[0],
            Referer: im[0],
            headers: {
                'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36',
                'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
            },
            onload: function (response) {
                var regex1 = new RegExp("https\:\/\/hentai\-covers\.site\/images\/[0-9]+\/[0-9]+\/[0-9]+\/[a-zA-Z0-9-_.]*.(jpg|webp)");
                var temp = regex1.exec(response.responseText);
                var board = document.getElementById("torrent-description");
                var img = document.createElement("img");
                GM_xmlhttpRequest({
                    method: "GET",
                    url: temp[0],
                    Referer:im[0],
                    responseType :'blob',
                    headers: {
                        'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36',
                        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
                        'Referer':im[0],
                    },
                    onload: function (response) {
                        if (this.status == 200) {
                            var blob = this.response
                            var link = window.URL.createObjectURL(blob)
                            img.src = link
                            img.onload = function() {
                                window.URL.revokeObjectURL(this.src);
                            }
                            board.appendChild(img)
                        }
                    }
                })


            }
        });
    }

})();