NanoPi / fandom - Hydra skin

// ==UserScript==
// @name         fandom - Hydra skin
// @namespace    https://openuserjs.org/users/NanoPi
// @version      0.1
// @description  Bring back the old layout.
// @author       NanoPi
// @match        https://minecraft.fandom.com/*
// @match        http://minecraft.fandom.com/*
// @match        https://terraria.fandom.com/*
// @match        http://terraria.fandom.com/*
// @grant        none
// @run-at       document-body
// @updateURL    https://openuserjs.org/meta/NanoPi/fandom_-_Hydra_skin.meta.js
// @license MIT
// ==/UserScript==
/* jshint -W097 */
'use strict';

var skins = {
    "minecraft.fandom.com":"hydra",
    "terraria.fandom.com":"hydra"
};

var linkflt = function(e) {
    var a = e.target;
    while (a != window) {
        if (a.nodeName == 'A') break;
        a = a.parentElement;
    }
    var r;
    console.log(a);
    if (a.nodeName == 'A') {
        if (skins[a.host] && a.search == '') {
            a.search = '?useskin='+skins[a.host];
        }
    }
};

document.body.addEventListener('mouseover', linkflt);
document.body.addEventListener('focus', linkflt);

if (skins[document.location.host] && document.location.search == '') {
    document.location.search = '?useskin='+skins[document.location.host];
}