// ==UserScript== // @name (完全免费)日照、淄博、临沂、枣庄、德州、滨州、泰安、济宁公需播放助手(基础版) // @namespace http://tampermonkey.net/ // @version 1.0 // @description 视频进度 100% 自动切换,控制面板显示播放信息 // @author qqqqqc. // @match http://*.gxk.yxlearning.com/learning/* // @match http://*.zyk.yxlearning.com/learning/* // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @run-at document-idle // ==/UserScript== (function() { 'use strict'; // 配置参数 const config = { panelPosition: GM_getValue('panelPosition', { x: 20, y: 20 }), autoPlayNext: GM_getValue('autoPlayNext', true), checkInterval: 2000 }; // 创建控制面板元素 const panel = document.createElement('div'); panel.id = 'videoControlPanel'; const panelHeader = document.createElement('div'); panelHeader.id = 'videoControlPanelHeader'; panelHeader.innerHTML = ` 视频播放控制面板 `; const panelContent = document.createElement('div'); panelContent.id = 'videoControlPanelContent'; panelContent.innerHTML = `

脚本信息

本脚本为基础版,仅支持自动连播功能。

高级版可以自动进行中间题目的正确作答。

此脚本仅供各位认真听讲记笔记时不用手动去点击下一集使用,绝无他用,请认真做好笔记认真好好学习。

联系微信:zywk08

当前视频: 未检测到

下一视频: 未检测到

播放进度: 0%

`; panel.appendChild(panelHeader); panel.appendChild(panelContent); document.body.appendChild(panel); // 添加拖动功能 let isDragging = false; let offsetX, offsetY; panelHeader.addEventListener('mousedown', function(e) { if (e.target.id === 'panelCloseBtn') return; isDragging = true; offsetX = e.clientX - panel.getBoundingClientRect().left; offsetY = e.clientY - panel.getBoundingClientRect().top; panel.style.cursor = 'grabbing'; panel.style.boxShadow = '0 8px 24px rgba(0, 0, 0, 0.2)'; e.preventDefault(); }); document.addEventListener('mousemove', function(e) { if (!isDragging) return; const x = e.clientX - offsetX; const y = e.clientY - offsetY; panel.style.left = x + 'px'; panel.style.top = y + 'px'; config.panelPosition = { x, y }; GM_setValue('panelPosition', config.panelPosition); }); document.addEventListener('mouseup', function() { if (!isDragging) return; isDragging = false; panel.style.cursor = 'move'; panel.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.15)'; }); // 关闭按钮事件 document.getElementById('panelCloseBtn').addEventListener('click', function() { panel.style.display = 'none'; }); // 获取视频列表 function getVideoList() { return Array.from(document.querySelectorAll('li.videoLi')).map(item => { const title = item.getAttribute('data-original-title') || item.querySelector('.video-info').textContent.trim(); const progressText = item.querySelector('.badge').textContent; const progress = parseInt(progressText) || 0; const isActive = item.classList.contains('active'); return { element: item, id: item.id, title: title, progress: progress, isActive: isActive }; }); } // 更新视频状态显示 function updateVideoStatus() { const videoList = getVideoList(); const currentVideo = videoList.find(video => video.isActive); let nextVideo = null; if (currentVideo) { const currentIndex = videoList.findIndex(video => video.isActive); if (currentIndex !== -1 && currentIndex < videoList.length - 1) { nextVideo = videoList[currentIndex + 1]; } } document.getElementById('currentVideoTitle').textContent = currentVideo ? currentVideo.title : '未检测到'; document.getElementById('nextVideoTitle').textContent = nextVideo ? nextVideo.title : '无'; document.getElementById('videoProgress').textContent = currentVideo ? currentVideo.progress + '%' : '0%'; } // 自动播放下一集 function autoPlayNextVideo() { const videoList = getVideoList(); const currentVideo = videoList.find(video => video.isActive); if (currentVideo && currentVideo.progress >= 100) { const currentIndex = videoList.findIndex(video => video.isActive); if (currentIndex !== -1 && currentIndex < videoList.length - 1) { const nextVideo = videoList[currentIndex + 1]; nextVideo.element.click(); } } } // 添加 CSS 样式 GM_addStyle(` #videoControlPanel { position: fixed; top: ${config.panelPosition.y}px; left: ${config.panelPosition.x}px; width: 300px; background-color: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px); border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 12px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12); z-index: 2147483647; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; } #videoControlPanelHeader { padding: 14px 18px; background-color: #1890ff; color: white; border-bottom: 1px solid rgba(255, 255, 255, 0.2); font-weight: 600; font-size: 17px; cursor: move; user-select: none; border-radius: 8px 8px 0 0; display: flex; justify-content: space-between; align-items: center; } #videoControlPanelContent { padding: 18px; } #scriptInfo { margin-bottom: 20px; line-height: 1.6; font-size: 14px; color: #555; background-color: #f7f7f7; padding: 12px; border-radius: 8px; border-left: 4px solid #1890ff; } #scriptInfo h3 { margin-top: 0; margin-bottom: 10px; font-size: 16px; color: #1890ff; } #videoStatus { margin-bottom: 20px; line-height: 1.6; } #controlButtons { display: flex; gap: 10px; } button { padding: 8px 16px; background-color: #1890ff; color: white; border: none; border-radius: 6px; cursor: pointer; } button:hover { background-color: #40a9ff; } #panelCloseBtn { background: none; border: none; color: white; cursor: pointer; font-size: 20px; padding: 0 0 0 10px; } `); // 初始化函数 function init() { updateVideoStatus(); setInterval(() => { updateVideoStatus(); if (config.autoPlayNext) { autoPlayNextVideo(); } }, config.checkInterval); document.getElementById('playNextBtn').addEventListener('click', () => { const videoList = getVideoList(); const currentVideo = videoList.find(video => video.isActive); if (currentVideo) { const currentIndex = videoList.findIndex(video => video.isActive); if (currentIndex !== -1 && currentIndex < videoList.length - 1) { const nextVideo = videoList[currentIndex + 1]; nextVideo.element.click(); } } }); document.getElementById('refreshBtn').addEventListener('click', updateVideoStatus); const autoPlayToggle = document.createElement('input'); autoPlayToggle.type = 'checkbox'; autoPlayToggle.id = 'autoPlayToggle'; autoPlayToggle.checked = config.autoPlayNext; panelContent.appendChild(autoPlayToggle); const autoPlayLabel = document.createElement('label'); autoPlayLabel.htmlFor = 'autoPlayToggle'; autoPlayLabel.textContent = '自动播放下一集'; panelContent.appendChild(autoPlayLabel); autoPlayToggle.addEventListener('change', function() { config.autoPlayNext = this.checked; GM_setValue('autoPlayNext', config.autoPlayNext); }); } init(); })();