Rickblock (WORKING VERSION)

The (WORKING) Rickroll blocker Shout out to whatismyname for the code I just edited it so that it blocks the rickroll'd link instead

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 Rickblock (WORKING VERSION)
// @include *
// @description The (WORKING) Rickroll blocker Shout out to whatismyname for the code I just edited it so that it blocks the rickroll'd link instead
// @run-at document-end
// @version 1.1
// @namespace 
// @grant none
// ==/UserScript==
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
    var linkto = links[i].getAttribute("href");
    var isrickroll = false;
    if (linkto)
       var isrickroll = (linkto.indexOf("oHg5SJYRHA0") !== -1);
    if (isrickroll) {
        links[i].innerHTML = "(They tried to rickroll you)";
        links[i].setAttribute("href", "#");
    }
}