腾讯课堂、超星自动签到(基本完整)

腾讯课堂、超星自动签到

目前為 2020-05-11 提交的版本,檢視 最新版本

// ==UserScript==
// @name	腾讯课堂、超星自动签到(基本完整)
// @description	腾讯课堂、超星自动签到
// @namespace CX&TXKT_auto_sign
// @author	涛之雨
// @version	0.2.3
// @grant   GM_getValue
// @grant   GM_setValue
// @grant   GM_registerMenuCommand
// @grant   GM_addStyle
// @run-at	document-start
// @require	https://libs.baidu.com/jquery/2.1.4/jquery.min.js
// @match	*://ke.qq.com/webcourse/index.html*
// @match	*://mobilelearn.chaoxing.com/widget/pcpick/stu/index*
// @match	*://*.chaoxing.com/visit/interaction*
// @match	*://i.mooc.chaoxing.com/*
// @license	GPL-3.0-only
// @icon	https://i.loli.net/2020/03/04/D3h1iWSFeyc8AKG.png
// @home-url	https://gf.qytechs.cn/zh-CN/scripts/401115
// ==/UserScript==


/*
 * 更新:
 * V0.2.3
 * 修复:腾讯课堂无法自动选择(好不容易老师发起一次我还错过了)
 * 修复更改设置后许刷新才生效的bug
 *
 * V0.2.2
 * 【重大更新】修复严重bug(凌晨两点果然脑子就不好了。。。。)
 * 增加了双击悬浮球回复默认设置
 *
 * V0.2.1
 * 【重大更新】增加插件设置界面,便于管理
 * 【重大更新】增加TTS语音播报功能
 * (默认开启,有需要请到支持的页面配置)
 * 剩余优化时间的显示
 * 优化算法和数据处理,增加插件的稳定性
 *
 * V0.1.2
 * 修复了已知bug(选择题功能尚未测试)
 *
 * V0.1.1
 * 修复了签到子页面无法自动刷新的bug
 *
 * V0.1.0
 * 删掉了我垃圾小站的图标(虽然用广告拦截器一拦截就好了。。。),去掉68行无用代码。。。
 * 把自定义参数放到开头,方便用户进行自定义修改(没有基础请勿修改其他部分!)
 *
 * 腾讯课堂部分:
 * 对签到适配更加精准,不会误点
 * 增加选择题的随机选择功能
 * (未经测试。。。。开启请慎重!)
 * (严重的bug倒不会至于。主要可能不是预期效果)
 *
 * 超星部分:
 * 对课程信息进行重新分组
 * 对签到的流程进行优化
 * 增加签到成功和特殊的签到类型的判断及弹窗提醒,下个版本考虑增加对于微信的对接(太麻烦,懒得,此外本人不看微信。。。。)
 *
 */

//个人小站:https://taozhiyu.gitee.io(虽然啥都没有。。。)
//吾爱主页:https://www.52pojie.cn/home.php?mod=space&uid=879080
//CSDN主页:https://blog.csdn.net/weixin_44352049(虽然也是啥都没有)

//使用说明:https://gf.qytechs.cn/zh-CN/scripts/401115
//吾爱说明:https://www.52pojie.cn/thread-1163575-1-1.html
//CSDN说明:https://blog.csdn.net/weixin_44352049/article/details/106031114

//未做混淆或加密,
//按F12打开console即可看到日志
//懂js可以自行DIY

