为JAVLibrary添加跳转到ThisAV、ThisJAV、JavBus的搜索结果链接

为Javlibrary添加跳转到thisav,thisjav,javbus的搜索结果链接

As of 2019-02-17. See the latest version.

// ==UserScript==
// @name         为JAVLibrary添加跳转到ThisAV、ThisJAV、JavBus的搜索结果链接
// @namespace    video_search_through_javlibrary
// @version      0.2
// @description  为Javlibrary添加跳转到thisav,thisjav,javbus的搜索结果链接
// @author       SUZEMEF
// @match        *://www.javlibrary.com/*/?v=*
// @include      /^http:\/\/www.\w\d{2}\w.com\/\w{2}/\?v=\w{2,}/
// @grant        none
// ==/UserScript==

var sites = [
    {name: "thisav",
     url: "https://www.thisav.com/channel/"
    },
    {name: "thisjav",
     url: "http://www.thisjav.com/zh-hant/results/?q="
    },
    {name: "javbus",
     url: "https://www.javbus.com/"
    }
    ];
var javNo;
function getID(){
    let meta = document.getElementsByTagName('meta').keywords.content;
    let arr = meta.split(",");
    javNo = arr[0];
    }
function addBtn(webSite, javNo) {
    const btn = document.createElement('a');
    let text = webSite.name;
    let space = document.createElement("a");
    let href = webSite.url + javNo;
    btn.href = href;
    btn.appendChild(document.createTextNode(text));
    btn.style.cssText ='background-color: #f9f9f9;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;border: 1px solid #dcdcdc;display: inline-block;color: #666666;font-family: arial;font-size: 12px;font-weight: bold;padding: 2px 11px;text-decoration: none;margin: 1px;';
    document.getElementById("video_favorite_edit").appendChild(space).appendChild(btn);
    }
(function(){
    getID();
    let i = 0;
    while (i <= sites.length){
        addBtn(sites[i], javNo);
        i++;
    }
})();