速品大学堂自动播放脚本

自动播放

当前为 2023-02-10 提交的版本,查看 最新版本

// ==UserScript==
// @name         速品大学堂自动播放脚本
// @namespace    https://gitee.com/f1dao
// @version      0.1
// @description  自动播放
// @author       readpage
// @match        https://supertmall.study.moxueyuan.com/**
// @icon         https://supertmall.study.moxueyuan.com/new/public/moxueyuan_icon.png
// @grant        none
// @license      MIT
// ==/UserScript==
const autoplay = ()=> {
    const url = window.location.href;
    if(url.indexOf("/new/course") != -1) {
        let video = document.querySelector('#player_html5_api')
        let timeNow = new Date();
        let hours = timeNow.getHours();
        if (hours >= 8 && hours < 18) {
            let close = document.querySelector('.dialog-footer-cancel.theme-bg-h-hover')
            if (close) {
                close.click()
            }
            if (video) {
                video.play()
            }
        }
    }
}
window.onload = () => {
    setInterval(() => {
       autoplay()
    }, 2000)
}