From 33128b5c7e85a76454f8f2131e3236026560ceff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=9F=E5=BA=B7?= Date: Mon, 24 Nov 2025 16:04:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20qingshuxuetang=5Fauto=5Fpl?= =?UTF-8?q?ay.user.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...use.js => qingshuxuetang_auto_play.user.js | 180 +++++++++--------- 1 file changed, 90 insertions(+), 90 deletions(-) rename qingshuxuetang_auto_play.use.js => qingshuxuetang_auto_play.user.js (96%) diff --git a/qingshuxuetang_auto_play.use.js b/qingshuxuetang_auto_play.user.js similarity index 96% rename from qingshuxuetang_auto_play.use.js rename to qingshuxuetang_auto_play.user.js index 1acc17e..2dcfe9b 100644 --- a/qingshuxuetang_auto_play.use.js +++ b/qingshuxuetang_auto_play.user.js @@ -1,90 +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); -})(); +// ==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); +})();