// ==UserScript== // @name 浙里学习-所有的专题学习脚本 // @namespace http://tampermonkey.net/ // @version 1.9 // @description 本脚本只为了能及时学习相关精神内容,仅供个人学习使用,不得用于其他各类商业用途。 // @author yyyyyywwwwww // @match *://*.zjce.gov.cn/* // @icon https://www.google.com/s2/favicons?sz=64&domain=zxx.edu.cn // @require https://greasyfork.org/scripts/425166-elegant-alert-%E5%BA%93/code/elegant%20alert()%E5%BA%93.js?version=922763 // @require https://scriptcat.org/lib/881/1.2.0/script-statistics.js // @grant GM_getResourceURL // @grant unsafeWindow // @resource ogg http://adventure.land/sounds/loops/empty_loop_for_js_performance.ogg // @resource wav http://adventure.land/sounds/loops/empty_loop_for_js_performance.wav // @grant GM_setValue // @grant GM_getValue // @antifeature tracking // @run-at document-end // @license MIT // ==/UserScript== (function () { 'use strict'; try { new SC_Statistic({ key: "us7vfsrkvod6gffi", }); } catch (e) { console.warn("statistic failed : ", e); } setInterval(() => { const runfref = window.location.href if (runfref.indexOf("https://www.zjce.gov.cn/videos/detail") == '0'||runfref.indexOf("https://www.zjce.gov.cn/class/video")== '0') { //在播放界面 console.log('播放界面') const inte = setInterval(() => { const Video = document.querySelector('video') //添加播放结束的回调 Video.addEventListener("ended", function () { //跳回到上一个界面 console.log("播放结束"); const isover = document.querySelector(".ant-progress-text").innerText if (isover != "") { bofang(Video,inte) } else { history.back() } }, false) bofang(Video,inte) }, 4000) } if (runfref.indexOf("https://www.zjce.gov.cn/specialSubject/detail") == '0') { console.log('在视频列表页面') //查看所有的视频 const alist = document.querySelectorAll(".show_all") const isvideo = document.querySelector('video') if(isvideo != null){ //如果当前界面找到了video,证明跳转失败,重新加载 window.location.reload() } //展开 for (let i = 0; i < alist.length; i++) { alist[i].click() } //获取all video list setTimeout(() => { const videoitem = document.querySelectorAll('.video-item') console.log(videoitem.length) for (let j = 0,k=0; j < videoitem.length; j++) { if (videoitem[j].querySelector('.progerss').innerText != '已学习100%') { k=k+1; videoitem[j].querySelector(".img_style").click() } if(videoitem.length-1==j){ console.log('共计有'+ videoitem.length +'个视频,目前剩余'+(k)+'个') } } }, 2000) } }, 3000) function bofang(Video,inte) { if (Video != '') { //这里设置速率playbackRate代表视频播放速度,最高16倍 Video.playbackRate = 1; Video.play() // Video.volume=0.1 Video.muted = true console.log('冲!!!') clearInterval(inte) } else { console.log('有点问题,2s后继续') } } let ogg = new Audio(GM_getResourceURL("ogg").replace("data:application", "data:audio/ogg")); ogg.loop = true; unsafeWindow.ogg = ogg; let wav = new Audio(GM_getResourceURL("wav").replace("data:application", "data:audio/wav")); wav.loop = true; unsafeWindow.wav = wav; // document.addEventListener("visibilitychange", function () { //document不可见时循环播放空音频 可见时暂停 // document.hidden ? ogg.play() : ogg.pause() //ogg和wav二选一就行 // // console.log("改变") // }) })();