Zaikantos / MT - ServerLinks rightside loginbar

// ==UserScript==
// @name         MT - ServerLinks rightside loginbar
// @version      1.2
// @description  Add links to all servers on the right side of the loginbar
// @author       Zaikantos
// @match        *://*.minethings.com/*
// @exclude      *://*.minethings.com/app/webroot/forums/*
// @exclude      *://*.wiki.minethings.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var navBar = document.getElementById("login");
    navBar.children[1].style.float = "left";
    navBar.children[1].style.position = "relative";

    //get url without the servername
    var currentUrl = window.location.href;
    var strippedUrl = currentUrl.substring(currentUrl.indexOf('.'), currentUrl.length);
    
    var ul = document.createElement("ul");
    ul.style.height="40px";
    ul.style.width="150px";
    ul.style.position="absolute";
    ul.style.top = "8px";
    ul.style.left = "65px";
    ul.style.listStyleType = "none";

    navBar.lastElementChild.appendChild(ul);

    var servers = ["Aso", "Bromo", "Calbuco", "Dempo", "Ebeko", "Fogo", "Gallego"];
    servers.forEach(createElement);
    
    //For input String serverName, add an element to the left side of the navBar that links to that server
    function createElement(serverName) {
        var element = document.createElement("li");
        element.style.float = "left";
        element.style.borderStyle = "solid";
        element.style.borderWidth = "1px";
        element.style.borderColor = "brown";
        
        //size of each server link box
        element.style.width="10%";
        element.style.height="100%";
        
        var a = document.createElement("a");
        
        //make a's contents the first letter of the server
        var letter = serverName.substring(0,1);
        a.textContent = letter;
        
        //make a link to the server, unless we are on that server
        if(currentUrl.substring(7, 8) == letter.toLowerCase()) {
            //same server, do nothing
        } else {
            a.setAttribute('href', "http://" + serverName + strippedUrl);
        }

        //make link be the entire element
        a.style.display = "block";
        a.style.width = "100%";
        a.style.height = "100%";
        a.style.color = "white";

        //styling
        a.style.textDecoration = "none";
        a.style.textAlign = "center";

        element.appendChild(a);
        ul.appendChild(element);
    }
})();