福大长江雨课堂自用,无答题
当前为
// ==UserScript==
// @name 福大长江雨课堂自用
// @namespace http://tmpermonkey.net/
// @version 0.4
// @description 福大长江雨课堂自用,无答题
// @author alep
// @match *://*.yuketang.cn/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @grant GM_getResourceText
// @run-at document-end
// @license MIT
// ==/UserScript==
(function() {
'use strict';
function goNextVideo(){
var url = window.location.href;
var newVideoId = parseInt(/video\/([0-9]+)$/.exec(url)[1]) + 1;
var newUrl = url.replace(/video\/[0-9]+$/,"video/" + newVideoId);
window.location.href = newUrl;
}
function main(){
var progress = 'null';
try{
var video_elem = document.querySelector("video");
if(video_elem != null){
video_elem.muted = true;
video_elem.play();
video_elem.playbackRate = 2.0;
//document.querySelector(".xt_video_player_speed").click();
var speed = document.querySelector(".xt_video_player_common_list");
var speedChild = speed.firstChild;
speedChild.click();
}
}catch(e){
console.log(e);
}
try{
progress = document.querySelectorAll('span.text')[1].textContent.split(":")[1];
}catch(e){
console.log('读取时出错,查看是否为video');
var elem= document.querySelector('span.text');
if(!elem.textContent.match('Video')){
goNextVideo();
return;
}
}
try{
document.querySelector('div.title-fl:first-child').innerText = '脚本检测到进度:' + progress;
if(progress == '100%'){
goNextVideo();
return;
}
setTimeout(main, 1000);
}catch(e){
console.log('读取时出错,尝试重试');
location.reload();
setTimeout(main, 5000);
}
}
var url = window.location.href;
if (url.match("/video")){
if (window.onurlchange === null) {
window.addEventListener("urlchange", () => {
setTimeout(main, 2000);
});
}
setTimeout(main, 2000);
}
// Your code here...
})();