// ==UserScript== // @name 良师在线课程自动播放与倍速脚本 // @namespace aaaaaaazzzzzccccc // @version 1.0 // @description 自动检测并点击下一课按钮,若无则16倍速播放视频 // @author cxs // @match https://*.ls365.net/* // @grant none // ==/UserScript== (function() { 'use strict'; function isElementVisible(element) { return element && element.offsetWidth > 0 && element.offsetHeight > 0 && getComputedStyle(element).display !== 'none' && getComputedStyle(element).visibility !== 'hidden'; } function mainLoop() { const nextSection = document.querySelector("#learnNextSection"); if (isElementVisible(nextSection)) { nextSection.click(); console.log("检测到下一课按钮,已点击"); } else { const video = document.querySelector('video'); if (video) { video.playbackRate = 16; console.log("未检测到下一课按钮,已设置16倍速"); } } } console.log("脚本已加载"); const intervalId = setInterval(mainLoop, 1000); window.addEventListener('unload', function() { clearInterval(intervalId); }); })();