Greasy Fork

Greasy Fork is available in English.

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

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

目前为 2023-07-16 提交的版本,查看 最新版本

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


//日志函数
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 zhouqizhixing(){
	
	//检测题目以及做单选题
	var shiFouYouTi = document.querySelector("#modal > div > div > div.question-header > div > h4")
	if(shiFouYouTi == null){
	    console.log("题目检测中。。。检测无题!")
		addTextToLogBox('题目检测中。。。检测无题!');
	}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")
			addTextToLogBox('没找到确定按钮的button,继续播放');
			
	    }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()
    }


(function() {
    'use strict';

	createLogBox();
	
	// 获取当前网址
	var currentURL = window.location.href;
	// 判断当前网址是否包含指定字符串
	if (currentURL.includes('https://teacher.vocational.smartedu.cn/h/subject/teaching/')) {
	  addTextToLogBox("脚本加载成功!");
	  addTextToLogBox("有bug请反馈:微信:aluyunjiesmile");
	  addTextToLogBox('脚本更新于2023-7-16');
	  addTextToLogBox("请点击所需要播放的课程")	  
	} 
	
	if (currentURL.includes('https://core.teacher.vocational.smartedu.cn/p/course/vocational/i')) {
	  console.log('当前网址包含指定字符串');
	  addTextToLogBox("请点击开始学习按钮")
	}
	
	if(currentURL.includes('https://core.teacher.vocational.smartedu.cn/p/course/vocational/v')){
	setInterval(zhouqizhixing,5000,"每隔5秒执行一次");
	}
	
	
	
	

	
	
})();