// ==UserScript== // @name 研修网自动挂机 // @namespace http://tampermonkey.net/ // @version 0.0.1 // @description 自动看课程 // @author ZSJ // @match https://ipx.yanxiu.com/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant unsafeWindow // @license none // @downloadURL none // ==/UserScript== (function() { 'use strict'; function Pd(){ if(document.URL.search('grain')>1){kk();} if(document.URL.search('train')>1){xk();} } function sx(){window.location.reload()} function close(){window.close();} function xk(){ alert("脚本开始运行"); var xmms=document.querySelectorAll(".inner") for (let span of xmms){ if(span.querySelector(".learn-btn>button>span").textContent=="看课"){ setTimeout(sx,600000); clearInterval(Pds); span.querySelector(".learn-btn>button").click(); break; }else if(span.querySelector(".learn-status>span").textContent!="已观看 100%" ){ setTimeout(sx,600000); clearInterval(Pds); span.querySelector(".learn-btn>button").click(); break; } } } function kk(){ if(document.getElementsByClassName('rate-item').length==10){ if(document.getElementsByClassName('scoring-wrapper')[0].style[0]!==undefined){//!==,评分显示出来为空,==没显示出来了 document.getElementsByClassName('rate-icon icon-img-default')[0].click(); document.getElementsByClassName('ivu-btn ivu-btn-primary')[0].click(); } } if(document.getElementsByClassName('text').length!=0){ document.getElementsByClassName('text')[0].click()//点我继续计时 } if(document.getElementsByTagName('video').length==1){//是视频,不是文档 document.getElementsByTagName('video')[0].volume=0; //document.getElementsByTagName('video')[0].play; if(document.getElementsByClassName('ended-mask')[0].style[0]==undefined){ document.getElementsByClassName('next')[0].click(); } }else {close();} //如果是文档,就找到有视频为止 if (kks){ kks=false; setInterval(close,600000); } } var kks=true; var Pds=setInterval(Pd,3000); })();