RS: Wikia to Wiki

Redirects from RS Fandom to RS Wiki

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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;
    });
}