国家开放大学智能倍速助手 --有问题扫下方二维馬文客服

国家开放大学自动刷课,专业视频加速解决方案,支持快捷键/记忆速度,登陆后进入学习空间“我的课程”自动开始学习 客服V:wkwk796

目前為 2025-03-26 提交的版本,檢視 最新版本

// ==UserScript==
// @name         国家开放大学智能倍速助手 --有问题扫下方二维馬文客服
// @namespace    http://tampermonkey.net/
// @version      2.3.1
// @description  国家开放大学自动刷课,专业视频加速解决方案,支持快捷键/记忆速度,登陆后进入学习空间“我的课程”自动开始学习  客服V:wkwk796
// @author       wkwk796
// @match        *://*.ouchn.cn/*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_registerMenuCommand
// @require      https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css
// @license      MIT
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 配置中心
    const CONFIG = {
        defaultSpeed: GM_getValue('ouchn_speed', 1.5),
        speedSteps: [0.5, 1.0, 1.5, 2.0, 2.5, 3.0],
        hotkeys: {
            speedUp: 'ArrowUp',
            speedDown: 'ArrowDown',
            reset: 'KeyR'
        }
    };

    // 创建专业控制面板
    function createControlPanel() {
        const panel = document.createElement('div');
        panel.id = "ouchn-speed-panel";
        panel.style = `
            position: fixed;
            bottom: 40px;
            right: 30px;
            background: rgba(40, 44, 52, 0.95);
            color: #fff;
            padding: 18px;
            border-radius: 12px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.3);
            z-index: 2147483647;
            font-family: 'Segoe UI', system-ui;
            min-width: 260px;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255,255,255,0.1);
            transition: transform 0.2s ease;
        `;

        // 标题栏(含联系方式)
        const header = document.createElement('div');
        header.innerHTML = `
            <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
                <h2 style="margin: 0; font-weight: 600; color: #58a6ff;">
                    <i class="fas fa-tachometer-alt"></i> 学习加速器
                </h2>
                <div style="font-size: 0.9em; color: #8b949e;">
                    <i class="fas fa-user"></i> wkwk796
                </div>
            </div>
        `;
        panel.appendChild(header);

        // 速度控制区
        const controlSection = document.createElement('div');
        controlSection.style.display = 'grid';
        controlSection.style.gap = '12px';
        controlSection.style.gridTemplateColumns = 'repeat(3, 1fr)';

        // 速度指示器
        const speedDisplay = document.createElement('div');
        speedDisplay.id = "speed-display";
        speedDisplay.style = `
            grid-column: 1 / 4;
            text-align: center;
            font-size: 24px;
            font-weight: bold;
            color: #58a6ff;
            padding: 8px;
            background: rgba(255,255,255,0.1);
            border-radius: 6px;
        `;

        // 控制按钮
        const slowBtn = createControlButton('-', () => adjustSpeed(-0.5));
        const resetBtn = createControlButton('重置', () => resetSpeed());
        const fastBtn = createControlButton('+', () => adjustSpeed(0.5));

        controlSection.append(speedDisplay, slowBtn, resetBtn, fastBtn);
        panel.appendChild(controlSection);

        // 技术支持栏
        const footer = document.createElement('div');
        footer.style.marginTop = '15px';
        footer.style.paddingTop = '12px';
        footer.style.borderTop = '1px solid rgba(255,255,255,0.1)';
        footer.innerHTML = `
            <div style="font-size: 0.85em; color: #8b949e; text-align: center;">
                <div><i class="fas fa-code"></i> 技术支持:wkwk796</div>
                <div style="margin-top: 8px;">
                    <span style="margin-right: 12px;"><i class="fas fa-arrow-up"></i>/<i class="fas fa-arrow-down"></i> 调速</span>
                    <span><i class="fas fa-redo"></i> R键重置</span>
                </div>
            </div>
        `;
        panel.appendChild(footer);

        return panel;
    }

    // 创建风格化按钮
    function createControlButton(text, onClick) {
        const btn = document.createElement('button');
        btn.textContent = text;
        btn.style = `
            padding: 10px 16px;
            background: rgba(88, 166, 255, 0.2);
            border: 1px solid #58a6ff;
            border-radius: 6px;
            color: #58a6ff;
            cursor: pointer;
            transition: all 0.2s;
            font-weight: 500;
        `;
        btn.addEventListener('mouseover', () => {
            btn.style.background = 'rgba(88, 166, 255, 0.4)';
        });
        btn.addEventListener('mouseout', () => {
            btn.style.background = 'rgba(88, 166, 255, 0.2)';
        });
        btn.addEventListener('click', onClick);
        return btn;
    }

    // 核心功能实现
    let currentSpeed = CONFIG.defaultSpeed;
    const speedDisplay = document.createElement('div');

    function updateDisplay() {
        document.getElementById('speed-display').textContent = 
            `${currentSpeed.toFixed(1)}x`;
    }

    function adjustSpeed(step) {
        currentSpeed = Math.max(0.5, Math.min(3.0, currentSpeed + step));
        applySpeed();
        GM_setValue('ouchn_speed', currentSpeed);
        updateDisplay();
    }

    function resetSpeed() {
        currentSpeed = 1.0;
        applySpeed();
        GM_setValue('ouchn_speed', currentSpeed);
        updateDisplay();
    }

    function applySpeed() {
        document.querySelectorAll('video').forEach(video => {
            try {
                video.playbackRate = currentSpeed;
                video.defaultPlaybackRate = currentSpeed;
            } catch(e) {
                console.error('[OUCHN] 速度设置失败:', e);
            }
        });
    }

    // 视频监控系统
    function initVideoObserver() {
        const observer = new MutationObserver(mutations => {
            mutations.forEach(mutation => {
                if ([...mutation.addedNodes].some(n => n.tagName === 'VIDEO')) {
                    applySpeed();
                }
            });
        });
        observer.observe(document.body, { childList: true, subtree: true });
        
        // 定时同步防止漏检
        setInterval(() => {
            document.querySelectorAll('video').forEach(video => {
                if(video.playbackRate !== currentSpeed) {
                    video.playbackRate = currentSpeed;
                }
            });
        }, 3000);
    }

    // 初始化脚本
    function init() {
        const panel = createControlPanel();
        document.body.appendChild(panel);
        initVideoObserver();
        registerHotkeys();
        applySpeed();
        updateDisplay();
    }

    // 快捷键系统
    function registerHotkeys() {
        document.addEventListener('keydown', (e) => {
            if(e.code === CONFIG.hotkeys.speedUp) {
                adjustSpeed(0.5);
                e.preventDefault();
            } else if(e.code === CONFIG.hotkeys.speedDown) {
                adjustSpeed(-0.5);
                e.preventDefault();
            } else if(e.code === CONFIG.hotkeys.reset) {
                resetSpeed();
                e.preventDefault();
            }
        });
    }

    // 启动程序
    if(document.readyState === 'complete') {
        init();
    } else {
        window.addEventListener('load', init);
    }
})();

QingJ © 2025

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