// ==UserScript== // @name 中国电信网上大学知识中心自动挂课 // @namespace http://tampermonkey.net/ // @version 0.7 // @description 点击知识中心右下加的启动按钮,开启无人值守自动挂课模式! // @author HuangDingYun // @match https://kc.zhixueyun.com/ // @icon https://www.google.com/s2/favicons?sz=64&domain=zhixueyun.com // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js // @grant unsafeWindow // @grant GM_openInTab // @grant GM.openInTab // @grant GM_getValue // @grant GM.getValue // @grant GM_setValue // @grant GM.setValue // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest // @grant GM_registerMenuCommand // @grant GM_addValueChangeListener // @downloadURL https://update.greasyfork.icu/scripts/445895/%E4%B8%AD%E5%9B%BD%E7%94%B5%E4%BF%A1%E7%BD%91%E4%B8%8A%E5%A4%A7%E5%AD%A6%E7%9F%A5%E8%AF%86%E4%B8%AD%E5%BF%83%E8%87%AA%E5%8A%A8%E6%8C%82%E8%AF%BE.user.js // @updateURL https://update.greasyfork.icu/scripts/445895/%E4%B8%AD%E5%9B%BD%E7%94%B5%E4%BF%A1%E7%BD%91%E4%B8%8A%E5%A4%A7%E5%AD%A6%E7%9F%A5%E8%AF%86%E4%B8%AD%E5%BF%83%E8%87%AA%E5%8A%A8%E6%8C%82%E8%AF%BE.meta.js // ==/UserScript== var $ = unsafeWindow.jQuery; var classList = new Array(); var classList1 = new Array(); var nowCount = 0; var divButton = '
自动挂课
'; var mideaButton = '
播放
'; (function() { 'use strict'; setTimeout(function(){ var url=window.location.hash var urlStr=url.toString() //增加页面功能按钮 if(urlStr.match("/study/subject/detail/")){ $("#D60toolbarTab").append(divButton) } //判断是否是课程页面 if($("div.vjs-control-bar").length!=0){ console.log("检测播放进度") isFinished() } },2500); setTimeout(function(){ if($("button.videojs-referse-btn").length!=0){ console.log("开始播放") playMedil() } },4000); // Your code here... })(); unsafeWindow.startAutoClass =function (){ $("div.item.current-hover").each(function(index,element){ if($(this).find("i.icon-reload").length==0 && $(this)[0].firstElementChild.querySelector("span.section-type").innerText == "课程"){ classList1.push($(this).attr("id")) } }) console.log(classList1) if(classList1.length!=0){ openClassPage2(0) }else{ alert("已经完成当前课题下的全部课程!") } } GM_onMessage('_.unique.name.greetings', function(src, message) { console.log('[onMessage]', src, '=>', message); nowCount++; if(nowCount