您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
联大学堂河科大自动刷课答题考试,进入答题或课程页面,点击右上角红色“开始”按钮,即可自动刷课、答题、考试。
当前为
// ==UserScript== // @name 联大学堂河科大自动自动刷课、答题、考试 // @namespace http://tampermonkey.net/ // @version 1.0.1 // @description 联大学堂河科大自动刷课答题考试,进入答题或课程页面,点击右上角红色“开始”按钮,即可自动刷课、答题、考试。 // @author zxyong // @match *://*.jxjypt.cn/classroom/start* // @match *://*.jxjypt.cn/paper/start* // @icon https://kc.jxjypt.cn/favicon.ico // @grant none // @license MIT // ==/UserScript== 'use strict' let timer = 0 ;(function () { const btn = document.createElement('button') btn.style.cssText = ` position: fixed; z-index: 99999; top: 0; right: 0; padding: 10px 50px; background: red; color: white; cursor: pointer; border: 2px solid white; box-shadow: 0 0 10px #999; ` btn.innerText = '开始' btn.addEventListener('click', () => { if (timer) { clearInterval(timer) timer = 0 btn.innerText = '开始' } else { btn.innerText = '暂停' const path = location.pathname if (path === '/classroom/start') { // 视频课 doVideoCourse() } else if (path === '/paper/start') { // 课程作业或考试 doPaper() } else { btn.innerText = '开始' } } }) document.body.appendChild(btn) })() /** 视频课 */ function doVideoCourse() { const courseList = document.querySelectorAll('.course-l .course-list-txt') const unplayedList = [] // 待做课程id courseList.forEach(item => { const sections = item.querySelectorAll('dd.z-gery-icon') sections.forEach(section => { const unplay = section.querySelector('.fa-youtube-play') if (unplay) { unplayedList.push(section.dataset.jieId) } }) }) // console.log(unplayedList) function nextVideo() { const section = document.querySelector( `dd[data-jie-id="${unplayedList[0]}"]` ) section.parentElement.querySelector('dt.z-gery-icon').click() section.click() setTimeout(async () => { const video = document .querySelector('#video-content') .querySelector('video') if (video) { video.play() } const question = document.querySelector('#question-area .m-question') // console.log(question) const qid = question.dataset.qid const answer = await getAnswerByQid(qid) document .querySelector(`.m-question-option[data-value="${answer}"]`) .click() unplayedList.shift() console.log(`Done ${qid}, ${unplayedList.length} left`) }, 1000) } if (!unplayedList.length) { clearInterval(timer) alert('当前页面全部课程已完成') return } setTimeout(nextVideo, 1000) timer = setInterval(nextVideo, 1000 * 5) } /** 课程作业或考试 */ let qIndex = 0 function doPaper() { const qList = document.querySelectorAll('#questionModule > ul > li') timer = setInterval(async () => { if (qIndex === qList.length) { clearInterval(timer) document.querySelector('#btn_submit').click() return } const qid = qList[qIndex].querySelector( `input[name="qid[${qIndex}]"]` ).value const answer = await getAnswerByQid(qid) const options = qList[qIndex].querySelector('dl.sub-answer') if (options) { // 选择题 answer.forEach(a => { options.querySelector(`dd[data-value="${a}"]`).click() }) } else { // 填空 简答 qList[qIndex].querySelector('.mater-respond textarea').value = answer } qIndex++ console.log(`Done ${qid}, ${qList.length - qIndex} left`) }, 1000) } function getApiUrl(qid) { return `https://kc.jxjypt.cn/classroom/favorite/question/view?qid=${qid}&ver=0` } /** 获取答案 */ async function getAnswerByQid(qid) { const data = await fetch(getApiUrl(qid)) const text = await data.text() const parser = new DOMParser() const html = parser.parseFromString(text, 'text/html') let answer const right = html.querySelector('.right') if (right) { const text = right.innerText.trim() if (text === '错') { // 判断题 answer = ['错误'] } else if (text === '对') { answer = ['正确'] } else { // 选择题 answer = right.innerText.trim().split('') } } else { // 填空 简答 answer = html.querySelector('.wenzi').innerText.trim() } return answer }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址