blhxjysx

碧蓝幻想救援筛选脚本的简化版,用于手机alook等浏览器

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Advertisement:

// ==UserScript==
// @name         blhxjysx
// @namespace    https://github.com/Less01
// @version      0.0.3
// @description  碧蓝幻想救援筛选脚本的简化版,用于手机alook等浏览器
// @author       Less01
// @match        *://game.granbluefantasy.jp/*
// @match        *://gbf.game.mbga.jp/*
// @license MIT
// ==/UserScript==

(function() {
    let opacity = 0.25;
    let playerCount = 5;
    let enemyHp = 50;

    const targetNode = document.querySelector("#wrapper>.contents");
    const config = { childList: true, subtree: true };
    const observer = new MutationObserver(
        (mutationsList) => {
            for (let mutation of mutationsList) {
                // mutation.target.id == "prt-search-list"
                if (mutation.target.className == "prt-raid-list") {
                    let raid_list = mutation.target.querySelectorAll(".btn-multi-raid");
                    for (let raid of raid_list) {
                        let count = raid.querySelector(".prt-flees-in").innerText.replace(/\/\d+/, "");
                        let hp = raid.querySelector(".prt-raid-gauge-inner").getAttribute("style").slice(7, -2);
                        if (count >= playerCount || hp <= enemyHp) {
                            raid.style.opacity = opacity;
                        }
                    }
                }
            }
        }
    );

    function run() {
        if (/^#quest\/assist(\/multi\/\d+|\/event)?$/.test(location.hash)) {
            observer.observe(targetNode, config);
        } else {
            observer.disconnect();
        }
    }
    run();
    window.addEventListener('hashchange', run);
})();