Dead Frontier at work

This script will show your token to authenticate into Inner City. This script was made to make it easier for people who want to play Dead Frontier 3D on computers they don't have Administrator privileges to install programs.

// ==UserScript==
// @name         Dead Frontier at work
// @namespace    df3datwork
// @version      1.2.1
// @description  This script will show your token to authenticate into Inner City. This script was made to make it easier for people who want to play Dead Frontier 3D on computers they don't have Administrator privileges to install programs.
// @author       ils94
// @match        https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=21
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Create a custom dialog box
    const dialog = document.createElement('div');
    dialog.style.position = 'fixed';
    dialog.style.top = '50%';
    dialog.style.left = '50%';
    dialog.style.transform = 'translate(-50%, -50%)';
    dialog.style.padding = '20px';
    dialog.style.width = '500px';
    dialog.style.background = 'grey';
    dialog.style.color = 'white'; // Set text color to white
    dialog.style.border = '1px solid white';
    dialog.style.zIndex = '9999';
    dialog.style.textAlign = 'center';
    dialog.style.fontSize = '16px';

    // Create a textarea element to display the text
    const textArea = document.createElement('textarea');
    textArea.style.width = '100%';
    textArea.style.height = '150px';
    textArea.style.marginBottom = '10px';
    textArea.style.resize = 'none';
    textArea.style.background = 'white'; // Set background color to white
    textArea.style.color = 'black'; // Set text color to black
    textArea.readOnly = true;

    // Create a button to close the dialog
    const closeButton = document.createElement('button');
    closeButton.textContent = 'Close';
    closeButton.style.cursor = 'pointer';

    // Append elements to the dialog
    dialog.appendChild(textArea);
    dialog.appendChild(closeButton);

    // Get the button element
    const button = document.querySelector('button[onclick^="window.location.href = \\"deadfrontier:"]');

    // Add click event listener to the button
    button.addEventListener('click', function() {
        // Extract the desired part of the button text
        const buttonText = button.getAttribute('onclick').match(/deadfrontier:([^"]+)/)[1];

        // Add quotes to the extracted text
        const textWithQuotes = `"${buttonText}"`;

        // Construct the dialog message with additional instructions
        const dialogMessage = `Copy your token below including the quotes (" "), open Window's CMD and type:

"path/to/your/deadfrontier/folder/deadfrontier.exe" "your token here"

Your token:

${textWithQuotes}

Press Enter, wait for the Standalone Client to open, press the "Play!" button in the client, and wait for the server to authenticate you.`;

        // Set the dialog message as the text content of the textarea
        textArea.value = dialogMessage;

        // Append the dialog to the document body
        document.body.appendChild(dialog);

        // Close the dialog when the close button is clicked
        closeButton.addEventListener('click', function() {
            document.body.removeChild(dialog);
        });
    });
})();