偽造學習時間 (用來逃避老師用刷新檢查自己用F12改的時間)

改變學習時間 避免用F12被刷新

当前为 2025-09-30 提交的版本,查看 最新版本

// ==UserScript==
// @name         偽造學習時間 (用來逃避老師用刷新檢查自己用F12改的時間)
// @namespace    https://example.com
// @version      1.0
// @description  改變學習時間 避免用F12被刷新
// @match        https://www.coolenglish.edu.tw/*
// @license      MIT
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const pad = n => n.toString().padStart(2, '0');

    "xx小時 xx分 xx秒"
    const secondsToText = (sec) => {
        const h = Math.floor(sec / 3600);
        const m = Math.floor((sec % 3600) / 60);
        const s = sec % 60;
        return `${pad(h)}小時 ${pad(m)}分 ${pad(s)}秒`;
    };

    const generateTimes = () => {
        const min = 6 * 3600; 
        const total = 12 * 3600 + Math.floor(Math.random() * (3 * 3600));
        let a = 0, b = 0;
        do {
            a = min + Math.floor(Math.random() * (total - 2 * min));
            b = total - a;
        } while (b < min);
        return [total, a, b];
    };

    const updateTimes = () => {
        let changed = false;

        const rows = document.querySelectorAll('tr');
        rows.forEach(row => {
            const tds = row.querySelectorAll('td.teacher-a');
            if (tds.length === 4) {
                const [month, totalTd, watchTd, practiceTd] = tds;
                if (!totalTd.dataset.modified) {
                    const [total, watch, practice] = generateTimes();
                    totalTd.textContent = secondsToText(total);
                    watchTd.textContent = secondsToText(watch);
                    practiceTd.textContent = secondsToText(practice);
                    totalTd.dataset.modified = "true"; 
                    changed = true;
                }
            }
        });

        return changed;
    };

    const interval = setInterval(() => {
        if (updateTimes()) {
            clearInterval(interval); 
        }
    }, 100);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址