自动化课程播放脚本

自动完成课程播放

// ==UserScript==
// @name         自动化课程播放脚本
// @namespace    https://gf.qytechs.cn/zh-CN/users/1063320-%E7%AC%94%E5%A2%A8%E7%BA%B8%E7%A0%9A
// @version      0.1
// @description  自动完成课程播放
// @author       笔墨纸砚
// @match        https://www.sxjkaqjypx.com:88/#/*
// @license       MIT
// ==/UserScript==

(function() {
    'use strict';

    // 检测课程列表并打开多个未完成的课程详情
    function checkCourses() {
        var buttons = Array.from(document.querySelectorAll('.ant-btn.ant-btn-primary')); // 选择所有可能的按钮
        var studyButtons = buttons.filter(btn => btn.textContent.trim() === '去学习'); // 找到所有文本为“去学习”的按钮

        for (let i = 0; i < Math.min(studyButtons.length, 5); i++) {
            window.open(studyButtons[i].href, '_blank'); // 在新标签页中打开链接
        }
    }

    // 在课程详细页面设置视频播放速度并监听播放结束
    function setupVideoPlayback() {
        var video = document.querySelector('video'); // 假设视频元素是video标签
        if (video) {
            video.playbackRate = 2.0; // 设置播放速度,这里假设为2倍速
            video.addEventListener('ended', function() {
                window.close(); // 视频结束后关闭当前标签页
            });
            video.play(); // 开始播放
        }
    }

    // 根据当前页面决定执行哪个函数
    if (window.location.href.includes('/courseDetail')) {
        checkCourses();
    } else if (window.location.href.includes('/courseInfoDetail')) {
        setupVideoPlayback();
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址