您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds buttons to extract the private key and launch Dead Frontier from a .bat - for windows or .sh file - for linux os
当前为
// ==UserScript== // @name Dead Frontier Alternative Launcher // @namespace http://tampermonkey.net/ // @version 1.2 // @description Adds buttons to extract the private key and launch Dead Frontier from a .bat - for windows or .sh file - for linux os // @author Lucky11 // @match https://fairview.deadfrontier.com/onlinezombiemmo/index.php?page=21 // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Variable to store the private key let privateKey = ''; // Define a variable to control the default state of the "Erase launch file after running" checkbox const isCheckboxChecked = true; // Set to true for checked, false for unchecked /****************************************************** * WINDOWS SETTINGS * ******************************************************/ // Editable application path WINDOWS const applicationPathWindows = "C:\\Program Files (x86)\\Dead Frontier\\DeadFrontier.exe"; // Change this path as needed WINDOWS OS //command for .bat file to delete itself https://stackoverflow.com/questions/20329355/how-to-make-a-batch-file-delete-itself#20333575 //if "Erase launch file after running" selected: const Bat_del_itself = `(goto) 2>nul & del "%~f0" & cmd /c exit /b 10\n`; /****************************************************** ******************************************************/ /****************************************************** * LINUX SETTINGS * ******************************************************/ const applicationPathLinux = "/home/xxxx/.wine/drive_c/Program Files (x86)/Dead Frontier/DeadFrontier.exe"; // Change this path as needed LINUX OS const Sh_del_itself = `rm -- "$0"\n`;//add command to .sh file delete itself https://stackoverflow.com/questions/8981164/self-deleting-shell-script /****************************************************** * END OF SETTINGS* ******************************************************/ // Create the button to show the private key const showKeyButton = document.createElement('button'); showKeyButton.textContent = 'Show Authentication Token'; showKeyButton.style = ` display: block; margin: 20px auto; padding: 10px 20px; font-size: 16px; background-color: #007BFF; color: white; border: none; border-radius: 5px; cursor: pointer; `; // Create the button to launch Dead Frontier const launchButton = document.createElement('button'); launchButton.textContent = 'Launch Dead Frontier'; launchButton.style = ` display: block; margin: 20px; padding: 10px 20px; font-size: 16px; background-color: #28A745; color: white; border: none; border-radius: 5px; cursor: pointer; `; // Create a wrapper for the launch button and checkbox const launchWrapper = document.createElement('div'); launchWrapper.style = ` display: flex; align-items: center; /* Center vertically */ justify-content: center; /* Center horizontally */ `; // Create a checkbox for automatic deletion const deleteCheckbox = document.createElement('input'); deleteCheckbox.type = 'checkbox'; deleteCheckbox.id = 'deleteCheckbox'; deleteCheckbox.style = ` width: 20px; /* Increase width for visibility */ height: 20px; /* Increase height for visibility */ margin-left: 10px; /* Space between checkbox and label */ margin-right: 5px; /* Space between checkbox and button */ `; // Create a label for the checkbox const deleteLabel = document.createElement('label'); deleteLabel.textContent = 'Erase launch file after running'; deleteLabel.setAttribute('for', 'deleteCheckbox'); deleteLabel.style = ` font-size: 16px; color: white; margin-left: 5px; /* Space between checkbox and label */ `; // Create a textbox to display the extracted text const textBox = document.createElement('textarea'); textBox.style = ` display: block; margin: 10px auto; width: 50%; height: 30px; /* Adjusted height for better aesthetics */ font-size: 16px; border: 1px solid #ccc; border-radius: 5px; text-align: center; /* Center the text */ resize: none; /* Disable resizing */ `; textBox.readOnly = true; deleteCheckbox.checked = isCheckboxChecked; // This line sets the checkbox to be checked // Create a disclaimer element const disclaimer = document.createElement('div'); disclaimer.textContent = "Disclaimer: The Authentication Token should not be shared with anyone!"; disclaimer.style = ` text-align: center; color: #FF0000; /* Red color for emphasis */ margin-top: -66px; font-size: 14px; `; // Append the checkbox and label to the wrapper // Append the launch button to the wrapper launchWrapper.appendChild(launchButton); // Append the checkbox and label to the wrapper launchWrapper.appendChild(deleteCheckbox); launchWrapper.appendChild(deleteLabel); // Append elements to the body document.body.appendChild(launchWrapper); // Append the wrapper instead of individual elements document.body.appendChild(showKeyButton); document.body.appendChild(textBox); document.body.appendChild(disclaimer); // Event listener for showing the private key showKeyButton.addEventListener('click', function() { const buttons = document.querySelectorAll('button[onclick]'); let found = false; // Flag to check if a URL was found for (const button of buttons) { const onclickContent = button.getAttribute('onclick'); const match = onclickContent.match(/window\.location\.href\s*=\s*['"]([^'"]+)['"]/); if (match) { privateKey = match[1]; // Store the private key in the variable textBox.value = "\"" + privateKey + "\""; // Optionally display the private key found = true; // Set flag to true break; // No need to continue searching } } if (!found) { textBox.value = "No Authentication Token found."; // Display message if not found } }); // Event listener for launching Dead Frontier launchButton.addEventListener('click', function() { const buttons = document.querySelectorAll('button[onclick]'); let found = false; // Flag to check if a URL was found for (const button of buttons) { const onclickContent = button.getAttribute('onclick'); const match = onclickContent.match(/window\.location\.href\s*=\s*['"]([^'"]+)['"]/); if (match) { privateKey = match[1]; // Store the private key in the variable found = true; // Set flag to true break; // No need to continue searching } } if (found) { // Determine the operating system and create the appropriate file let fileContent; let fileName; if (navigator.userAgent.indexOf("Win") !== -1) { // Windows: Create a .bat file fileName = 'launch_dead_frontier.bat'; //contents of the batch the script creates: const windowsBat = `@echo off start "" "${applicationPathWindows}" "${privateKey}" `; fileContent = windowsBat if (deleteCheckbox.checked) { fileContent += Bat_del_itself } } else { // Assume Linux: Create a .sh file fileName = 'launch_dead_frontier.sh'; //contents of the sh the script creates: const linuxSh = `#!/bin/bash # Launch Dead Frontier using Wine WINE_PATH="${applicationPathLinux}" KEY="${privateKey}" # Launch the game wine "$WINE_PATH" "$KEY" `; fileContent = linuxSh if (deleteCheckbox.checked) { fileContent += Sh_del_itself } } const blob = new Blob([fileContent], { type: 'application/octet-stream' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } else { alert("No Authentication Token found. Please ensure you are on the correct page."); // Alert if no key is found } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址