Kiranico Armor Linker

Extracts kiranico armor links

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        Kiranico Armor Linker
// @namespace   krunkster
// @description Extracts kiranico armor links
// @include     http://kiranico.com/en/mh4u/armor*
// @version     1
// @grant       GM_registerMenuCommand
// ==/UserScript==

function getLink() {
    var armorScope = document.getElementsByClassName("ng-scope")[1];
    var scope = unsafeWindow.angular.element(armorScope).scope();
    var link = "http://kiranico.com/en/mh4u/armor/?a=" + scope.armorset[0].id + "," + scope.armorset[1].id + ","+ scope.armorset[2].id + ","+ scope.armorset[3].id + ","+ scope.armorset[4].id;
    console.log("Armor Link: " + link);
    return link;
}

function alertLink() {
    alert(getLink());
}

function updateLink() {
    document.location = getLink();
}

GM_registerMenuCommand("Get the current armor link", alertLink);

(function() {   
    var Elements = document.getElementsByTagName('th');
    for (var i = 0; i < Elements.length; i++) {
        var elmInput = Elements[i];
        data = elmInput.textContent;
        console.log(data);
        if (data.indexOf("Armors") > -1)
        {
          elmInput.addEventListener('click', updateLink, false);
        }
    }
})();