学习通快速看题

方便快速地在学习通中回顾已批改的选择题、判断题

目前为 2023-06-12 提交的版本。查看 最新版本

// ==UserScript==
// @name         学习通快速看题
// @namespace    https://trudbot.cn/
// @version      0.1
// @description  方便快速地在学习通中回顾已批改的选择题、判断题
// @author       trudbot
// @match        *://*.chaoxing.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=chaoxing.com
// @grant        none
// @license      GPL-2.0-only
// ==/UserScript==


(function () {
    let qs = document.getElementsByClassName('questionLi');

    for (let q of qs) {
        let option = q.getElementsByClassName('mark_letter')[0].getElementsByTagName('li');
        let answerContainer = q.getElementsByClassName('mark_answer')[0];
        let answer = answerContainer.querySelectorAll("span.colorGreen")[0];
        // console.log(answer.innerHTML);
        function getAnswer(s) {
            for (let c of s.innerHTML) {
                if (c >= 'A' && c <= 'D') {
                    switch (c) {
                        case 'A': return 0;
                        case 'B': return 1;
                        case 'C': return 2;
                        case 'D': return 3;
                    }
                }
            }
            return -1;
        }

        let id = getAnswer(answer);
        // console.log(id);
        if (id === -1 || id >= option.length) {
            // alert("error!");
            answerContainer.getElementsByClassName('mark_score')[0].style.display = 'none';
            for (let d of answerContainer.getElementsByClassName('colorDeep')) {
                d.style.display = 'none';
            }
        } else {
            let correctOption = option[id];
            //correctOption.setAttribute('class', 'colorGreen');
            correctOption.style.backgroundColor = '#00B86E';
            answerContainer.style.display = 'none';
        }
    }
})();

QingJ © 2025

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