(function() {
	'use strict';
	let AutoSignConfig = {};
	let DefaultConfig = {
		TTS_IsOpen:true,
		TTS_Volce:5,
		TTS_Speed:7,
		CX_IsOpen:true,
		CX_WaitingTime:30,
		CX_MaxWaitingCount:20,
		TXKT_SigningWaitingTime:5000,
		TXKT_Ansering_IsOpen:false,
		TXKT_Ansering_IsRandom:true,
		TXKT_Ansering_WaitingTime:-20
	};

	Promise.all([GM_getValue("CXAndTXKTConfig")]).then(function (data) {
		if (data[0] !== undefined) {
			try{
				AutoSignConfig = JSON.parse(data[0]);
			}catch (e) {
				AutoSignConfig = data[0];
			}
		} else {
			AutoSignConfig = DefaultConfig;
		}
		for(var key in DefaultConfig){
			if(typeof(AutoSignConfig[key]) == "undefined"){
				AutoSignConfig[key] = DefaultConfig[key];
			}
		}
		// 初始化完成之后才能调用正常函数
		MainFunction();
	}).catch(function (except) {
		console.log(except);
	});

	window.T2S=function (TXT){
		console.group("===T2S===");
		console.log("self===>"+self.location.href+"\ntop=====>"+top.location.href+"\nthis===>"+location.href);
		console.groupEnd("===T2S===");
		if(!AutoSignConfig.TTS_IsOpen){
			return;
		}
		if(TXT===undefined){
			TXT="我有参数呢,播报的内容您还没填呢。填写后才能读出你想要的文字呢,亲!"
		}
		var	tmp = document.createElement("div");
		tmp.innerHTML = '<iframe src="data:audio/mpeg;base64,x==" allow="autoplay" style="position:fixed;z-index:-999999999;top:-120px;left:-100px;width:10px;height:10px" autoplay></iframe>';
		tmp.id="taoSignAudioTEST";
		document.getElementsByTagName("body")[0].append(tmp);
		tmp=document.getElementById('taoSignAudio');
		if(tmp){
			tmp.src = "http://tts.baidu.com/text2audio?cuid=baiduid&per=4&vol="+AutoSignConfig.TTS_Volce+"&pit=6&lan=zh&spd="+AutoSignConfig.TTS_Speed+"&ctp=1&pdt=311&ie=UTF-8&tex="+TXT;
		}else{
			tmp = document.createElement("audio");
			tmp.id = 'taoSignAudio';
			tmp.src = "http://tts.baidu.com/text2audio?cuid=baiduid&per=4&vol="+AutoSignConfig.TTS_Volce+"&pit=6&lan=zh&spd="+AutoSignConfig.TTS_Speed+"&ctp=1&pdt=311&ie=UTF-8&tex="+TXT;
			document.getElementsByTagName("body")[0].append(tmp);
		}
		try{
			document.getElementById('taoSignAudio').play();
		}catch(e){
			console.log("error:==>"+e)}
		document.getElementById('taoSignAudioTEST').remove();
	}
	GM_registerMenuCommand('插件设置', function () {
		document.querySelector("#AutoSignSettingIconMain").style.top =0;
		setTimeout(function(){
			alert("看见没?设置在这里,\n鼠标移动到上面的设置图标就会显示出来了");
		},200);
	});


	function MainFunction(){

var UPDETE_timeout=0;
		function UpdateSettings(){
			if(UPDETE_timeout){
			clearTimeout(UPDETE_timeout);
			}
			UPDETE_timeout=setTimeout(function(){
			GM_setValue("CXAndTXKTConfig", JSON.stringify(AutoSignConfig));
			//=================超星主页=================

			AutoSignConfig.TTS_IsOpen?console.log("%c【语音播报】%c功能已%c开启","color:red","color:black","background-color:green;color:white;"):console.log("%c【语音播报】%c功能已%c关闭","color:red","color:black","background-color:red;color:white;");

			if (location.href.match(/visit\/interaction/) !== null) {
					window.location.reload();
				return;
			}

			if(location.href.match(/mobilelearn/) !== null){
					cx_main();
				return;
			}

			//===============腾讯课堂签到===============
			if(location.href.match(/ke.qq.com/) !== null){
				if(top.location==self.location){
						ke();
				}
				return;
			}

		},3000);
		}
		if(top.location==self.location){
			AutoSignConfig.TTS_IsOpen?console.log("%c【语音播报】%c功能已%c开启","color:red","color:black","background-color:green;color:white;"):console.log("%c【语音播报】%c功能已%c关闭","color:red","color:black","background-color:red;color:white;");

			$(document).ready(function () {

				GM_addStyle(`
.TaoMain{
color:aliceblue;
}
#AutoSignSettingIconMain:hover+.TaoMain>.TaoTotal {
display: block;
}
#AutoSignSettingIconMain {
position: fixed;
left: 50%;
top: -40px;
margin-left: -30px;
z-index: 99999999999;
cursor: pointer;
background-size: 100% 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: 0.7s;
-webkit-transition-delay: 1s;
-o-transition: 0.7s;
-o-transition-delay: 1s;
transition: 0.7s;
transition-delay: 1s;
padding: 0;
}
#AutoSignSettingIconMain:hover {
-webkit-transition: 0.7s;
-o-transition: 0.7s;
transition: 0.7s;
top: 0;
padding-bottom: 40px;
padding-right: 300px;
}
#AutoSignSettingIcon {
width: 60px;
height: 60px;
border: 4px solid #00bdff96;
border-radius: 50%;
background-size: 100% 100%;
-webkit-box-sizing: border-box;
box-sizing: border-box;
background: url('https://i.loli.net/2020/05/07/6xDftH98IO15MoF.png') no-repeat center center;
-webkit-transition: 0.7s;
-o-transition: 0.7s;
transition: 0.7s;
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
#AutoSignSettingIcon:hover {
-webkit-transition: 0.7s;
-o-transition: 0.7s;
transition: 0.7s;
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.Setting_ul {
margin: 5px;
padding-left: 15px;
}
.Setting_btn {
border-radius: 50%;
width: 20px;
height: 20px;
border: none;
}
.Setting_On {
background-color: green;
}
.Setting_Off {
background-color: red;
}
.TaoTotal:hover {
display: block;
}
.TaoMain{
z-index: 9999999999;
position: fixed;
top: 65px;
left: 50%;
}
.TaoTotal {
margin-left: -30px;
display:none;
border-radius: 3px;
border: 1px solid #A0A0A0;
-webkit-box-shadow: -2px 2px 5px rgba(0,0,0,0.3);
box-shadow: -2px 2px 5px rgba(0,0,0,0.3);
background-image: url("https://i.loli.net/2020/05/10/zdRfwIuHav5kpi9.jpg");
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
padding: 15px;
overflow-y:hidden ;
}
.TaoTotal>fieldset {
margin: auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
justify-content: space-around;
-ms-flex-direction: column;
flex-direction: column;
-ms-flex-pack: distribute;
items-align: center;
margin: auto;
}
.SettingTitle {
font-size: 15px;
-webkit-transition: 0.5s;
-o-transition: 0.5s;
transition: 0.5s;
}
#fieldsetAll>fieldset:hover>div {
-o-transition: height 0.5s;
transition: height 0.5s;
-webkit-transition: height 0.5s;
height: 55px;
}
#fieldsetAll{
max-height: 350px;
overflow-y:hidden ;
}
#fieldsetAll>fieldset>div {
-o-transition: height 0.5s;
-o-transition-delay: 0.5s;
transition: height 0.5s;
transition-delay: 0.5s;
-webkit-transition: height 0.5s;
-webkit-transition-delay: 0.5s;
height: 0;
overflow: hidden;
}
.SettingTitle:hover {
color: red;
font-size: 18px;
cursor: help;
-webkit-transition: 0.7s;
-webkit-transition-duration: 0.7s;
-o-transition: 0.7s;
-o-transition-duration: 0.7s;
transition: 0.7s;
transition-duration: 0.7s;
}
.Setting_Choice>label {
margin: auto;
}
input.Setting_input {
text-align: center;
-moz-text-align-last: center;
text-align-last: center;
margin: 0 2px;
vertical-align: middle;
}
input.Setting_input[type="number"] {
width: 70px;
color:blue;
}
#fieldsetAll>fieldset {
margin: 5px;
}
hr.MyScript {
margin: 0 auto;
border: groove;
}
`);
				createSettingsWindow();
			});

			function updateUI(){
				return "<div id='AutoSignSettingIconMain'>\n"+
					"<div id='AutoSignSettingIcon' title='双击清除已有设置'></div>\n"+
					"</div>\n"+
					"<div class='TaoMain'>\n"+
					"<div class='TaoTotal'>\n"+
					"<fieldset id='fieldsetAll'>\n"+
					"<legend style='text-align: right;'><a href='https://gf.qytechs.cn/zh-CN/scripts/401115'>涛之雨制作|前往脚本发布地址</a>\n"+
					"</legend>\n"+
					"<fieldset id='fieldsetTotal'>\n"+
					"<legend class='SettingTitle' title='百度语音TTS接入,语音方式提醒'>  <font>TTS(语音)设置</font>\n"+
					"</legend>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li class='Setting_Choice'>\n"+
					"<label style='height: 20px;' title='是否开启语音提醒功能(推荐开启)'>是否开启\n"+
					"<input id='TTS_IsOpen' type='button' class='Setting_input Setting_btn "+(AutoSignConfig.TTS_IsOpen?"Setting_On":"Setting_Off")+"'>\n"+
					"</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"<div id='TTS_div'>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li>\n"+
					"<label title='范围:[0,9],5为中速'>语速设置\n"+
					"<input class='Setting_input' id='TTS_Speed' type='number' max='9' min='0' value='"+AutoSignConfig.TTS_Speed+"'>\n"+
					"</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li>\n"+
					"<label title='范围:[0,15],5为中音量'>音量设置\n"+
					"<input class='Setting_input' id='TTS_Volce' type='number' max='15' min='0' value='"+AutoSignConfig.TTS_Volce+"'>\n"+
					"</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"</div>\n"+
					"</fieldset>\n"+
					"<fieldset id='fieldsetCX'>\n"+
					"<legend class='SettingTitle' title='超星学习通的相关功能,如自动签到,延时,检测等'><font>超星相关 设置</font>\n"+
					"</legend>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li class='Setting_Choice'>\n"+
					"<label title='是否开启自动签到功能(推荐开启)'>自动签到\n"+
					"<input id='CX_IsOpen' type='button' class='Setting_input Setting_btn "+(AutoSignConfig.CX_IsOpen?"Setting_On":"Setting_Off")+"'>\n"+
					"</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"<div id='CX_div'>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li>\n"+
					"<label title='每隔多长时间监视一次'>监视时间\n"+
					"<input class='Setting_input' id='CX_WaitingTime' type='number' min='0' value='"+AutoSignConfig.CX_WaitingTime+"'>秒</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li>\n"+
					"<label title='最大检测次数,超过限制停止。值为0则无限制'>最多检测\n"+
					"<input class='Setting_input' id='CX_MaxWaitingCount' type='number' min='0' value='"+AutoSignConfig.CX_MaxWaitingCount+"'>次</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"</div>\n"+
					"</fieldset>\n"+
					"<fieldset id='fieldsetCX'>\n"+
					"<legend class='SettingTitle' title='腾讯课堂的相关功能,如自动辅助答题,随机选择,辅助的时机等'> <font>腾讯课堂 设置</font>\n"+
					"</legend>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li>\n"+
					"<label title='签到的监视时间,可以填理论任意数值。(因为不会发生多层同时出现,可以考虑1000毫秒)'>签到监视\n"+
					"<input id='TXKT_SigningWaitingTime' class='Setting_input' type='number' min='0' value='"+AutoSignConfig.TXKT_SigningWaitingTime+"'>毫秒</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"<hr class='MyScript' />\n"+
					"<ul class='Setting_ul'>\n"+
					"<li class='Setting_Choice'>\n"+
					"<label title='是否开启随机选择选项功能(如关闭则每次都选择第一个选项)'>随机选择\n"+
					"<input id='TXKT_Ansering_IsRandom' type='button' class='Setting_input Setting_btn "+(AutoSignConfig.TXKT_Ansering_IsRandom?"Setting_On":"Setting_Off")+"'>\n"+
					"</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"<div id='TTS_div'>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li class='Setting_Choice'>\n"+
					"<label title='是否开启辅助作答功能(尚不完善,不推荐开启)'>辅助作答\n"+
					"<input type='button' id='TXKT_Ansering_IsOpen' class='Setting_input Setting_btn "+(AutoSignConfig.TXKT_Ansering_IsOpen?"Setting_On":"Setting_Off")+"'>\n"+
					"</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"<ul class='Setting_ul'>\n"+
					"<li>\n"+
					"<label title='辅助作答的时间,整数为等待选择时长后作答,负数为倒计时剩余填入时长的时作答'>作答时机\n"+
					"<input class='Setting_input' id='TXKT_Ansering_WaitingTime' type='number' value='"+AutoSignConfig.TXKT_Ansering_WaitingTime+"'>秒</label>\n"+
					"</li>\n"+
					"</ul>\n"+
					"</div>\n"+
					"</fieldset>\n"+
					"</fieldset>\n"+
					"</div>\n"+
					"</div>";
			}
			function createSettingsWindow(){
				if (document.body != null && document.querySelector("#AutoSignSettingFrame") == null) {

					let Container = document.createElement('div');
					Container.id = "AutoSignSettingFrame";
					Container.innerHTML=updateUI();
					document.body.appendChild(Container);
					var T2S_timeout=0;
					$("#TTS_IsOpen").on('click',function(e){
						var IsOpen=!!!$(e.target).attr("class").match(/Setting_On/g);
						$(e.target).addClass(!IsOpen?"Setting_Off":"Setting_On");
						$(e.target).removeClass(!IsOpen?"Setting_On":"Setting_Off");
						AutoSignConfig.TTS_IsOpen=IsOpen;
						UpdateSettings();
						if(T2S_timeout){
							clearTimeout(T2S_timeout);
						}
						T2S_timeout=setTimeout(function(){
							T2STEST();
						},1000);
					});
					$("#TTS_Volce").on('input',function(e){
						var Tmp=Number(e.target.value);
						Tmp=Tmp>15?15:Tmp<0?0:Tmp;
						AutoSignConfig.TTS_Volce=Tmp;
						$("#TTS_Volce").val(Tmp);
						UpdateSettings();
						if(T2S_timeout){
							clearTimeout(T2S_timeout);
						}
						T2S_timeout=setTimeout(function(){
							T2STEST();
						},1000);
					});
					$("#TTS_Speed").on('input',function(e){
						var Tmp=Number(e.target.value);
						Tmp=Tmp>9?9:Tmp<0?0:Tmp;
						AutoSignConfig.TTS_Speed=Tmp;
						$("#TTS_Speed").val(Tmp);
						UpdateSettings();
						if(T2S_timeout){
							clearTimeout(T2S_timeout);
						}
						T2S_timeout=setTimeout(function(){
							T2STEST();
						},1000);
					});
					$("#CX_IsOpen").on('click',function(e){
						var IsOpen=!!!$(e.target).attr("class").match(/Setting_On/g);
						$(e.target).addClass(!IsOpen?"Setting_Off":"Setting_On");
						$(e.target).removeClass(!IsOpen?"Setting_On":"Setting_Off");
						AutoSignConfig.CX_IsOpen=IsOpen;
						UpdateSettings();
					});
					$("#CX_WaitingTime").on('input',function(e){
						AutoSignConfig.CX_WaitingTime=Number(e.target.value);
						UpdateSettings();
					});
					$("#CX_MaxWaitingCount").on('input',function(e){
						AutoSignConfig.CX_MaxWaitingCount=Number(e.target.value);
						UpdateSettings();
					});
					$("#TXKT_SigningWaitingTime").on('input',function(e){
						AutoSignConfig.TXKT_SigningWaitingTime=Number(e.target.value);
						UpdateSettings()
					});
					$("#TXKT_Ansering_IsRandom").on('click',function(e){
						var IsOpen=!!!$(e.target).attr("class").match(/Setting_On/g);
						$(e.target).addClass(!IsOpen?"Setting_Off":"Setting_On");
						$(e.target).removeClass(!IsOpen?"Setting_On":"Setting_Off");
						AutoSignConfig.TXKT_Ansering_IsRandom=IsOpen;
						UpdateSettings()
					});
					$("#TXKT_Ansering_IsOpen").on('click',function(e){
						var IsOpen=!!!$(e.target).attr("class").match(/Setting_On/g);
						$(e.target).addClass(!IsOpen?"Setting_Off":"Setting_On");
						$(e.target).removeClass(!IsOpen?"Setting_On":"Setting_Off");
						AutoSignConfig.TXKT_Ansering_IsOpen=IsOpen;
						UpdateSettings()
					});
					$("#TXKT_Ansering_WaitingTime").on('input',function(e){
						AutoSignConfig.TXKT_Ansering_WaitingTime=Number(e.target.value);
						UpdateSettings();
					});
					$("#AutoSignSettingIcon").on('dblclick',function(e){
						if(window.confirm('你确定要删除已有设置吗?')){
							//alert("确定");
							AutoSignConfig = DefaultConfig;
							UpdateSettings();
							alert("清除成功!即刻生效");
							createSettingsWindow();
							return true;
						}else{
							//alert("取消");
							return false;
						}
					});
				}else{
					document.getElementById("AutoSignSettingFrame").innerHTML=updateUI();
				}
			}
		}
		function b64en(str) {
			return btoa(encodeURIComponent(str));
		}

		function b64de(str) {
			return decodeURIComponent(atob(str));
		}
		window.T2STEST=function (){
			T2S("这里是语音测试,如果声音大小,或是语速不合适请修改参数。Power By 涛之雨");
		}

		//=================超星主页=================

		if (location.href.match(/visit\/interaction/) !== null) {
			window.onload = function () {
				cx_sign();
			}
			return;
		}

		if(location.href.match(/mobilelearn/) !== null){

			$(document).ready(function () {
				cx_main();
			});
			return;
		}




		//===============腾讯课堂签到===============
		if(location.href.match(/ke.qq.com/) !== null){
			if(top.location==self.location){
				$(document).ready(function () {
					ke();
				});
			}
			return;
		}

		function ke(){

			function auto_sign(timeout=5000){
				var sign_times=0;
				var auto_sign_interval = setInterval(function () {
					try{
						if($(".tip")[0].innerText.match(/签到/)){
							if($(".btn-group")[0]!==undefined){
								$(".btn-group")[0].children[0].click();
								setTimeout(function () {
									$(".btn-group")[0].children[0].click();
									T2S("自动签到插件,签到成功!本节课累积已为您签到,%c"+(++sign_times)+"次。");
									console.log("%c【腾讯课堂自动签到插件】%c\n于 %s %c签到成功!\n本节课累积已为您签到%c"+sign_times+"次%c!","color:white;background-color:blue;font-size:20px","color:red;font-size:20px",(new Date().toLocaleTimeString()),"color:black","color:red;font-size:20px","color:black");
								},1000);
							}
						}
					}catch(e){}
				}, timeout);
			}

			function auto_Answer(timeout=1000){
				var answer_times=0;
				var isfristtime=true;
				var tx_timeout,timeout_min,timeout_sec,timeout_all,tmp_timeout=0,checkout_times=0;
				var isbackingtime=AutoSignConfig.TXKT_WaitingTime<0?true:false;
				if(AutoSignConfig.TXKT_WaitingTime===0){
					return;
				}
				var timeout_def=Math.abs(AutoSignConfig.TXKT_WaitingTime)
				var getrandomchoice=function(totalnumber=2){
					return Math.floor((Math.random()*totalnumber)+1)-1;
				}
				var answering=function(israndom=true){
					console.log("开始答题")
					var anser_type=$(".head-text")[0].innerHTML;
					console.info("anser_type:"+anser_type);
					$(".s-f-rc-item")[AutoSignConfig.TXKT_Ansering_IsRandom?getrandomchoice($(".s-f-rc-item").length):0].click()
					//关闭按钮没找到,上面的点击未进行测试!QAQ
					//尝鲜请慎重
					T2S("辅助答题插件,答题成功!本节课累积已为您辅助,%c"+(++answer_times)+"次。");
					console.log("%c【腾讯课堂自动签到插件】%c\n%s %c辅助答题成功!\n本节课累积已为您答题%c"+answer_times+"次%c!","color:white;background-color:blue;font-size:20px","color:red;font-size:20px",(new Date().toLocaleTimeString()),"color:black","color:red;font-size:20px","color:black");

				}
				//console.group("$$辅助作答模块$$(点我收起/展开)");
				var auto_answer_interval = setInterval(function () {

					try{

						if($(".head-text").length){//单选题、多选题、(未知)
							if($(".head-text")[0].innerHTML.match(/选题/)){
								if(isfristtime){
									isfristtime=false;
									T2S("检测到答题窗口,正在密切监视中。。。");
								}
								tx_timeout=$(".xq_num")[0].innerHTML;
								timeout_min=Number(tx_timeout.match(/\d{2}/g)[0]);
								timeout_sec=Number(tx_timeout.match(/\d{2}/g)[1]);
								timeout_all=timeout_min*60+timeout_sec-1;//当前答题的剩余时间

								console.log("答题辅助:==%s==\n"+timeout_all,(new Date().toLocaleTimeString()));
								if($(".drag-handler").length!="0"){//存在答题窗口
									if(isbackingtime){
										checkout_times=timeout_all
										checkout_times<=timeout_def?(
											console.log("时间到!开始执行辅助作答\n随机选择:%c%s",(AutoSignConfig.TXKT_Ansering_IsRandom?"color:green":"color:red"),(AutoSignConfig.TXKT_Ansering_IsRandom?"开":"关")),
											answering(AutoSignConfig.TXKT_Ansering_IsRandom)
										):(
											console.log("监视中,剩余等待时间:%c%s%c秒","color:red",(timeout_all-timeout_def),"color:black")
										);
									}else{
										checkout_times>=timeout_def?(
											console.log("时间到!开始执行辅助作答\n随机选择:%c%s",(AutoSignConfig.TXKT_Ansering_IsRandom?"color:green":"color:red"),(AutoSignConfig.TXKT_Ansering_IsRandom?"开":"关")),
											answering(AutoSignConfig.TXKT_Ansering_IsRandom)
										):(
											checkout_times++,
											console.log("监视中,剩余等待时间:%c%s%c秒","color:red",(timeout_def-checkout_times),"color:black")
										);
									}
								}
							}
						}else{
							checkout_times=0;//没有签到窗口
							isfristtime=true;
						}
					}catch(e){
						checkout_times=0;//未知错误吧。。。。
						isfristtime=true;
						console.error("err====>>",e);
					}
				}, timeout);
			}
			AutoSignConfig.TXKT_SigningWaitingTime?(
				console.log("%c【腾讯课堂自动签到】%c功能已%c开启","color:red","color:black","background-color:green;color:white;"),
				auto_sign(Number(AutoSignConfig.TXKT_SigningWaitingTime))
			):console.log("%c【腾讯课堂自动签到】%c功能已%c关闭","color:red","color:black","background-color:red;color:white;");

			AutoSignConfig.TXKT_Ansering_IsOpen?(
				console.log("%c【腾讯课堂辅助作答】%c功能已%c开启","color:red","color:black","background-color:green;color:white;"),
				console.warn("%c辅助作答为测试功能!!!请勿信任该功能!!!!\n\n%c如果出现未知错误请立即\n把%c【腾讯课堂中的辅助作答】%c改成%cfalse%c并%c立即刷新%c!","background-color:red;color:white;","background-color;color;","background-color:red;color:white;font-size:30px","background-color;color;font-size;","color:red;font-size:30px","color;font-size","color:blue;font-size:30px","background-color;color;font-size"),
				auto_Answer(AutoSignConfig.TXKT_SigningWaitingTime)
			):console.log("%c【腾讯课堂辅助作答】%c功能已%c关闭","color:red","color:black","background-color:red;color:white;");
		}
		function cx_sign(){


			if(!AutoSignConfig.CX_IsOpen){//关闭主页自动签到
				return;
			}
			AutoSignConfig.CX_IsOpen?console.log("%c【超星·主页签到】%c功能已%c开启","color:red","color:black","background-color:green;color:white;"):console.log("%c【超星·主页签到】%c功能已%c关闭","color:red","color:black","background-color:red;color:white;");

			var wait4time=Number(AutoSignConfig.CX_WaitingTime);
			var wait_format=(parseInt(wait4time/60)?(parseInt(wait4time/60)+"分钟"):"")+
				(parseInt(wait4time%60)?parseInt(wait4time%60)+"秒":"");
			console.group("$$课程信息$$(点我收起/展开)");
			console.log("一共有%c"+$(".ulDiv .clearfix").length+"%c门课程:","color:blue","color:black");
			T2S("签到插件开启,一共有"+$(".ulDiv .clearfix").length+"门课程。监视时长,"+wait_format+"。");
			$(".ulDiv .clearfix").each(function(){
				var that=this;
				var coursename=$(that)[0].children[0].innerHTML;
				var courseID=$(that)[0].children[0].href.match(/courseId=\d+/g)[0].match(/\d+/g)[0];
				console.log("专业:%c%s\n%ccourseID:%c"+courseID+"\n%cclassID为:%c"+$(that)[0].children[0].href.match(/clazzid=\d+/g)[0].match(/\d+/g)[0],"color:red",coursename,"color:black","color:red","color:black","color:red");
				var sign_url="https://mobilelearn.chaoxing.com/widget/pcpick/stu/index?courseId="+$(that)[0].children[0].href.match(/courseId=\d+/g)[0].match(/\d+/g)[0]+"&coursename="+b64en(coursename)+"&jclassId="+$(that)[0].children[0].href.match(/clazzid=\d+/g)[0].match(/\d+/g)[0];

				var tmp = document.createElement("iframe");
				tmp.id = 'loginframe_'+$(that)[0].children[0].href.match(/courseId=\d+/g)[0].match(/\d+/g)[0];
				tmp.src = sign_url;
				tmp.style = "display:none;width: 0px;height: 0px;position: fixed;left: 0px;bottom: 0px;z-index: -99;";
				$("body")[0].append(tmp);
			});
			console.groupEnd("$$课程信息$$(点我收起/展开)");
		}
		function cx_main(){

			if(!AutoSignConfig.CX_IsOpen){//关闭主页自动签到
				return;
			}
			var wait4time=Number(AutoSignConfig.CX_WaitingTime);
			var wait_format=(parseInt(wait4time/60)?(parseInt(wait4time/60)+"分钟"):"")+
				(parseInt(wait4time%60)?parseInt(wait4time%60)+"秒":"");
			wait4time*=1000;
			var url_sign=location.href.match(/tao_auto_refresh_time=\d+/g);
			var coursename="";
			try{
				coursename=location.href.match(/coursename=[A-Za-z0-9/\+=]+/g)[0].substring(11);
			}catch(e){}
			var waitingTimes=Number((url_sign===null)?0:url_sign[0].match(/\d+/g)[0]),MAX_waittingTimes=Number(AutoSignConfig.CX_MaxWaitingCount);
			waitingTimes++;
			try{
				if($(".qdhover").length!==0){
					var getmsg=$(".qdhover").parent().parent().parent()[0].getAttributeNode("onclick").nodeValue.match(/\d+/g);
					if(getmsg[1]==2){//普通签到
						var activeId=getmsg[0];
						var courseId = $("#courseId").val();
						var classId = $("#classId").val();
						var fid = $("#fid").val();
						var url="/widget/sign/pcStuSignController/signIn?activeId="+activeId+"&classId="+classId+"&coursename="+coursename+"&fid="+fid+"&courseId="+courseId;
						var tmp = document.createElement("iframe");
						tmp.id = 'loginframe';
						tmp.src = url;
						tmp.style = "display:none;width: 0px;height: 0px;position: fixed;left: 0px;bottom: 0px;z-index: -99;";
						$("body")[0].append(tmp);
						$("#loginframe").load(function () {
							window.frames[0].$("title")[0].text.match("成功")!==""?
								(top.location==self.location?(
								T2S("当前课程,签到成功"),
								console.log("%c【当前课程】签到成功!","color:white;font-size:30px;background-color:green"),
								$(".qdhover").parent().parent().parent().children().children()[1].innerHTML+="<font style='color:white;font-size:30px;background-color:green;line-height: 30px;'> 签到成功!</font>",
								$(this).remove()
							):(
								T2S(b64de(coursename)+",签到成功"),
								console.log("%c【%s】签到成功!","color:white;font-size:30px;background-color:green",b64de(coursename))
							)
								):(
								T2S("未知错误!请手动签到!"),
								alert("未知错误!请手动签到!"));
						});
					}else{//不支持
						T2S(top.location==self.location?"当前课程":b64de(coursename)+",出现非支持签到模式!请手动签到!!!");
						alert("【"+top.location==self.location?"当前课程":b64de(coursename)+"】出现非支持签到模式!请手动签到!!!");
					}
				}else{
					if(MAX_waittingTimes&&waitingTimes>=MAX_waittingTimes){
						T2S(top.location==self.location?"当前课程":b64de(coursename)+"已达尝试上限"+MAX_waittingTimes+"次,已停止");
						console.log("%c【%s】%c已达尝试上限%s次,已停止","color:red",top.location==self.location?"当前课程":b64de(coursename),"color:black",MAX_waittingTimes);
						return;
					}else{
						console.log("%c【%s】%c第"+waitingTimes+"次尝试,\n暂无签到任务,%s后自动再次尝试","color:red",top.location==self.location?"当前课程":b64de(coursename),"color:black",wait_format);
						setTimeout(function () {
							window.location.href=location.href.indexOf("tao_auto_refresh_time") > -1 ? (location.href.replace(new RegExp("tao_auto_refresh_time=\\d+",'g'),"tao_auto_refresh_time="+waitingTimes)) :( location.href + (location.href.indexOf("?") > -1 ? "&" : "?") + "tao_auto_refresh_time=" + waitingTimes);
						},wait4time);
					}
				}
			}catch(e){
				console.log(e);
			}
		}
	}
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址