国家智慧教育公共服务平台|职业教育|高等教育|教师能力提升中心|寒暑假教师研修专题|自动答题播放|自动挂机

选择课程点进去,全自动操作,只需要选择你要学习的课程即可,会自动播放,自动答题,答题会自动选择第一个,答题对不对不知道(没做题库),反正只会选择第一个。

// ==UserScript==
// @name         国家智慧教育公共服务平台|职业教育|高等教育|教师能力提升中心|寒暑假教师研修专题|自动答题播放|自动挂机
// @namespace    自动答题
// @license      CC BY-NC-SA
// @version      2024.2.04.2202
// @description  选择课程点进去,全自动操作,只需要选择你要学习的课程即可,会自动播放,自动答题,答题会自动选择第一个,答题对不对不知道(没做题库),反正只会选择第一个。
// @author       aluyunjie【bug反馈+V:aluyunjiesmile】
// @match        https://core.teacher.vocational.smartedu.cn/p/course/*
// @match        https://teacher.vocational.smartedu.cn/h/subject/winter2024/
// @match        https://teacher.higher.smartedu.cn/h/subject/*
// @icon         https://teacher.vocational.smartedu.cn/favicon.ico
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==


//配置高等教育观看的视频的链接
var heighterLinks = [
	//思想铸魂
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_726987629091446784?itemId=726641870617784320&type=1&segId=726641816054083584&projectId=725191327228612608&orgId=608196190709395456&originP=1&service=https%3A%2F%2Fteacher.higher.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//固本强基
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_726987629116612608?itemId=726641973097213952&type=1&segId=726641920563556352&projectId=725191327228612608&orgId=608196190709395456&originP=1&service=https%3A%2F%2Fteacher.higher.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//以案促学
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_726987629129195520?itemId=726642071551070208&type=1&segId=726642024438136832&projectId=725191327228612608&orgId=608196190709395456&originP=1&service=https%3A%2F%2Fteacher.higher.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//数字素养提升
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_742239030662164480?itemId=742246596144865280&type=1&segId=742246596136476672&projectId=725191327228612608&orgId=608196190709395456&originP=1&service=https%3A%2F%2Fteacher.higher.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//综合育人能力提升
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_742239030691524608?itemId=742246596178419712&type=1&segId=742246596170031104&projectId=725191327228612608&orgId=608196190709395456&originP=1&service=https%3A%2F%2Fteacher.higher.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//科学素养提升
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_742239030716690432?itemId=742246596228751360&type=1&segId=742246596216168448&projectId=725191327228612608&orgId=608196190709395456&originP=1&service=https%3A%2F%2Fteacher.higher.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//培养高校创新性教师队伍
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_742239030733467648?itemId=742246596270694400&type=1&segId=742246596258111488&projectId=725191327228612608&orgId=608196190709395456&originP=1&service=https%3A%2F%2Fteacher.higher.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F"
];

var vocationalLinks=[
	//思想铸魂
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_726988209004306432?itemId=726640775149465600&type=1&segId=726640509203873792&projectId=725189097005613056&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//固本强基
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_726988209021083648?itemId=726641217988276224&type=1&segId=726640852905795584&projectId=725189097005613056&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//以案促学
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_726988209033666560?itemId=726641262505066496&type=1&segId=726640936993202176&projectId=725189097005613056&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//数字素养提升
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_742238772369383424?itemId=742245601297899520&type=1&segId=742245601276928000&projectId=725189097005613056&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//综合育人能力提升
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_742238772390354944?itemId=742245601365008384&type=1&segId=742245601344036864&projectId=725189097005613056&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//科学素养提升
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_742238772415520768?itemId=742245601427922944&type=1&segId=742245601411145728&projectId=725189097005613056&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F",
	//匠人
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_742238772436492288?itemId=742245601503420416&type=1&segId=742245601486643200&projectId=725189097005613056&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fteaching%2F"
];
var hjvocationalLinks=[
	//弘扬教育家精神 勇担强国建设使命
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_810687506358689792?itemId=810695433572364288&type=1&segId=810695391683747840&projectId=809934130863316992&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fwinter2024%2F",
	//关爱教师 提升从教幸福感
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_810687506375467008?itemId=810695327879995392&type=1&segId=810695273791655936&projectId=809934130863316992&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fwinter2024%2F",
	//造良匠之师 育大国工匠
	"https://core.teacher.vocational.smartedu.cn/p/course/vocational/v_810687506388049920?itemId=810695130450014208&type=1&segId=810695081688338432&projectId=809934130863316992&orgId=571896669159477248&originP=2&service=https%3A%2F%2Fteacher.vocational.smartedu.cn%2Fh%2Fsubject%2Fwinter2024%2F"
]


//暑假学时配置
var sjstudyTimes = [3, 1, 1, 1, 2, 1, 3];
//寒假学时配置
var hjstudyTimes =[9,3,3];

(function() {
	'use strict';

	// 获取当前网址
	var currentURL = window.location.href;
	//判断当前网址是否包含指定字符串
	if (currentURL.includes('https://teacher.vocational.smartedu.cn/h/subject/winter2024/')) {
		createLogBox();
		addTextToLogBox("脚本加载成功!");
		addTextToLogBox("有bug请反馈:微信:aluyunjiesmile");
		addTextToLogBox('职教脚本更新于2024-02-04');
		addTextToLogBox("开始执行")

		setTimeout(function(){
			//全局数组下标
			let index = 0;
			GM_setValue("下标", index);
			GM_setValue("类别","职业");
			openNewWindow(hjvocationalLinks[index]);
		},5000)

	}

	if(currentURL.includes("https://teacher.higher.smartedu.cn/h/subject/teaching/")){
		createLogBox();
		addTextToLogBox("脚本加载成功!");
		addTextToLogBox("有bug请反馈:微信:aluyunjiesmile");
		addTextToLogBox('高教研修脚本更新于2023-08-04');
		addTextToLogBox("开始执行")

		setTimeout(function(){
			//全局数组下标
			let index = 0;
			GM_setValue("下标", index);
			GM_setValue("类别","高校");
			openNewWindow(heighterLinks[index]);
		},5000)

	}


	if(currentURL.includes("https://core.teacher.vocational.smartedu.cn/p/course/vocational")){
		createLogBox();
		setInterval(PagePlayingTimer,5000);
	}




})();


