JAVLibrary link for OneJav

Adds a link to each OneJav post that goes to the respective jav page on JAVLibrary.

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

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

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         JAVLibrary link for OneJav
// @version      0.1
// @description  Adds a link to each OneJav post that goes to the respective jav page on JAVLibrary.
// @author       Walpac
// @match        https://onejav.com/*
// @grant        none
// @namespace https://greasyfork.org/users/285116
// ==/UserScript==

(function() {
    'use strict';
    var posts = document.getElementsByClassName('card mb-3');
    var id;
    if (posts) {
        var post;
        for (var i = 0; i < posts.length; i++) {
            post = posts[i].getElementsByClassName('title is-4 is-spaced');
            id = post[0].getElementsByTagName("a").item(0).innerHTML;
            id = id.replace(/\s+/g,'');
            console.log(i + "= " + id + " size:" + id.length);

            var javLibLink = document.createElement('a');
            javLibLink.setAttribute('href', 'http://www.javlibrary.com/en/vl_searchbyid.php?keyword=' + id);
            javLibLink.setAttribute('target', '_blank');
            javLibLink.setAttribute('class', 'is-size-6');
            javLibLink.innerHTML = 'JAVLibrary';
            post[0].appendChild(javLibLink);
        }
    }
})();