JAV Library Search

Add buttons to search on sukebei.nyaa.se.

Stan na 29-12-2016. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        JAV Library Search
// @description Add buttons to search on sukebei.nyaa.se.
// @namespace   rix.li
// @match       *://www.javlibrary.com/*
// @version     2
// @grant       GM_addStyle
// ==/UserScript==

GM_addStyle('.icn_search{display: inline-block;width: 24px;height: 24px;background-repeat: no-repeat;margin: 0px 0px;background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAFzUkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABqUlEQVRIS7WWMY8BQRTHnz0SiWSFjkSz8ZV8AkKNXi7R6qlX4TOIUkEUdKIQhc0mKiWCmJv3zOYcb+bcWb/kn/fGy/xn3uwsQEiq1aqIRqMCAEIRetVqNbQWH4fD4bPVasHlcpG1cECv0WgEx+MRIJ1Os7sIQ+htnU4nmb+H8/kMViQSUcPwQW9L5VpKpRJMJhPYbrcwn8+h0WioypPYts2eH2q/39NN4Mhms+ycWyWTSaHtYLfbQTweh+FwCKlUitpFtdttqvu+T/FXuA6KxSLtUpo/1FDNZpPqruuy9UDYAbvAeDwmA9MVDuBqgbRHlM/nKeKD1eF5nsrMsAtsNhuKpiucy+VUZoZdoNfrUex0OhTvKRQKFAeDAUUjumsagA/09nNpripCJBKJH7V7aR8yKpPJKJsr6/VaZd8sFgt2biDjAoG63a6yu9Lv92nnaI4sl0t2HuqpBUxCc2S1WrH1lxdAoTkynU4fatr34C84jgOz2Yy+EFle7cAk6kB2J/P3gN5WLBZTw/CRP/5glctlNQyfSqVCbdBfDNnJwxn+V+hVr9elsxBfG9P38mJXH78AAAAASUVORK5CYII=);}');

var videoIdList = [];

function getSearchUrl(videoId) {
    return 'https://sukebei.nyaa.se/?page=search&cats=8_30&sort=5&term=' + encodeURIComponent(videoId);
}

document.querySelectorAll('.video').forEach(function(video) {
    var videoId = video.querySelector('.id').innerText;
    videoIdList.push(videoId);
    var toolbar = video.querySelector('.toolbar');
    var a = document.createElement('a');
    a.classList.add('icn_search');
    a.title = 'Search it!';
    a.target = '_blank';
    a.href = getSearchUrl(videoId);
    toolbar.appendChild(a);
});

document.querySelectorAll('#video_favorite_edit').forEach(function(toolbar) {
    var videoId = document.querySelector('#video_id .text').innerText;
    videoIdList.push(videoId);
    var a = document.createElement('a');
    a.classList.add('smalldarkbutton');
    a.innerText = 'Search it!';
    a.target = '_blank';
    a.href = getSearchUrl(videoId);
    var span = document.createElement('span');
    span.classList.add('favoritetype');
    span.appendChild(a);
    toolbar.appendChild(span);
});

document.querySelectorAll(".displaymode .left").forEach(function(displayMode) {
    var a = document.createElement('a');
    a.classList.add('smalldarkbutton');
    a.innerText = 'Search all!';
    a.href = 'javascript:void(0);';
    a.addEventListener('click', function(e) {
        e.preventDefault();
        videoIdList.forEach(function(videoId) {
            window.open(getSearchUrl(videoId));
        });
    });
    var span = document.createElement('span');
    span.classList.add('favoritetype');
    span.appendChild(a);
    displayMode.appendChild(span);
});