Videoele Complete Modifier

Simple VideoEle Modifier

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Videoele Complete Modifier
// @namespace    http://tampermonkey.net/
// @version      0.1
// @author       ToneTest
// @match        https://videoele.com/*
// @description Simple VideoEle Modifier
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    
    let savedQuestionCount = 0;
    let countHasBeenSet = false;

    function modifyElements() {
        if (!countHasBeenSet) {
            let questionCount = 0;
            const tableRows = document.querySelectorAll('tr');
            tableRows.forEach(row => {
                const cells = row.querySelectorAll('td');
                if (cells.length === 4) {
                    if (cells[2] && cells[2].textContent === '⚫') {
                        questionCount++;
                    }
                }
            });
            
            if (questionCount > 0) {
                savedQuestionCount = questionCount;
                countHasBeenSet = true;
            }
        }

        const paragraphs = document.querySelectorAll('p.clinf-c.clinf-n');
        paragraphs.forEach(p => {
            p.classList.remove('clinf-n');
            p.classList.add('clinf-b');
        });

        const spans = document.querySelectorAll('span.clinf-cn');
        spans.forEach(span => {
            if (span.textContent.includes('%')) {
                span.textContent = ' 100%';
            }
        });

        const checkSpans = document.querySelectorAll('span.clinf-cn.clinf-b');
        checkSpans.forEach(span => {
            if (span.textContent.includes('✔') || span.textContent.match(/\b0\b/) || span.textContent.trim() === '0') {
                span.textContent = savedQuestionCount + ' ✔ ';
            }
        });

        const tableRows = document.querySelectorAll('tr');
        tableRows.forEach(row => {
            const cells = row.querySelectorAll('td');
            if (cells.length === 4) {
                if (cells[2] && cells[2].textContent === '⚫') {
                    cells[2].innerHTML = '<strong>✔</strong>';
                    cells[3].textContent = Math.floor(Math.random() * 4) + 1;
                }
            }
        });
    }

    let lastUrl = location.href;
    
    new MutationObserver(() => {
        if (location.href !== lastUrl) {
            lastUrl = location.href;
            countHasBeenSet = false;
            setTimeout(modifyElements, 1000);
        }
    }).observe(document, {subtree: true, childList: true});

    modifyElements();

    window.addEventListener('load', () => {
        modifyElements();
        if (!countHasBeenSet) {
            setTimeout(modifyElements, 1500);
        }
    });

    setInterval(modifyElements, 2000);
})();