// ==UserScript== // @name 学达云|陕西省建设类执业师继续教育平台|解除视频暂停限制|如需自动下一集、自动换课程、考试答题等高级功能见收费版本:http://doc.zhanyc.cn/pages/xdy/ // @namespace free // @version 1.0 // @description 当前是免费版本,仅包含解除视频暂停限制功能。如需自动下一集、自动换课程、全自动无人值守等高级功能可升级付费版本。一次付费永久使用!|接各类脚本开发、代挂任务,微信:zhanyc_cn 个人网站:http://doc.zhanyc.cn // @include *://*.ok99ok99.com/* // @grant GM_addStyle // @run-at document-end // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js // ==/UserScript== (function () { let docUrl = "http://doc.zhanyc.cn/pages/xdy/"; let yxm = { pageData: { videoTimer: null, }, init() { console.log("%c yxm init", "background:rgb(0,0,0);color:#fff"); yxm.showFloatPanel(); yxm.runByUrl(location.href); }, runByUrl(url) { if (url.includes("/player2.aspx?")) { yxm.page_video(); } }, page_video() { console.log("%c page_video", "background:rgb(0,0,0);color:#fff"); let timeout = 2; let lastTime = null; let stuckCount = 60; let stuckCountBak = 60; yxm.pageData.videoTimer = setInterval(async () => { try { let video = document.querySelector("video"); if (!video) return; let curTime = video.currentTime; let duration = video.duration; if (curTime == lastTime) { stuckCount -= timeout; if (stuckCount <= 0) { stuckCount = stuckCountBak; video.currentTime = curTime + 1; } } else { lastTime = curTime; stuckCount = stuckCountBak; } let isPlay = await yxm.videoIsPlay(); if (!isPlay) { video.volume = 0; setTimeout(() => { video.play(); }, 200); } yxm.updateProgress(curTime, duration); } catch (e) { console.error("视频监控定时器出错", e); } }, timeout * 1000); }, videoIsPlay() { return new Promise((resolve) => { try { let curTime = $("video")[0].currentTime; setTimeout(() => { let time1 = $("video")[0].currentTime; let res = time1 > curTime; if (res) { setTimeout(() => { let time2 = $("video")[0].currentTime; let res2 = time2 > time1; resolve(res2); }, 100); } else { return resolve(false); } }, 100); } catch (e) { resolve(false); } }); }, updateProgress(curTime, duration) { if (duration > 0) { let pct = ((curTime / duration) * 100).toFixed(1); $("#yxmProgressText").text(`${curTime.toFixed(0)}s / ${duration.toFixed(0)}s`); $("#yxmProgressBar").css("width", pct + "%"); $("#yxmProgressPct").text(pct + "%"); } }, showFloatPanel() { let panelHtml = `
学达云 - 免费版 ×
▶ 视频播放监控中...
播放进度:等待视频加载...
0%
免费版功能:解除视频暂停限制
付费版功能:
  ✓ 自动下一集 / 自动换课程
  ✓ 图片过人脸识别
  ✓ 微信扫码提醒
  ✓ 全自动无人值守
点击升级付费版本(一次付费,永久使用,免费维护)
接各类脚本开发、代挂任务
微信:zhanyc_cn
`; GM_addStyle(` #yxmFloatPanel{position:fixed;left:10px;top:10px;z-index:2147483647;background:linear-gradient(145deg,rgba(100,45,210,0.95),rgba(75,25,180,0.95));border:1px solid rgba(255,255,255,0.22);border-radius:10px;box-shadow:0 8px 32px rgba(55,10,150,0.55);padding:10px 14px;min-width:240px;max-width:300px;font-size:14px;color:#fff;font-family:microsoft yahei,sans-serif;} #yxmFloatTitle{font-weight:bold;font-size:14px;padding-bottom:6px;margin-bottom:6px;border-bottom:1px solid rgba(255,255,255,0.2);cursor:move;user-select:none;display:flex;justify-content:space-between;align-items:center;} #yxmFloatClose:hover{color:#ff6666;} `); $("body").append(panelHtml); $("#yxmFloatClose").on("click", function () { $("#yxmFloatPanel").remove(); }); // 拖动功能 let $box = $("#yxmFloatPanel"); let $handle = $("#yxmFloatTitle"); let isDragging = false; let startX, startY, origLeft, origTop; $handle.on("mousedown", function (e) { if (e.target.id === "yxmFloatClose") return; isDragging = true; startX = e.clientX; startY = e.clientY; let boxRect = $box[0].getBoundingClientRect(); origLeft = boxRect.left; origTop = boxRect.top; e.preventDefault(); }); $(document).on("mousemove.yxmFloat", function (e) { if (!isDragging) return; let dx = e.clientX - startX; let dy = e.clientY - startY; $box.css({ left: origLeft + dx + "px", top: origTop + dy + "px" }); }); $(document).on("mouseup.yxmFloat", function () { isDragging = false; }); }, }; setTimeout(() => { if (typeof (zfk) == 'undefined') { yxm.init(); } else { console.log('skip init - 付费版本已在运行'); } }, 3000); })();