🔥🔥贵州省专业技术人员继续教育平台终极版刷课脚本|10倍速刷课时脚本|自动跳过已完成的视频|解除防挂机提示|静音播放|超稳定

贵州省专业技术人员继续教育全自动刷课时脚本

// ==UserScript==
// @name        🔥🔥贵州省专业技术人员继续教育平台终极版刷课脚本|10倍速刷课时脚本|自动跳过已完成的视频|解除防挂机提示|静音播放|超稳定
// @namespace   🔥🔥自动跳过已经学完的视频,自动点击防挂机提示,直至刷完课程,全程自动化。
// @match       http://www.gzjxjy.gzsrs.cn/*
// @match       https://www.gzjxjy.gzsrs.cn/*
// @version     1.1
// @author      Be brave
// @license     
// @description 贵州省专业技术人员继续教育全自动刷课时脚本
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    //window.onload = function(){//所有DOM元素加载完成后执行

    let videoIndex = 0; 
    
    //播放视频,添加倍数,破解防挂机提示
    function playVideo() {
        let videoTitles = document.querySelectorAll('.step-title');
        if (videoTitles.length > 0 && videoIndex < videoTitles.length) {
			if (!videoTitles[videoIndex].nextSibling.className){
				videoTitles[videoIndex].click();
			}
			else{
				if (videoIndex < videoTitles.length){
					videoIndex += 1;
					playVideo();
				}
				else {
					videoIndex = 0;
                    playVideo();
				}
			}
            setTimeout(function() {
                let videos = document.getElementsByTagName('video');
                for (let i = 0; i < videos.length; i++) {
                    videos[i].playbackRate = 10; 
                    videos[i].onended = function() {
                        videoIndex += 1;
                        if (videoIndex < videoTitles.length) {
                            playVideo();
                        } else {
                            videoIndex = 0;
                            playVideo();
                        }
                    }
                    if (videos[i].paused) {
                        videos[i].play();
                    }
                }
            }, 2000);

			setTimeout(function(){
				let isButton = document.getElementsByClassName("el-dialog__wrapper");
				if (isButton[0]){
					isButton[0].getElementsByTagName("button")[0].click();
				}
			},2000)

        }
    }

    //添加视频控件
    let observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.type === 'childList') {
                var videos = document.getElementsByTagName('video');
                for (var i = 0; i < videos.length; i++) {
                    var video = videos[i];
                    video.setAttribute('autoplay', true);
                    video.setAttribute('muted', true); 
                    video.muted = true;
                    video.addEventListener('visibilitychange', function() {
                        if (document.visibilityState === 'hidden') {
                            video.play();
                        }
                    }, false);
                }
            }
        });
    });

    observer.observe(document, { childList: true, subtree: true });
    //2秒后执行
    setTimeout(playVideo, 2000);
//}
})();