CubeRealm - Session Timer

Short session timer with reset via chat "0"

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

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

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

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

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

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

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

Advertisement:

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

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

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

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

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

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

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

Advertisement:

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         CubeRealm - Session Timer
// @match        https://cuberealm.io/*
// @grant        none
// @description  Short session timer with reset via chat "0"

// @version 0.0.1.20260626140700
// @namespace https://greasyfork.org/users/1579200
// ==/UserScript==
(function() {
    let startTime = Date.now();

    // Création de l'affichage
    const timerDiv = document.createElement("div");
    timerDiv.style.position = "absolute";
    timerDiv.style.top = "10px";
    timerDiv.style.left = "10px";
    timerDiv.style.color = "white";
    timerDiv.style.fontSize = "18px";
    timerDiv.style.fontFamily = "Arial";
    timerDiv.style.background = "rgba(0,0,0,0.4)";
    timerDiv.style.padding = "6px 10px";
    timerDiv.style.borderRadius = "6px";
    timerDiv.style.zIndex = "9999";
    timerDiv.innerText = "Temps de jeu : 0:00";
    document.body.appendChild(timerDiv);

    // Mise à jour du timer
    setInterval(() => {
        let elapsed = Math.floor((Date.now() - startTime) / 1000);
        let minutes = Math.floor(elapsed / 60);
        let seconds = elapsed % 60;
        timerDiv.innerText = `Temps de jeu : ${minutes}:${seconds.toString().padStart(2, "0")}`;
    }, 1000);

    // Reset quand tu écris "0" dans le chat
    document.addEventListener("keydown", (e) => {
        if (e.key === "Enter") {
            const chatInput = document.querySelector("input[type='text']");
            if (chatInput && chatInput.value.trim() === "0") {
                startTime = Date.now();
                chatInput.value = "";
            }
        }
    });
})();