增加“多标签搜索按钮”

增加“多标签搜索按钮”,原帖 http://bangumi.tv/group/topic/344240 , 作者 windrises(http://bangumi.tv/user/windrises)

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         增加“多标签搜索按钮”
// @namespace    http://tampermonkey.net/
// @version      1.11
// @description  增加“多标签搜索按钮”,原帖 http://bangumi.tv/group/topic/344240 , 作者 windrises(http://bangumi.tv/user/windrises)
// @author       鈴宮華緋
// @include      /https?:\/\/(bgm\.tv|bangumi\.tv|chii\.in).*/
// @require      http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    let api_prefix = 'https://windrises.net/bgmtools/multitag/';
    let nav_a = $("div.headerNeueInner").find("a.nav");
    for(let i = 0;i < nav_a.length;i++) {
        let matcher = nav_a.eq(i).attr("href").match(/\/(.*)?\/tag/);
        matcher ? nav_a.eq(i).parent().after('<li><a target="_blank" href="' + api_prefix + matcher[1] + '" ckass="nav" style="display:block;">多标签搜索</a></li>') : null;
    }
})();