新增平顶山学院(青书学堂)自动学习脚本
This commit is contained in:
parent
03150d3f9e
commit
5435be49e6
|
|
@ -0,0 +1,90 @@
|
|||
// ==UserScript==
|
||||
// @name 平顶山学院(青书学堂)自动学习脚本
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 2025-11-24
|
||||
// @description try to take over the world!
|
||||
// @author You
|
||||
// @match https://degree.qingshuxuetang.com/pdsu/Student/Course/CourseStudy*
|
||||
// @match https://degree.qingshuxuetang.com/pdsu/Student/Course/CourseShow*
|
||||
// @icon https://www.google.com/s2/favicons?sz=64&domain=qingshuxuetang.com
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
const url = window.location.href;
|
||||
console.log("插件加载完成,等待界面渲染");
|
||||
|
||||
const onPageLoad = () => {
|
||||
console.log("页面加载完成,开始执行脚本");
|
||||
|
||||
if (url.includes("CourseStudy")) {
|
||||
console.log("进入准备阶段");
|
||||
// 等待3秒后点击下一个未播放的视频
|
||||
setTimeout(() => {
|
||||
// 准备阶段
|
||||
const list = document.querySelector("#list");
|
||||
if (!list) {
|
||||
console.log("list element not found");
|
||||
return;
|
||||
}
|
||||
const items = list.querySelectorAll("li > a.node");
|
||||
console.log("获取到课程数量:", items.length);
|
||||
|
||||
if (items.length === 0) {
|
||||
console.log("课程数量为空,结束脚本");
|
||||
return;
|
||||
}
|
||||
for (const item of items) {
|
||||
if (!item.querySelector(".study_being")) {
|
||||
console.log(
|
||||
"点击下一个未播放的视频:" +
|
||||
item.querySelector(".title").innerText
|
||||
);
|
||||
item.click();
|
||||
return;
|
||||
}
|
||||
}
|
||||
console.log("所有视频均已播放完毕,结束脚本");
|
||||
}, 3000);
|
||||
} else if (url.includes("CourseShow")) {
|
||||
console.log("进入学习阶段");
|
||||
// 学习阶段
|
||||
const videoInterval = setInterval(() => {
|
||||
const video = document.querySelector("#vjs_video_3_html5_api");
|
||||
|
||||
if (!video) {
|
||||
console.log("视频元素未找到,结束脚本");
|
||||
return;
|
||||
}
|
||||
|
||||
if (video.paused && video.currentTime === 0) {
|
||||
video.play();
|
||||
console.log("视频暂停,正在播放视频");
|
||||
return;
|
||||
}
|
||||
|
||||
if (video.currentTime >= video.duration - 1) {
|
||||
console.log("视频播放结束,返回准备页面");
|
||||
clearInterval(videoInterval);
|
||||
document
|
||||
.querySelector(
|
||||
"body > div.wrapper > div:nth-child(66) > ol > li:nth-child(3) > a"
|
||||
)
|
||||
.click();
|
||||
}
|
||||
|
||||
if (video.playbackRate === 1) {
|
||||
console.log("设置视频为2倍速播放");
|
||||
video.playbackRate = 2;
|
||||
}
|
||||
|
||||
console.log("视频正在播放,当前时间:" + video.currentTime);
|
||||
}, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
// 等待页面加载完成后执行
|
||||
window.addEventListener("load", onPageLoad);
|
||||
})();
|
||||
Loading…
Reference in New Issue