Greasy Fork

Greasy Fork is available in English.

奥鹏教育视频刷课-静音-自动下一课

奥鹏教育视频

当前为 2021-04-15 提交的版本,查看 最新版本

// ==UserScript==
// @name         奥鹏教育视频刷课-静音-自动下一课
// @namespace    http://greasyfork.icu/zh-CN/users/41249-tantiancai
// @version      0.2
// @description  奥鹏教育视频
// @author       tantiancai
// @match        *://learn.open.com.cn/StudentCenter/CourseWare/*
// @grant        none
// ==/UserScript==

(function () {
	'use strict';

	setInterval(function () {
		var videos = document.getElementsByTagName('video')

		for (var i = 0; i < videos.length; i++) {
			var current_video = videos[i]

			//静音
			current_video.volume = 0
			//2倍速
			current_video.playbackRate = 2.0
			if (current_video.paused) {
				current_video.play()
			}
		}

		//视频播放结束后,模拟点击“下一课”
		var qrcode = document.getElementsByClassName("qrcodebox")
		if (qrcode.length > 0 && qrcode[0].style.display == "block") {
			var doc = window.parent.document
			var next_video = doc.getElementsByClassName("progress_btn half_play")
			if (next_video.length > 0) {
				next_video[0].previousSibling.click()
			}
			else {
				next_video = doc.getElementsByClassName("progress_btn not_play")
				if (next_video.length > 0) {
					next_video[0].previousSibling.click()
				}
				else {
					// 结束
				}
			}
		}
	}, 2000)
})();