EZ Navigation - always updating

Replace old links & add new links for easier navigation.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         EZ Navigation - always updating
// @version      1.2
// @description  Replace old links & add new links for easier navigation.
// @author       Misery / bukubanz#9152
// @include      https://fairview.deadfrontier.com/*
// @grant        none
// @namespace
// @license MIT
// @namespace https://greasyfork.org/users/1264034
// ==/UserScript==

(function() {
    var navigationLinks = [
        { name: "Outpost", imgSrc: "https://i.imgur.com/O3oqMPN.png", link: "https://fairview.deadfrontier.com/onlinezombiemmo/index.php" },
        { name: "Credit Shop", imgSrc: "https://i.imgur.com/OI9zSwX.png", link: "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=28" },
        { name: "Forum", imgSrc: "https://i.imgur.com/vWR4foN.png", link: "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?action=forum" },
        { name: "Market", imgSrc: "https://i.imgur.com/GxniNWY.png", link: "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=35" },
        { name: "Bank", imgSrc: "https://i.imgur.com/ZfFSTkE.png", link: "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=15" },
        { name: "Storage", imgSrc: "https://i.imgur.com/4Y5Zsiz.png", link: "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=50" },
        { name: "Logout", imgSrc: "https://i.imgur.com/hRgTcyV.png", link: getLogoutLink() },
        { name: "Profile", imgSrc: "https://i.imgur.com/cTQxxz4.png", link: "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?action=profile" },
        { name: "The Yard", imgSrc: "https://i.imgur.com/ynkDl0H.png", link: "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=24" }
    ];

    function createLinkElement(linkInfo) {
        var img = document.createElement("img");
        img.src = linkInfo.imgSrc;
        img.height = "60";

        var link = document.createElement("a");
        link.href = linkInfo.link;
        link.appendChild(img);

        return link;
    }

    function getLogoutLink() {
        return $("img[name=logout]").parent()[0].href;
    }

    var navigationContainer = document.createElement("div");
    navigationContainer.id = "navigation_holder";
    navigationContainer.style.overflow = "hidden";

    navigationLinks.forEach(function(linkInfo) {
        var linkElement = createLinkElement(linkInfo);
        linkElement.style.float = linkInfo.name === "Logout" ? "right" : "left";
        linkElement.style.textAlign = "center";
        linkElement.style.marginLeft = linkInfo.name === "Logout" ? "-6px" : "-13px";

        navigationContainer.appendChild(linkElement);
    });

    var table = document.getElementsByTagName("table")[6];
    table.innerHTML = ""; // Clear the table contents
    table.appendChild(navigationContainer);
    table.style.backgroundImage = "url()";
    table.style.transform = "scaleY(1.2)";
    table.style.position = "relative";
    table.style.top = "0px";

    var cookieCrumbleRow = document.getElementsByTagName("tr")[1];
    cookieCrumbleRow.style.height = "220px";
})();