RS: Wikia to Wiki

Redirects from RS Fandom to RS Wiki

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         RS: Wikia to Wiki
// @version      1.0.0
// @description  Redirects from RS Fandom to RS Wiki
// @author       nysos3
// @match        *://runescape.fandom.com/wiki/*
// @match        *://www.google.com/search*
// @namespace https://greasyfork.org/users/316895
// ==/UserScript==
var url = window.location.href;
if (url.indexOf('://runescape.fandom.com/wiki/') > 0) {
    var article = url.substr(url.indexOf('/wiki/') + 6);
    window.location.href = 'https://runescape.wiki/w/' + article;
} else if (url.indexOf('://www.google.com/search') > 0) {
    var anhorTags = document.getElementsByTagName('a');
    Array.prototype.forEach.call(anhorTags, function (el) {
        var href = el.href;
        if (href.indexOf('://runescape.fandom.com/wiki') < 0) {
            return
        }
        if (href.indexOf('webcache.google') >= 0) {
            return
        }
        var article = href.substr(href.indexOf('/wiki/') + 6);
        el.href = 'https://runescape.wiki/w/' + article;
    });
}