// ==UserScript== // @name 浙里学习-二十大专题 // @namespace http://tampermonkey.net/ // @version 0.4 // @description 可倍速播放浙里学习视频 // @author sunsikai // @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 // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; //定时器1,检测当前界面是哪个界面,然后执行相应的代码 setInterval(() => { const runfref = window.location.href if (runfref.indexOf("https://www.zjce.gov.cn/videos/detail") == '0') { //在播放界面 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") for (let i = 0; i < 3; i++) { console.log('点击一次') alist[i].click() } setTimeout(() => { const videoitem = document.querySelectorAll('.video-item') console.log(videoitem.length) for (let j = 0; j < videoitem.length; j++) { if (videoitem[j].querySelector('.progerss').innerText != '已学习100%') { videoitem[j].querySelector(".img_style").click() } } }, 2000) } }, 5000) function bofang(Video,inte) { if (Video != '') { //这里设置速率playbackRate代表视频播放速度,最高16倍 Video.playbackRate = 1; Video.play() Video.muted = true console.log('冲!!!') clearInterval(inte) } else { console.log('有点问题,2s后继续') } } })();