您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Turns the torrent title into a search for the anime on AniDB.
// ==UserScript== // @name AniDB search for Nyaa // @namespace http://sushiyuki/ // @version 0.1 // @description Turns the torrent title into a search for the anime on AniDB. // @author Yuki // @match https://nyaa.si/view/* // @grant unsafeWindow // ==/UserScript== var $ = unsafeWindow.jQuery; (function() { 'use strict'; // from https://stackoverflow.com/a/9756789/8267008 function quoteattr(s) { return ('' + s) .replace(/&/g, '&') .replace(/'/g, ''') .replace(/"/g, '"') .replace(/</g, '<') .replace(/>/g, '>') .replace(/\r\n/g, ' ') .replace(/[\r\n]/g, ' '); } // the part about Japanese characters is adapted from http://www.localizingjapan.com/blog/2012/01/20/regular-expressions-for-japanese-text/ let h3 = $('div.container > div.panel > div.panel-heading > h3.panel-title').first(), text = h3.text(), title = text.replace('_',' ').replace(/^\s*\[[^\]]+\]\s*/,'').replace(/[[(].*/,'').replace(/ - [0-9]+.*/,'').replace(/\s+S(eason)?\s*[0-9]+\s+(E\s*[0-9]+\s+)?/ig,' ').replace(/[^a-zA-Zぁ-ゟ゠-ヿ㐀-䶵一-鿋豈-頻⺀-⿕ヲ-゚]+/g,' '), url = 'https://anidb.net/perl-bin/animedb.pl?adb.search=' + quoteattr(title) + '&show=animelist&do.search=search', h3_with_link = $('<h3 class="panel-title"><a href="'+url+'">'+text+'</a></h3>'); h3.replaceWith(h3_with_link); })();