LSS Auto-Reload

Automatically reload vehicle lists in missions to get the most amount of units

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         LSS Auto-Reload
// @namespace    www.missionchief.co.uk/
// @version      1.2
// @description  Automatically reload vehicle lists in missions to get the most amount of units
// @author       Conroy
// @match        https://www.missionchief.co.uk/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Variablendeklaration für den Sperrtimer
    let sperrTimer;

    // Ereignislistener für das Mouseover-Ereignis auf dem Element mit der ID 'mission-aao-group'
    document.getElementById('mission-aao-group')?.addEventListener('mouseover', function (e) {
        const target = e.target;
        if (!(target instanceof HTMLElement)) return; // Überprüfen, ob das Ziel ein HTMLElement ist

        // Das nächstgelegene Elternelement vom Typ 'a' mit der Klasse 'btn-warning' finden
        const aaoEntry = target.closest('a.aao');
        if (!aaoEntry) return;

        // Überprüfen, ob das AAO-Element das "danger"-Label hat
        const dangerLabel = aaoEntry.querySelector('.label.label-danger');
        if (!dangerLabel) return;

        // Timeout: Wir müssen 500 ms warten, bevor wir etwas tun
        const timer = setTimeout(function() {
            if (sperrTimer) return;
            sperrTimer = true;
            const reloadButton = document.querySelector('.missing_vehicles_load.btn-warning');
            if (reloadButton) {
                reloadButton.click();
            }
            setTimeout(function() {
                sperrTimer = false;
            }, 30);
        }, 5);

        // Ereignislistener für das Mouseleave-Ereignis auf dem gefundenen Elternelement
        aaoEntry.addEventListener('mouseleave', () => {
            clearTimeout(timer);
        }, { once: true });
    });
})();