Fortunate Maps StraTAGy

Redirects to StraTAGy and runs handleJPEGImage function

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Fortunate Maps StraTAGy
// @namespace    Bambi
// @version      1.0
// @description  Redirects to StraTAGy and runs handleJPEGImage function
// @license      MIT
// @match        https://fortunatemaps.herokuapp.com/map/*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';

    // Create a button element
    var button = document.createElement('button');
    button.innerHTML = 'Redirect to StraTAGy';

    // Add a click event listener to the button
    button.addEventListener('click', function() {
        // Extract the map code from the URL
        var mapUrl = window.location.href;
        var mapCode = mapUrl.substring(mapUrl.lastIndexOf('/') + 1);

        // Redirect to StraTAGy page and execute handleJPEGImage function
        window.location.href = 'https://bambitp.github.io/StraTAGy/?mapCode=' + encodeURIComponent(mapCode);
    });

    // Find the element on the Fortunate Maps page to append the button to
    var targetElement = document.querySelector('.btn-group.w-100');

    // Append the button to the target element
    if (targetElement) {
        targetElement.appendChild(button);
    }
})();