您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
[EN] Extend the time the lab is usable when the timer is below 10 minutes
当前为
- // ==UserScript==
- // @name Ubik Academy - automatically extend lab time
- // @version 0.1
- // @namespace nil
- // @author nil
- // @grant none
- // @description [EN] Extend the time the lab is usable when the timer is below 10 minutes
- // @include https://cyberkube.app/?token=*
- // @license GPLv3
- // ==/UserScript==
- (function nil_greasemonkey_ubik_extendlab() {
- "use strict";
- function checkTimerAndPotentiallyExtendLab() {
- let elt = document.getElementById("timer");
- if (!elt) return;
- // "01h : 53m : 35s"
- let remaining_seconds = elt.innerText
- .replace(/[hms\s]/g, "")
- .split(':')
- .map(Number)
- .reverse()
- .reduce((acc, elt, idx) => acc + elt * 60**idx, 0);
- // do nothing if more than 10 minutes left (600 seconds)
- if (600 <= remaining_seconds) return;
- let extendBtn = document.getElementById("extend-btn");
- if (!extendBtn) { console.log("#extend-btn element not found"); return; }
- console.log("clicked the extend lab button!");
- extendBtn.click();
- }
- window.setInterval(checkTimerAndPotentiallyExtendLab, 60000);
- })();