// ==UserScript== // @name FUCK STUDY // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match http://nuaaotp-kfkc.cep.webtrn.cn/learnspace/learn/learn/blue/index.action* // @run-at document-start // @require https://greasyfork.org/scripts/18715-hooks/code/Hooks.js?version=661566 // @grant none // @downloadURL none // ==/UserScript== function autoPlay() { const $ = window.jQuery; const mainContent = document.getElementById("mainContent"); mainContent.addEventListener("load",function(){ const mainFrame = mainContent.contentDocument.getElementById("mainFrame"); mainFrame.addEventListener("load",function(){ //视频重新加载时再执行一次脚本 $("#mainContent").contents().find("#mainFrame").on("load",function(){autoPlay();}); const menus = [...$("#mainContent").contents().find(".vcon").find("li")]; //左侧菜单 const selectMenu = $("#mainContent").contents().find(".vcon").find("li.select")[0]; //当前选中的菜单 const selectMenuIndex = menus.findIndex(e=>e===selectMenu); //当前选中菜单的游标 const nextBtn = $("#mainContent").contents().find(".rtarr")[0]; //标签栏下一个按钮 const tabs = [...$("#mainContent").contents().find(".menub")]; //标签栏 const selectTab = $("#mainContent").contents().find(".menubu")[0]; //当前选中的标签 const selectTabIndex = tabs.findIndex(e=>e===selectTab); //当前选中标签的游标 const studyType = $("#mainContent").contents().find("#mainFrame")[0].contentWindow._maq[11][1]; if(studyType == "video"){ mainFrame.contentDocument.addEventListener("DOMNodeInserted",function(event){ if(event.target.tagName === "VIDEO"){ const video = $("#mainContent").contents().find("#mainFrame").contents().find(".jwvideo").children("video")[0];//播放器 video.addEventListener("playing",function(){ video.volume = 0; video.playbackRate = 1.5; video.addEventListener("ended",function(){ if(tabs.length - selectTabIndex >1){ nextBtn.click(); }else if(menus.length - selectMenuIndex > 1){ menus[selectMenuIndex + 1].click(); $(menus[selectMenuIndex + 1]).find("a").click() } }); }); } }); }else{ if(tabs.length - selectTabIndex >1){ nextBtn.click(); }else if(menus.length - selectMenuIndex > 1){ menus[selectMenuIndex + 1].click(); $(menus[selectMenuIndex + 1]).find("a").click() } } }); }); } (function() { 'use strict'; /** * 关闭30分钟每次的检查 */ Hooks.set(window, "jQuery", function ( target, propertyName, ignored, jQuery ) { Hooks.method(jQuery, "studyTime", function ( target, methodName, method, thisArg, args ) { args[0].clickAuth = false; args[0].periodRemind = false; args[0].randomRemind = false; return Hooks.Reply.method( arguments ); }); return Hooks.Reply.set( arguments ); }); document.addEventListener('DOMContentLoaded',function(){ autoPlay(); }); })();