HNS Addon

Zatím jenom random anime v záložce titulky

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         HNS Addon
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Zatím jenom random anime v záložce titulky
// @author       Airsane
// @match        http://hns.sk/animelist
// @grant        none
// ==/UserScript==

let navul = document.querySelector('ul.nav');
let list = document.createElement("li");
let link = document.createElement('a');
link.href = "javascript:void(0);";
link.innerText = "Random Anime";
list.appendChild(link);
navul.appendChild(list);
link.addEventListener("click", getRandomAnime);
let anime = document.querySelectorAll("td > a");

function getRandomAnime() {

    let r = Math.floor(Math.random() * anime.length);
    window.location.href = anime[r].href;
}