您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
从封面/截图链接加载图片并显示。
当前为
// ==UserScript== // @name Nyaa.si - Load More Thumbnail // @name:zh-CN Nyaa.si - 自动加载更多预览图 // @namespace none // @description Load image from cover/screenshot links. // @description:zh-CN 从封面/截图链接加载图片并显示。 // @version 0.1 // @license MIT // @author York Wang // @include https://sukebei.nyaa.si/* // @include https://imgrock.pw/* // @include https://picrok.com/* // @include https://picbaron.com/* // @include https://imgbaron.com/* // @include https://kvador.com/* // @include https://kropic.com/* // @include https://imgsto.com/* // @include https://imgsen.com/* // @include https://imgstar.eu/* // @include https://picdollar.com/* // @include https://pics4you.net/* // @include https://silverpic.com/* // @include http://imglord.com/* // @include https://imgtaxi.com/* // @include https://imgadult.com/* // @include https://imgdrive.net/* // @include https://uvonahaze.xyz/* // @include https://trans.firm.in/* // @include https://imagetwist.com/* // @include http://imgair.net/* // @include https://hentai4free.net/* // @run-at document-end // @grant unsafeWindow // ==/UserScript== (function() { 'use strict'; function Handler(pattern, process) { this.pattern = pattern this.process = process } Handler.prototype.canHandle = function(url) { return this.pattern.test(url) } Handler.prototype.handle = function() { this.process(url => { document.location.href = url unsafeWindow.top.postMessage({"LMT": url}, '*') }) } const handlers = [] const addHandler = (pattern, process) => handlers.push(new Handler(pattern, process)) addHandler(/^https?:\/\/(imgrock\.pw)(\/[\w\-]+)+(\.[\w\-]+)+/, callback => { // pause on CAPTCHA const iframe = document.querySelector('iframe') if(iframe && iframe.src.indexOf('captcha') > -1) return const img = document.querySelector('.picview') if(img) { callback(img.src) } else { const btns = document.querySelectorAll('input[name=fnext]') for(let i=0;i<btns.length;i++) {if(!btns[i].style.display) btns[i].click()} const forms = document.querySelectorAll('form') for(let i=0;i<forms.length;i++) {if(forms[i].hito) {forms[i].submit()}} } }) addHandler(/^https?:\/\/(picrok\.com)(\/[\w\-]+)+\.php/, callback => { // pause on CAPTCHA const iframe = document.querySelector('iframe') if(iframe && iframe.src.indexOf('captcha') > -1) return const img = document.querySelector('.picview') if(img) { callback(img.src) } else { unsafeWindow.setTimeout(() => { const forms = document.querySelectorAll('form') const btns = document.querySelectorAll('form>button') // for(let i=0;i<btns.length;i++) {if(btns[i].style.display) forms[i-1].submit()} }, 5000) } }) addHandler(/^https?:\/\/(picbaron\.com|imgbaron\.com|kvador\.com|kropic\.com|imgsto\.com|imgsen\.com|imgstar\.eu|picdollar\.com|pics4you\.net|silverpic\.com|imglord\.com)(\/.+)+(\.[\w\-]+)+/, callback => { const img = document.querySelector('.pic') if(img) { callback(img.src) } else { const form = document.querySelector('form') form && form.submit() } }) addHandler(/^https?:\/\/(imgtaxi\.com|imgadult\.com|imgdrive\.net)(\/\w+)+/, callback => { unsafeWindow.ctipops = [] unsafeWindow.adbctipops = [] const img = document.querySelector('img.centred') || document.querySelector('img.centred_resized') if(img) { callback(img.src) } else { const btn = document.querySelector('.overlay_ad_link') unsafeWindow.setTimeout(() => { if(btn) { btn.focus() btn.click() } }, 1000) } }) addHandler(/^https?:\/\/uvonahaze\.xyz(\/\w+)+/, callback => { const img = document.querySelector('img.centred_resized') if(img) { callback(img.src) } else { const btn = document.querySelector('input[name=imgContinue]') btn && btn.click() } }) addHandler(/^https?:\/\/trans\.firm\.in(\/\w+)+/, callback => { const img = document.querySelector('img.centred_resized') if(img) { callback(img.src) } else { const btn = document.querySelector('input[name=imgContinue]') btn && btn.click() } }) addHandler(/^https?:\/\/imagetwist\.com(\/\w+)+/, callback => { const img = document.querySelector('.img-responsive') if(img) { callback(img.src) } }) addHandler(/^https?:\/\/imgair\.net(\/\w+)+/, callback => { unsafeWindow.wuLu && unsafeWindow.wuLu() const img = document.querySelector('#newImgE') if(img) { callback(img.src) } }) addHandler(/^https?:\/\/hentai4free\.net(\/\w+)+/, callback => { unsafeWindow.wuLu && unsafeWindow.wuLu() const img = document.querySelector('#image-viewer-container>img') if(img) { callback(img.src) } }) const href = document.location.href if(/^https?:\/\/(sukebei\.nyaa\.si).+/g.test(href)) { if(document.title === '502 Bad Gateway') { document.location.href = document.location.href return } if(/^https?:\/\/(sukebei\.nyaa\.si\/view\/).+/g.test(href)) { const desc = document.querySelector('#torrent-description') const links = desc.querySelectorAll('a') if(!desc || !links) return const list = [] for(let i in links) { if(!links[i].href) continue for(let j in handlers) { if(handlers[j].canHandle(links[i].href)) { list.push(links[i].href) break } } } unsafeWindow.addEventListener("message", function (e) { if(e.data.LMT) { LMT_Frame.src = '' const img = document.createElement('img') img.src = e.data.LMT img.style['max-width'] = '100%' LMT_Wrap.appendChild(img) process() } }) let LMT_Wrap, LMT_Frame, LMT_Loading function createWrap() { desc.parentNode.insertAdjacentHTML('afterend', '<div class="panel panel-default"><div class="panel-body" id="LMT_Wrap"></div></div>') LMT_Wrap = document.querySelector('#LMT_Wrap') LMT_Loading = document.createElement('div') LMT_Loading.textContent = 'Loading Images...' LMT_Wrap.appendChild(LMT_Loading) LMT_Frame = document.createElement('iframe') LMT_Frame.id = 'LMT_Frame' LMT_Frame.sandbox = 'allow-forms allow-scripts allow-same-origin' LMT_Frame.style.display = 'none' LMT_Wrap.appendChild(LMT_Frame) } function process() { if(!LMT_Frame) createWrap() if(list.length) { const url = list.pop() LMT_Frame.src = url } else { if(LMT_Frame) { LMT_Wrap.removeChild(LMT_Frame) LMT_Wrap.removeChild(LMT_Loading) } } } process() } } else { for(let i in handlers) { if(handlers[i].canHandle(href)) handlers[i].handle() } } })();