BlurrpyScript

Quickly navigate without needing to go back to outpost!

Versione datata 03/04/2024. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         BlurrpyScript
// @namespace    http://tampermonkey.net/
// @version      7.6.6
// @description  Quickly navigate without needing to go back to outpost!
// @author       Blurrpy
// @match        *fairview.deadfrontier.com/onlinezombiemmo/index.php*
// @match        *fairview.deadfrontier.com/onlinezombiemmo/DF3D/DF3D_InventoryPage.php?page=31*
// @match        *fairview.deadfrontier.com/onlinezombiemmo/*
// @grant        GM.getValue
// @grant        GM.setValue
// @grant        GM_xmlhttpRequest
// @grant        GM.xmlHttpRequest
// @grant        GM_openInTab
// @grant        GM.openInTab
// @require      https://greasyfork.org/scripts/445697/code/index.js?version=1055427
// @license      GPL-3.0-or-later
// @downloadURL
// @updateURL
// ==/UserScript==

(function() {
    'use strict';

    var navButtonData = {
        arcade      : { title: "Arcade", page: 0 },
        arena       : { title: "Arena", page: 21 },
        bank        : { title: "Bank", page: 15 },
        clanhq      : { title: "Clan HQ", page: 56 },
        crafting    : { title: "Crafting", page: 59 },
        fasttravel  : { title: "Fast Travel", page: 61 },
        gamblingden : { title: "Gambling Den", page: 49 },
        innercity   : { title: "Inner City", page: 21 },
        marketplace : { title: "Marketplace", page: 35 },
        meetinghall : { title: "Meeting Hall", page: 0 },
        records     : { title: "Records", page: 22 },
        storage     : { title: "Storage", page: 50 },
        vendor      : { title: "Vendor", page: 84 },
        yard        : { title: "The Yard", page: 24 },
    };

    function createQuickNavigationButton(container, buttonTitle, url) {
        let button = document.createElement("button");
        button.textContent = buttonTitle;
        button.id = buttonTitle;
        button.style.height = "max-content";
        button.addEventListener("click", function() {
            window.location.href = "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=" + url;
        });

        container.appendChild(button);
    }

    function addQuickNavigation() {
        let menu = document.body;
        let cluster = document.createElement("div");
        cluster.id = "blurrpyQuickNavigation";
        cluster.style.display = "grid";
        cluster.style.rowGap = "5px";
        cluster.style.position = "fixed";
        cluster.style.top = "18px";
        cluster.style.left = "2px";
        cluster.style.zIndex = "20";

        for (const [key, value] of Object.entries(navButtonData)) {
           let container = document.createElement("div");
           container.style.height = "max-content";
           container.style.width = "max-content";
           container.style.minWidth = "41px";
           //container.style.justifySelf = "end";
           container.style.padding = "5px";
           container.style.border = "2px solid rgb(100, 0, 0";
           container.style.backgroundColor = "rgba(0, 0, 0, 0.5)";
           container.style.backdropFilter = "blur(5px)";

           let button = document.createElement("button");
           button.textContent = value.title;
           button.id = value.title;
           button.style.height = "max-content";
           button.addEventListener("click", function() {
              window.location.href = "https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=" + value.page;
           });

           container.appendChild(button);
           cluster.appendChild(container);
        }

        menu.appendChild(cluster);
    }

     async function startScript(){
        addQuickNavigation();
    }

    // Give enough time to the vanilla js to complete initialisation.
    setTimeout(async function(){ await startScript(); }, 500);
})();