// 在新窗口中打开一个网页
function openNewWindow(url) {
	window.open(url, "_blank");
}


function jugePlayingPageIsDoneAndSwepNextPlayPage(){
	var percentHound = 0;
	var lenth = document.getElementsByClassName('four').length;
	var GMindex = GM_getValue("下标");

	//setp01 判断视频播放页面有多少已经到达100%的
	for (var i = 0; i < lenth; i++) {
		var text = document.getElementsByClassName('four')[i].textContent;
		if(text === '100%'){
			percentHound++ ;
		}
	}

	//step02 从油猴脚本中取出对应下标的对应学时
	var studyedtimes = hjstudyTimes[GMindex];
	//stp03进行判断
	if(parseInt(percentHound)>= parseInt(studyedtimes)){
		var GMindex2 = GM_getValue("下标");
		let index = ++GMindex2;
		addTextToLogBox(index);
		GM_setValue("下标", index);
		var leibei =  GM_getValue("类别");
		if(leibei === "高校"){
			window.location.href =  heighterLinks[index];
		}else{
			window.location.href =  hjvocationalLinks[index];
		}

	}else{
		addTextToLogBox("当前任务暂未完成课时,等待继续完成")
	}

}




//日志函数
function addTextToLogBox(TextLog) {
	// 获取目标 <div> 元素
	var targetDiv = document.getElementById('logBox'); // 替换为你的目标 <div> 元素的 ID
	targetDiv.appendChild(document.createElement('br'));
	// 创建文本节点
	var textNode = document.createTextNode(TextLog);

	// 添加文本节点到目标 <div> 元素
	targetDiv.appendChild(textNode);
	targetDiv.scrollTop = targetDiv.scrollHeight;
}

//创建日志框
function createLogBox() {
	var logBox = document.createElement('div');
	logBox.id = 'logBox';
	logBox.style.position = 'fixed';
	logBox.style.bottom = '0';
	logBox.style.left = '0';
	logBox.style.width = '200px';
	logBox.style.height = '200px';
	logBox.style.backgroundColor = 'black'; // 更改背景颜色为黑色
	logBox.style.color = 'green'; // 更改文本颜色为绿色
	logBox.style.overflow = 'auto';
	logBox.style.padding = '10px';
	logBox.style.fontFamily = 'Arial, sans-serif';
	logBox.style.whiteSpace = 'pre-wrap';
	document.body.appendChild(logBox);
}


function PagePlayingTimer() {

	jugePlayingPageIsDoneAndSwepNextPlayPage();
	//检测题目以及做单选题
	var shiFouYouTi = document.querySelector("#modal > div > div > div.question-header > div > h4")
	if (shiFouYouTi == null) {
		console.log("题目检测中。。。检测无题!")
		addTextToLogBox('题目检测中。。。检测无题!');
		document.querySelector("#video-Player > video").play();

		var video = document.querySelector("video");
		if (video === null) {

		} else {
			video.playbackRate = 1.0;
		}

	} else {

		var text = shiFouYouTi.textContent
		if (text == '课堂练习') {
			console.log("检测有题,正在做题")
			addTextToLogBox('检测有题,正在做题');
			var danXuanDuoXuan = document.querySelector(
				"#modal > div > div > div.question-body > div.question-title > span").textContent

			//题型
			if (danXuanDuoXuan == '【单选题】') {
				document.querySelector("#modal > div > div > div.question-body > ul > li:nth-child(1)").click()

				//答完题实现点击
				setTimeout(clickQueDingAnNiu(), 1000)



				setTimeout(clickQueDingAnNiu(), 1000)
			}

			if (danXuanDuoXuan == '【是非题】') {
				document.querySelector("#modal > div > div > div.question-body > ul > li:nth-child(1)").click()

				//答完题实现点击
				setTimeout(clickQueDingAnNiu(), 1000)



				setTimeout(clickQueDingAnNiu(), 1000)
			}
			if (danXuanDuoXuan == '【多选题】') {
				document.querySelector("#modal > div > div > div.question-body > ul > li:nth-child(1)").click()
				document.querySelector("#modal > div > div > div.question-body > ul > li:nth-child(2)").click()
				//答完题实现点击
				setTimeout(clickQueDingAnNiu(), 1000)

				setTimeout(clickQueDingAnNiu(), 1000)

			}

		}
	}


	//点击确定按钮
	for (var i = 0; i <= 50; i++) {
		var querySelectors = "#layui-layer" + i + " div.layui-layer-btn > a"
		var dianjiqueding = document.querySelector(querySelectors)
		if (dianjiqueding == null) {
			console.log("没找到确定按钮的button")
			continue;
		} else {
			//点击确定按钮
			dianjiqueding.click()

			setTimeout(playVideodianjianniu(), 1500)
		}
	}



}


function clickQueDingAnNiu() {
	document.querySelector("#submit").click()
}

function playVideodianjianniu() {
	//播放器点击播放按钮
	document.querySelector("#video-Player > xg-start > div.xgplayer-icon-play").click()
}