Gpop note counter

h

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Gpop note counter
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  h
// @author       osugamer983
// @match        https://gpop.io/play/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==
(function() {
    'use strict';

    function getSkips() {
        const skipsEl = document.querySelector(".skips");
        if (!skipsEl) return 0;

        let skips = Number(skipsEl.textContent) || 0;

        if (skips < 0) {
            skips = 0;
            skipsEl.textContent = 0;
        }

        return skips;
    }

    function getFcStatus() {
        document.querySelectorAll(".mapinfocc > .playpage-over-status-cansubmit:not(.fcstatus)").forEach(function(el) {
            el.remove();
        });

        const statuses = document.querySelectorAll(".mapinfocc > .fcstatus");
        for (let i = 1; i < statuses.length; i++) {
            statuses[i].remove();
        }

        let status = document.querySelector(".mapinfocc > .fcstatus");
        if (status) return status;

        const box = document.querySelector(".mapinfocc");
        if (!box) return null;

        status = document.createElement("div");
        status.className = "fcstatus";
        box.appendChild(status);

        return status;
    }

    function updateFcStatus(game) {
        const status = getFcStatus();
        if (!status) return;

        const misses = game.noteshitMiss || 0;
        const dropped = game.noteshitHoldDrops || 0;
        const skips = getSkips();

        status.style.display = "flex";
        status.style.justifyContent = "center";
        status.style.alignItems = "center";
        status.style.textAlign = "center";
        status.style.width = "100%";
        status.style.maxWidth = "100%";
        status.style.boxSizing = "border-box";
        status.style.overflow = "hidden";
        status.style.whiteSpace = "nowrap";
        status.style.fontSize = "30px";

        status.classList.add("playpage-over-status-cansubmit");

        if (misses === 0 && skips === 0 && dropped === 0) {
            status.style.display = "flex";
            status.textContent = "Full combo";
            status.classList.add("playpage-over-huerotate");
            status.style.color = "";
        } else if (misses === 0 && skips === 0) {
            status.style.display = "flex";
            status.textContent = "Full streak";
            status.classList.remove("playpage-over-huerotate");
            status.style.color = "yellow";
        } else {
            status.textContent = "";
            status.style.display = "none";
            status.classList.remove("playpage-over-huerotate");
            status.style.color = "";
        }
    }

    window._$3q.prototype._$77 = function(a) {
        var b = a.key.toLowerCase();
        if (a.keyCode == 32) {
            if (this._$85 == true) {
                this._$bc();
            }
            a.preventDefault();
        } else if (b == "u") {
            if (this._$85 == true) {
                this._$4S();
            }
            a.preventDefault();
        } else if (b == "r") {
            if (this._$85 == true) {
                this._$39u();
                this._$40u()
                this._$7L();
            }
            a.preventDefault();
        }
    };

    window._$3q.prototype._$40u = function() {
        this.noteshitPerf = this.noteshitPerf || 0;
        this.noteshitGreat = this.noteshitGreat || 0;
        this.noteshitGood = this.noteshitGood || 0;
        this.noteshitOk = this.noteshitOk || 0;
        this.noteshitMiss = this.noteshitMiss || 0;
        this.noteshitHoldDrops = this.noteshitHoldDrops || 0;

        const perfs = document.querySelector(".perfs");
        const greats = document.querySelector(".greats");
        const goods = document.querySelector(".goods");
        const oks = document.querySelector(".oks");
        const totalhits = document.querySelector(".totalhits");
        const misses = document.querySelector(".misses");
        const holddrops = document.querySelector(".holddrops");

        if (perfs) perfs.textContent = this.noteshitPerf;
        if (greats) greats.textContent = this.noteshitGreat;
        if (goods) goods.textContent = this.noteshitGood;
        if (oks) oks.textContent = this.noteshitOk;

        if (totalhits) {
            totalhits.textContent =
                this.noteshitPerf +
                this.noteshitOk +
                this.noteshitGreat +
                this.noteshitGood;
        }

        if (misses) misses.textContent = this.noteshitMiss;
        if (holddrops) holddrops.textContent = this.noteshitHoldDrops;

        getSkips();
        watchSkipsForFcStatus();
        updateFcStatus(this);
    }

    window._$3q.prototype._$39u = function() {
        this.noteshitMiss = 0;
        this.noteshitOk = 0;
        this.noteshitGood = 0;
        this.noteshitGreat = 0;
        this.noteshitPerf = 0;
        this.noteshitHoldDrops = 0;
    };

    window._$3q.prototype._$bj = function(a) {
        this._$39u()
        this._$8V(a);
        this._$8E();
        this._$aj();
        this._$5g();
        this._$aB();
        this.mode = -1;
        this._$8C = 0.3;
        this._$6D = 15;
        this._$86 = 100 / this._$6D;
        this._$7n = 4;
        this._$z(false);
        this._$9z = false;
        this._$3E("load");
        this.gamespeed = 5;
        this._$5V = 50;
        this._$3Y = 10;
        this._$8i = false;
        this._$7t = 2;
        this._$8f = this._$7t / this._$6D;
        this._$V = 1.25;
        this._$5w = this._$V / this._$6D;
        this._$b7 = -1;
        this._$b8 = 500;
        this._$68 = 0;
        this._$bq = 0;
        this.lesslag = false;
        this._$8c();
        this.gm = "o";
        window.addEventListener("resize", this._$1y.bind(this));
        this._$1y();
    };

    window._$3q.prototype._$4k = function(a) {
        this._$5k(a);
        this._$3y[a] = _$7B.epoch() + 0.6 * 1000;
        this._$6N[a] = _$7B.epoch() + 0.08 * 1000;
        this.noteshitMiss += 1;
        this._$40u()
        this._$3o[a]["0"].style.opacity = 1;
        this._$3o[a]["0"].style.top = _$7B._$4K(-15, 15) + "px";
        this._$3o[a]["0"].style.left = _$7B._$4K(-5, 5) + "px";
        this._$3o[a]["0"].style.transform = "translateX(-50%) scale(1.2)";
    };

    window._$3q.prototype._$5n = function(a, c) {
        this._$5k(a);
        this._$3y[a] = _$7B.epoch() + 0.6 * 1000;
        this._$6N[a] = _$7B.epoch() + 0.08 * 1000;
        var b = "1";
        if (c < 0.5) {
            this.noteshitOk += 1;
        }
        else if (c < 0.75) {
            this.noteshitGood += 1;
            b = "2";
        } else if (c < 0.9) {
            this.noteshitGreat += 1;
            b = "3";
        } else {
            this.noteshitPerf += 1;
            b = "4";
        }
        this._$40u()
        this._$3o[a][b].style.opacity = 1;
        this._$3o[a][b].style.top = _$7B._$4K(-15, 15) + "px";
        this._$3o[a][b].style.left = _$7B._$4K(-5, 5) + "px";
        this._$3o[a][b].style.transform = "translateX(-50%) scale(1.2)";
    };

    const old_$5P = window._$3q.prototype._$5P;

    window._$3q.prototype._$5P = function(type, data) {
        if (type === "missextend") {
            this.noteshitHoldDrops = (this.noteshitHoldDrops || 0) + 1;
            this._$40u();
        }

        if (old_$5P) {
            return old_$5P.apply(this, arguments);
        }
    };
    function watchSkipsForFcStatus() {
        const skipsEl = document.querySelector(".skips");
        if (!skipsEl || skipsEl.__fcStatusObserver) return;

        const observer = new MutationObserver(function() {
            const skips = Number(skipsEl.textContent) || 0;

            if (skips < 0) {
                skipsEl.textContent = 0;
                return;
            }

            const status = document.querySelector(".fcstatus");
            if (!status) return;

            const misses = Number(document.querySelector(".misses")?.textContent || 0);
            const dropped = Number(document.querySelector(".holddrops")?.textContent || 0);
            const totalhits = Number(document.querySelector(".totalhits")?.textContent || 0);

            if (totalhits <= 0) {
                status.textContent = "";
                status.classList.remove("playpage-over-huerotate");
                status.classList.add("playpage-over-status-cansubmit");
                status.style.color = "";
                return;
            }

            status.style.display = "flex";
            status.style.justifyContent = "center";
            status.style.textAlign = "center";
            status.style.width = "100%";
            status.style.fontSize = "30px";
            status.classList.add("playpage-over-status-cansubmit");

            if (misses === 0 && skips === 0 && dropped === 0) {
                status.textContent = "Full combo";
                status.classList.add("playpage-over-huerotate");
                status.style.color = "";
            } else if (misses === 0 && skips === 0) {
                status.textContent = "Full streak";
                status.classList.remove("playpage-over-huerotate");
                status.style.color = "yellow";
            } else {
                status.textContent = "";
                status.classList.remove("playpage-over-huerotate");
                status.style.color = "";
            }
        });

        observer.observe(skipsEl, {
            childList: true,
            characterData: true,
            subtree: true
        });

        skipsEl.__fcStatusObserver = observer;
    }
})();