自动播放传智播客课程视频, 开发者博客:http://www.nothamor.cn
当前为
// ==UserScript==
// @name 传智自动播放视频
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 自动播放传智播客课程视频, 开发者博客:http://www.nothamor.cn
// @author nothamor
// @match *.ityxb.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
setTimeout(function() {
console.log("自动播放视频脚本已开始工作, 开发者博客:https://www.nothamor.cn");
const CLASS_LIST = document.getElementsByClassName("point-progress-box");
const CLASS_NAME = document.getElementsByClassName("point-text ellipsis");
let player = document.getElementsByTagName("video")[0].id;
document.getElementById(player).click();
let counter = 0;
const TIMER = setInterval(function () {
let percent = CLASS_LIST[counter].innerHTML.replace(/\ +/g, "").replace(/[\r\n]/g, "");
let title_name = CLASS_NAME[counter].innerHTML.replace(/\ +/g, "").replace(/[\r\n]/g, "");
if (percent.includes("100%") && counter == (CLASS_LIST.length - 1)) {
clearInterval(TIMER);
alert("当前页所有视频均已播放完成");
} else if (percent.includes("100%")) {
CLASS_LIST[counter + 1].click();
player = document.getElementsByTagName("video")[0].id;
document.getElementById(player).click();
console.log("已切换视频");
counter++;
}
if (title_name.includes("习题")) {
const audio = new Audio("http://dict.youdao.com/dictvoice?audio=city");
audio.play();
}
}, 1000);
}, 5000);
})();