UESTC向2025级大一新生发布了观看军事理论课程的任务,一共有100+课程,刷起来很麻烦。所以我制作了一份Tampermonkey(油猴/篡改猴)脚本供大家学习交流使用。
注:本脚本仅供学习交流使用,学习后请在24小时内删除。
以下为使用方法:
1.在浏览器上添加Tampermonkey扩展
由于用户使用的浏览器种类多种多样,此处只展示部分浏览器的添加步骤。如果你不太能理解相关内容,建议直接使用下面列出的Edge浏览器或者火狐浏览器。
-
Microsoft Edge浏览器
使用Edge浏览器打开此页面,然后点击“获取”按钮,然后根据提示添加此扩展到Edge浏览器。
-
火狐(Firefox)浏览器
使用火狐浏览器打开此页面,然后根据页面上的提示添加此扩展到火狐浏览器。
-
谷歌(Chrome)浏览器
如果你会科学上网(此处不阐释这是什么),则可以通过谷歌浏览器打开此页面,然后根据页面上的提示添加此扩展到谷歌浏览器。
如果你不知道科学上网是什么,建议使用Edge浏览器或火狐浏览器使用脚本,或者通过互联网上的教程安装此扩展。
2.在浏览器的“管理扩展”页面启用开发人员模式(火狐浏览器可以跳过此步)
跟上一步一样,此处只展示部分浏览器的步骤。
-
Edge浏览器
在Edge浏览器的菜单中找到“扩展”选项,在弹出菜单中选择“管理扩展”选项,再去弹出的页面中启用“开发人员模式”。开发人员模式的切换按钮通常在页面的左侧。
-
谷歌浏览器
可以在搜索引擎搜索关键字
谷歌浏览器打开开发者模式
来获取启用开发人员模式的教程。
3.在Tampermonkey扩展中添加脚本
在浏览器工具栏的“扩展”或“扩展程序”弹出式菜单中找到刚才安装的Tampermonkey扩展,然后点击它,应该会出现如图所示的弹出式菜单。
在这个菜单中点击“添加新脚本…”,会弹出如图所示的窗口页面。
删除编辑器里的所有内容,然后粘贴如下的脚本进编辑器。
// ==UserScript==
// @name UESTC军事理论课刷课脚本
// @namespace https://www.denvoshome.xyz/index.php/archives/271
// @version 1.3
// @description 自动播放课程视频并自动在播放完成后跳转到下一个视频播放,同时禁用视频的暂停功能
// @author Denvo
// @match https://mooc1.chaoxing.com/*
// @grant GM_registerMenuCommand
// ==/UserScript==
(function() {
'use strict';
//只允许在顶层窗口中执行脚本,不允许在iframe中执行!
if (window.top !== window.self) {
return;
}
/*
军事理论课的数据,直接从听课的网站上扒的
chapter是章节,title是课的标题,id是课的标识符
*/
const classData = [
{ chapter: "1.1", title: "国防的内涵", id: "1018955373" },
{ chapter: "1.2", title: "国防的职能与使命【上】", id: "1018955374" },
{ chapter: "1.3", title: "国防的职能与使命【中】", id: "1018955375" },
{ chapter: "1.4", title: "国防的职能与使命【下】", id: "1018955376" },
{ chapter: "1.5", title: "国防的扩张类型", id: "1018955377" },
{ chapter: "1.6", title: "国防的自卫防御类型【上】", id: "1018955378" },
{ chapter: "1.7", title: "国防的自卫防御类型【下】", id: "1018955379" },
{ chapter: "1.8", title: "国防的联盟类型【上】", id: "1018955380" },
{ chapter: "1.9", title: "国防的联盟类型【下】", id: "1018955381" },
{ chapter: "1.10", title: "国防的中立类型", id: "1018955382" },
{ chapter: "1.11", title: "中国古代国防兵制建设", id: "1018955383" },
{ chapter: "1.12", title: "中国古代国防工程建设", id: "1018955384" },
{ chapter: "1.13", title: "中国近现代国防历程【上】", id: "1018955385" },
{ chapter: "1.14", title: "中国近现代国防历程【下】", id: "1018955386" },
{ chapter: "1.15", title: "牢记中国国防耻辱【上】", id: "1018955387" },
{ chapter: "1.16", title: "牢记中国国防耻辱【下】", id: "1018955388" },
{ chapter: "1.17", title: "中国国防历史的主要启示【上】", id: "1018955389" },
{ chapter: "1.18", title: "中国国防历史的主要启示【下】", id: "1018955391" },
{ chapter: "1.19", title: "现代国防观", id: "1018955392" },
{ chapter: "1.20", title: "现代国防存在多种斗争形式", id: "1018955393" },
{ chapter: "1.21", title: "现代国防走质量建军是国家综合国力的体现", id: "1018955394" },
{ chapter: "1.22", title: "现代国防是国家行为具有威慑作用", id: "1018955396" },
{ chapter: "2.1", title: "国防法规与体系", id: "1018955395" },
{ chapter: "2.2", title: "公民的国防义务与权利", id: "1018955398" },
{ chapter: "3.1", title: "国防体制", id: "1018955399" },
{ chapter: "3.2", title: "我国的国防建设目标和战略任务", id: "1018955400" },
{ chapter: "3.3", title: "国防(军事)战略【上】", id: "1018955401" },
{ chapter: "3.4", title: "国防(军事)战略【中】", id: "1018955402" },
{ chapter: "3.5", title: "国防(军事)战略【下】", id: "1018955403" },
{ chapter: "3.6", title: "中国的国防政策", id: "1018955404" },
{ chapter: "3.7", title: "新中国国防建设成就【上】", id: "1018955405" },
{ chapter: "3.8", title: "新中国国防建设成就【中】", id: "1018955406" },
{ chapter: "3.9", title: "新中国国防建设成就【下】", id: "1018955408" },
{ chapter: "3.10", title: "我国国防工业和国防科技所取得的成就", id: "1018955409" },
{ chapter: "3.11", title: "军民融合", id: "1018955410" },
{ chapter: "4.1", title: "中国武装力量的性质、宗旨与使命", id: "1018955411" },
{ chapter: "4.2", title: "中国武装力量构成", id: "1018955412" },
{ chapter: "4.3", title: "中国人民解放军军兵种", id: "1018955413" },
{ chapter: "4.4", title: "中国人民解放军预备役、武警部队与中国民兵", id: "1018955414" },
{ chapter: "4.5", title: "人民军队的发展历程:土地革命战争", id: "1018955415" },
{ chapter: "4.6", title: "人民军队的发展历程:抗日战争", id: "1018955535" },
{ chapter: "4.7", title: "人民军队的发展历程:解放战争", id: "1018955536" },
{ chapter: "4.8", title: "人民军队的发展历程:社会主义革命与建设", id: "1018955537" },
{ chapter: "4.9", title: "服从大局支援国家经济建设", id: "1018955538" },
{ chapter: "5.1", title: "国防动员内涵与地位作用", id: "1018955416" },
{ chapter: "5.2", title: "国防动员主要内容与意义", id: "1018955417" },
{ chapter: "6.1", title: "国家安全的内涵", id: "1018955418" },
{ chapter: "6.2", title: "国家安全的原则", id: "1018955419" },
{ chapter: "6.3", title: "总体国家安全观", id: "1018955420" },
{ chapter: "7.1", title: "中国地缘环境基本概况【上】", id: "1018955422" },
{ chapter: "7.2", title: "中国地缘环境基本概况【下】", id: "1018955423" },
{ chapter: "7.3", title: "中国地缘安全坚持统一遏制“台独”", id: "1018955424" },
{ chapter: "7.4", title: "中国地缘安全东北亚方向", id: "1018955425" },
{ chapter: "7.5", title: "中国地缘安全俄罗斯、蒙古方向", id: "1018955427" },
{ chapter: "7.6", title: "中国地缘安全中亚方向", id: "1018955428" },
{ chapter: "7.7", title: "中国地缘安全南亚方向", id: "1018955429" },
{ chapter: "7.8", title: "中国地缘安全南海方向", id: "1018955431" },
{ chapter: "7.9", title: "新形势下的国家安全【上】", id: "1018955432" },
{ chapter: "7.10", title: "新形势下的国家安全【下】", id: "1018955433" },
{ chapter: "7.11", title: "新兴领域的国家安全", id: "1018955434" },
{ chapter: "8.1", title: "国际战略形势现状与战略格局的内涵", id: "1018955435" },
{ chapter: "8.2", title: "国际战略格局形势特点", id: "1018955436" },
{ chapter: "8.3", title: "国际战略格局历史演变(上)", id: "1018955437" },
{ chapter: "8.4", title: "国际战略格局历史演变(下)", id: "1018955438" },
{ chapter: "8.5", title: "国际战略形势发展趋势【上】", id: "1018955439" },
{ chapter: "8.6", title: "国际战略形势发展趋势【中】", id: "1018955440" },
{ chapter: "8.7", title: "国际战略形势发展趋势【下】", id: "1018955441" },
{ chapter: "8.8", title: "当前国际战略格局中的大国关系", id: "1018955444" },
{ chapter: "8.9", title: "世界主要国家军事力量及战略动向", id: "1018955445" },
{ chapter: "9.1", title: "军事思想的内涵与特征", id: "1018955446" },
{ chapter: "9.2", title: "军事思想的发展历程及地位作用", id: "1018955447" },
{ chapter: "10.1", title: "外国军事思想的主要内容与特点", id: "1018955448" },
{ chapter: "10.2", title: "外国军事思想代表性理论及著作简介", id: "1018955449" },
{ chapter: "11.1", title: "中国古代军事思想的主要内容", id: "1018955450" },
{ chapter: "11.2", title: "中国古代军事思想的特色及其影响", id: "1018955451" },
{ chapter: "11.3", title: "中国古代军事思想代表著作《孙子兵法》简介", id: "1018955452" },
{ chapter: "11.4", title: "《孙子兵法》内容", id: "1018955453" },
{ chapter: "11.5", title: "《孙子兵法》影响", id: "1018955455" },
{ chapter: "12.1", title: "毛泽东军事思想的科学含义(上)", id: "1018955456" },
{ chapter: "12.2", title: "毛泽东军事思想的科学含义(下)", id: "1018955457" },
{ chapter: "12.3", title: "毛泽东军事思想的形成与发展(上)", id: "1018955458" },
{ chapter: "12.4", title: "毛泽东军事思想的形成与发展(下)", id: "1018955459" },
{ chapter: "12.5", title: "战争观和方法论(上)", id: "1018955460" },
{ chapter: "12.6", title: "战争观和方法论(下)", id: "1018955461" },
{ chapter: "12.7", title: "人民军队建设思想", id: "1018955462" },
{ chapter: "12.8", title: "人民战争思想(上)", id: "1018955463" },
{ chapter: "12.9", title: "人民战争思想(下)", id: "1018955464" },
{ chapter: "12.10", title: "人民战争的战略战术思想(上)", id: "1018955465" },
{ chapter: "12.11", title: "人民战争的战略战术思想(下)", id: "1018955467" },
{ chapter: "12.12", title: "国防建设思想", id: "1018955468" },
{ chapter: "12.13", title: "毛泽东军事思想的历史地位与现实意义", id: "1018955469" },
{ chapter: "12.14", title: "邓小平新时期军队建设思想的形成", id: "1018955470" },
{ chapter: "12.15", title: "邓小平新时期军队建设思想的主要内容(上)", id: "1018955471" },
{ chapter: "12.16", title: "邓小平新时期军队建设思想的主要内容(下)", id: "1018955473" },
{ chapter: "12.17", title: "邓小平新时期军队建设思想的历史地位和实践意义", id: "1018955474" },
{ chapter: "12.18", title: "江泽民国防和军队建设思想的科学含义", id: "1018955475" },
{ chapter: "12.19", title: "江泽民国防和军队建设思想产生的时代背景", id: "1018955476" },
{ chapter: "12.20", title: "江泽民国防和军队建设思想的主要内容", id: "1018955477" },
{ chapter: "12.21", title: "江泽民国防和军队建设思想的地位与作用", id: "1018955478" },
{ chapter: "12.22", title: "胡锦涛关于国防和军队建设重要论述(上)", id: "1018955479" },
{ chapter: "12.23", title: "胡锦涛关于国防和军队建设重要论述(下)", id: "1018955480" },
{ chapter: "12.24", title: "胡锦涛关于国防和军队建设重要论述的地位与作用", id: "1018955482" },
{ chapter: "12.25", title: "习近平强军思想的核心内容", id: "1018955483" },
{ chapter: "12.26", title: "习近平强军思想在国防和军队建设中的指导地位与作用", id: "1018955539" },
{ chapter: "13.1", title: "战争的内涵与特点", id: "1018955485" },
{ chapter: "13.2", title: "战争的发展历程", id: "1018955486" },
{ chapter: "14.1", title: "新军事革命的内涵及特点", id: "1018955488" },
{ chapter: "14.2", title: "新军事革命的发展演变", id: "1018955489" },
{ chapter: "14.3", title: "新军事变革的主要内容", id: "1018955491" },
{ chapter: "14.4", title: "中国特色新军事革命", id: "1018955542" },
{ chapter: "15.1", title: "机械化战争的基本内涵、形态与特征", id: "1018955493" },
{ chapter: "15.2", title: "机械化战争的代表性战例", id: "1018955495" },
{ chapter: "16.1", title: "信息化战争的基本内涵", id: "1018955497" },
{ chapter: "16.2", title: "信息化战争的演变及主要形态", id: "1018955499" },
{ chapter: "16.3", title: "信息化战争的主要特征", id: "1018955501" },
{ chapter: "16.4", title: "信息化战争形态发展趋势", id: "1018955504" },
{ chapter: "16.5", title: "信息化时代我国未来面临的战争威胁", id: "1018955506" },
{ chapter: "16.6", title: "信息化战争对国防建设的新要求", id: "1018955508" },
{ chapter: "16.7", title: "信息化战代表性战例", id: "1018955510" },
{ chapter: "17.1", title: "信息化装备的内涵与分类", id: "1018955512" },
{ chapter: "17.2", title: "信息化装备对现代作战的影响以及发展趋势", id: "1018955513" },
{ chapter: "18.1", title: "地面信息化作战平台", id: "1018955514" },
{ chapter: "18.2", title: "水面(下)信息化作战平台", id: "1018955515" },
{ chapter: "18.3", title: "空中信息化作战平台", id: "1018955516" },
{ chapter: "18.4", title: "信息化作战平台的发展趋势", id: "1018955517" },
{ chapter: "18.5", title: "信息化武器装备的应用战例探析", id: "1018955518" },
{ chapter: "19.1", title: "指挥控制系统", id: "1018955519" },
{ chapter: "19.2", title: "预警探测系统", id: "1018955520" },
{ chapter: "19.3", title: "导航系统", id: "1018955521" },
{ chapter: "19.4", title: "电子对抗技术", id: "1018955522" },
{ chapter: "19.5", title: "综合电子信息系统的发展趋势", id: "1018955523" },
{ chapter: "19.6", title: "综合电子信息系统在战场应用战例简介", id: "1018955524" },
{ chapter: "20.1", title: "新概念武器的定义与特征", id: "1018955525" },
{ chapter: "20.2", title: "定向能武器", id: "1018955526" },
{ chapter: "20.3", title: "基因武器", id: "1018955527" },
{ chapter: "20.4", title: "纳米武器", id: "1018955528" },
{ chapter: "20.5", title: "新概念武器对未来作战的影响", id: "1018955529" },
{ chapter: "20.6", title: "精确制导技术", id: "1018955530" },
{ chapter: "20.7", title: "核武器的产生和发展趋势", id: "1018955531" },
{ chapter: "20.8", title: "化学武器产生与发展趋势", id: "1018955532" },
{ chapter: "20.9", title: "生物武器产生与发展趋势", id: "1018955533" },
{ chapter: "20.10", title: "广岛长崎投原子弹", id: "1018955534" },
{ chapter: "21.1", title: "阅读", id: "1018955540" },
];
//脚本控制开关
let scriptRunning = false;
let observer = null;
//捕获暂停相关
let videoPlayer = null;
let pauseAction = null;
GM_registerMenuCommand("启动脚本", () => {
//获取当前视频的标题
console.log("用户点击启动按钮!获取视频标题...");
const videoTitleDiv = document.querySelector("div.prev_title");
if (!videoTitleDiv) {
alert("无法获取到当前视频的标题!");
return;
}
const videoTitle = videoTitleDiv.getAttribute("title");
if (!videoTitle) {
alert("脚本可能获取到了错误的视频标题,请检查!");
return;
}
//当前视频的标题和已有数据比对,获取当前视频id
console.log("通过视频标题获取id...");
const currentClass = classData.find(item => item.title === videoTitle);
if (currentClass) {
//注意脚本开关
scriptRunning = true;
//通过id播放视频
playVideo(currentClass.id);
//视频播放完后会自动跳转下一个视频,由于页面采用无刷新加载,则使用监听器做跳转后的自动播放
observer = new MutationObserver(() => {
const newTitleDiv = document.querySelector("div.prev_title");
if (newTitleDiv && newTitleDiv.getAttribute("title") !== videoTitle) {
const newClass = classData.find(item => item.title === newTitleDiv.getAttribute("title"));
if (newClass) {
console.log("已切换到下一个视频!脚本将继续执行...");
//设置3s后启动脚本,等待页面加载完成
setTimeout(() => {playVideo(newClass.id);}, 3000);
}
}
});
observer.observe(document.body, { childList: true, subtree: true });
return;
} else {
alert("无法根据标题获取当前视频id!");
return;
}
});
GM_registerMenuCommand("停止脚本", () => {
console.log("用户已停止脚本");
scriptRunning = false;
if (videoPlayer) {
videoPlayer.pause = pauseAction;
}
if (observer) {
observer.disconnect();
observer = null;
}
});
//等待视频所在iframe及document,并在目标元素加载完成后通过callback继续函数
function waitForVideoFrames(callback) {
const timer = setInterval(() => {
//外层iframe加载
const videoBigFrame = document.querySelector("#iframe");
if (!videoBigFrame) return;
//外层iframe内容加载
let videoBigFrameDocument;
try {
videoBigFrameDocument = videoBigFrame.contentDocument || videoBigFrame.contentWindow.document;
} catch (e) {
return;
}
if (!videoBigFrameDocument) return;
//内层iframe加载
const videoFrame = videoBigFrameDocument.querySelector("iframe.ans-attach-online.ans-insertvideo-online");
if (!videoFrame) return;
//内层iframe内容加载
let videoFrameDocument;
try {
videoFrameDocument = videoFrame.contentDocument || videoFrame.contentWindow.document;
} catch (e) {
return;
}
if (!videoFrameDocument) return;
let videoPlayer;
try {
videoPlayer = videoFrame.contentWindow.videojs("video_html5_api");
} catch (e) {
return; // videojs还没初始化
}
if (!videoPlayer) return;
//目标都已经加载完成
clearInterval(timer);
callback(videoFrame, videoFrameDocument);
}, 500);
}
//播放当前页面的视频,并根据输入的当前视频的id自行跳转下一个视频
function playVideo(id) {
//注意脚本运行开关
if (!scriptRunning) {return;}
//获取视频播放器的信息,注意视频播放器被放在了嵌套了两层的iframe中
console.log("播放视频的函数已执行!当前id为" + id + ",开始获取视频播放器的信息...");
//1.3版本更新,可能会降低找不到iframe的问题
waitForVideoFrames((videoFrame, videoFrameDocument) => {
//1.2版本插入的拦截暂停
videoPlayer = videoFrame.contentWindow.videojs("video_html5_api");
pauseAction = videoPlayer.pause.bind(videoPlayer);
//点击播放按钮
console.log("尝试点击播放按钮...");
const videoPlayButton = videoFrameDocument.querySelector('.vjs-big-play-button');
if (videoPlayButton) {
videoPlayButton.click();
} else {
alert("找不到播放按钮!");
return;
}
//1.2版本重写视频的暂停方法,使其失效
videoPlayer.pause = () => {};
//获取播放进度
console.log("尝试获取视频时长...");
const passedSpan = videoFrameDocument.querySelector(".vjs-current-time-display");
let passedDuration = 0;
if (passedSpan) {
passedDuration = passedSpan.textContent.trim();
} else {
alert("无法获取当前视频播放进度!");
return;
}
console.log("当前播放进度:" + passedDuration);
//获取视频时长,需3s后进行,等待视频加载完毕
let duration = 0;
setTimeout(() => {
console.log("尝试获取视频时长...");
const durationSpan = videoFrameDocument.querySelector(".vjs-duration-display");
if (durationSpan) {
duration = durationSpan.textContent.trim();
} else {
alert("无法获取视频总时长!");
return;
}
console.log("当前视频时长:" + duration);
//视频播放结束后根据传入的id进入下一个视频
let durationMs = timeStringToMs(duration) - timeStringToMs(passedDuration);
console.log("将于" + durationMs + "ms后跳转下一节...");
setTimeout(() => {
//注意脚本运行开关
if (!scriptRunning) {return;}
console.log("视频播放结束,获取下一个id并重新开始函数...");
const currentIndex = classData.findIndex(item => item.id === id);
if (currentIndex === -1) {
alert("传入的id不正确!");
return;
}
if (currentIndex < classData.length - 1) {
getTeacherAjax('254540282','125640414',classData[currentIndex + 1].id);
return;
} else {
scriptRunning = false;
if (videoPlayer) {
videoPlayer.pause = pauseAction;
}
if (observer) {
observer.disconnect();
observer = null;
}
alert("恭喜结束刷课!");
return;
}
}, durationMs);
}, 3000);
});
/*
const videoBigFrame = document.querySelector("#iframe");
if (!videoBigFrame) {
alert("无法获取到视频所在的外层iFrame!");
return;
}
let videoBigFrameDocument;
try {
videoBigFrameDocument = videoBigFrame.contentDocument || videoBigFrame.contentWindow.document;
} catch (e) {
alert("无法访问视频所在的外层iFrame的内容!可能是跨域问题,请检查!");
return;
}
if (!videoBigFrameDocument) {
alert("无法访问视频所在的外层iFrame的内容!");
return;
}
const videoFrame = videoBigFrameDocument.querySelector("iframe.ans-attach-online.ans-insertvideo-online");
if (!videoFrame) {
alert("无法获取到视频所在的iFrame!");
return;
}
//1.2版本插入的拦截暂停
videoPlayer = videoFrame.contentWindow.videojs("video_html5_api");
pauseAction = videoPlayer.pause.bind(videoPlayer);
//继续1.1版本的内容
let videoFrameDocument;
try {
videoFrameDocument = videoFrame.contentDocument || videoFrame.contentWindow.document;
} catch (e) {
alert("无法访问视频所在的iFrame的内容!可能是跨域问题,请检查!");
return;
}
if (!videoFrameDocument) {
alert("无法访问视频所在的iFrame的内容!");
return;
}
//点击播放按钮
console.log("尝试点击播放按钮...");
const videoPlayButton = videoFrameDocument.querySelector('.vjs-big-play-button');
if (videoPlayButton) {
videoPlayButton.click();
} else {
alert("找不到播放按钮!");
return;
}
//1.2版本重写视频的暂停方法,使其失效
videoPlayer.pause = () => {};
//获取播放进度
console.log("尝试获取视频时长...");
const passedSpan = videoFrameDocument.querySelector(".vjs-current-time-display");
let passedDuration = 0;
if (passedSpan) {
passedDuration = passedSpan.textContent.trim();
} else {
alert("无法获取当前视频播放进度!");
return;
}
console.log("当前播放进度:" + passedDuration);
//获取视频时长,需3s后进行,等待视频加载完毕
let duration = 0;
setTimeout(() => {
console.log("尝试获取视频时长...");
const durationSpan = videoFrameDocument.querySelector(".vjs-duration-display");
if (durationSpan) {
duration = durationSpan.textContent.trim();
} else {
alert("无法获取视频总时长!");
return;
}
console.log("当前视频时长:" + duration);
//视频播放结束后根据传入的id进入下一个视频
let durationMs = timeStringToMs(duration) - timeStringToMs(passedDuration);
console.log("将于" + durationMs + "ms后跳转下一节...");
setTimeout(() => {
//注意脚本运行开关
if (!scriptRunning) {return;}
console.log("视频播放结束,获取下一个id并重新开始函数...");
const currentIndex = classData.findIndex(item => item.id === id);
if (currentIndex === -1) {
alert("传入的id不正确!");
return;
}
if (currentIndex < classData.length - 1) {
getTeacherAjax('254540282','125640414',classData[currentIndex + 1].id);
return;
} else {
alert("这是最后一个视频!恭喜结束刷课!");
return;
}
}, durationMs);
}, 3000);
*/
}
//将获取到的时长换算成毫秒.例如1:20->80000
function timeStringToMs(duration) {
const parts = duration.split(':'); // ["2","47"]
if (parts.length !== 2) {
alert("无法将传入的时长换算成毫秒!传入内容:" + duration);
return;
}
const minutes = parseInt(parts[0], 10);
const seconds = parseInt(parts[1], 10);
return (minutes * 60 + seconds) * 1000;
}
})();
然后点击“文件”->“保存”保存脚本。就像这样:
现在,脚本已经成功地安装在你的浏览器中了。
4.脚本使用教程
打开军事理论课程视频,页面如图所示。(如果安装脚本之前就打开了这个页面的,需要刷新这个页面)
此时打开Tampermonkey的弹出菜单,此时应该是这样的:
此时点击“启动脚本”就可以启动自动刷课脚本了,如果想要停止脚本则点击“停止脚本”。
重要!!!启动脚本后,如果想要关闭课程,一定要先点击“停止脚本”按钮!
当脚本启用时,脚本能够自动播放当前视频,并在视频结束后自动选择下一条视频播放。
注意:请不要在当前视频剩余时长小于10秒时使用此脚本!使用脚本有问题请先检查网络是否足够通畅!
结尾
此脚本的开发工作并不积极,所以更新比较随缘,可能在作者结束军事理论课程后即完全弃坑。如果你有相关知识与能力,你也可以尝试自己或者借助AI的力量修改此脚本。也欢迎将你修改后的脚本在此文下方分享!
AI的贡献对此脚本的影响很大。如果使用过程中有问题,欢迎在此文下方留言!
%%%
哇塞,太好用了吧!!!why真是天才!!!
我可以给你你充电吗?
可以!欢迎充电!🙂