Greasy Fork is available in English.
学习通
当前为
// ==UserScript==
// @name 学习通自动脚本
// @namespace http://tampermonkey.net/
// @version 1.2.1
// @description 学习通
// @author You
// @match *://*.chaoxing.com/*
// @connect cx.icodef.com
// @connect s.jiaoyu139.com
// @run-at document-end
// @grant unsafeWindow
// @grant GM_addStyle
// @grant GM_getResourceText
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @require https://lib.baomitu.com/jquery/2.0.0/jquery.min.js
// @license MIT
// ==/UserScript==
var i=localStorage.getItem('i')||0;
var classes =document.getElementsByClassName('posCatalog_name');
var v,v_done = 0;
var videoNum
function main() {
v=undefined
window.unitCount = $(".ncells h4").index($(".currents")) + 1;
window.unit = $(".ncells h4").length;
const frameObj = $("iframe").eq(0).contents().find("iframe.ans-insertvideo-online");
videoNum = frameObj.length;
if (videoNum > 0) {
var playDoneEvent = new Event("playdone");
v = frameObj.contents().eq(v_done).find("video#video_html5_api").get(v_done);
console.log(v)
window.a = v;
v.play();
v.muted=true;
v.playbackRate=2
window.inter = setInterval(() => {
v = window.a;
if (v.currentTime >= v.duration) {
dispatchEvent(playDoneEvent);
clearInterval(window.inter);
}
if (v.paused&&!v.ended) {
v.play();
v.playbackRate=2
}
}, 1000);
}
}
function vended(){
main()
setInterval(function (){
console.log(v.ended,i)
if (v.ended) {
if(videoNum===1){
i=parseInt(i)+1
console.log(i+'iuiu')
localStorage.setItem('i',i)
classes[i].click()
setTimeout(function (){
main()
if(!document.getElementById('btn1')){
btn()
}
},3000)
}else{
v_done++;
main()
}
}
},500)
}
function btn(){
var button = document.createElement("button"); //创建一个按钮
button.id="btn1"
button.textContent = "点击开始"; //按钮内容
button.style.width = "90px"; //按钮宽度
button.style.height = "28px"; //按钮高度
button.style.align = "center"; //文本居中
button.style.color = "white"; //按钮文字颜色
button.style.background = "#e33e33"; //按钮底色
button.style.border = "1px solid #e33e33"; //边框属性
button.style.borderRadius = "4px"; //按钮四个角弧度
button.addEventListener("click", clickBotton) //监听按钮点击事件
var like_comment = document.getElementsByClassName('prev_title_pos')[0]; //getElementsByClassName 返回的是数组,所以要用[] 下标
like_comment.appendChild(button);
function clickBotton(){
vended()
}
}
(function f(){
setTimeout(function (){
window.addEventListener('click',function (e){
for (var k=0;k<classes.length;k++){
if (e.target.title===classes[k].title){
console.log(k,'=+++')
localStorage.setItem('i',(k).toString())
i=parseInt(localStorage.getItem('i'))
console.log(i,'----=')
}
}
setTimeout(function (){
main()
if(!document.getElementById('btn1')){
btn()
}
},2000)
vended()
})
},1000)
setTimeout(function (){
btn()
},2000)
classes[i].click()
vended()
})()