Greasy Fork is available in English.
腾讯课堂、超星自动签到
当前为
// ==UserScript==
// @name 腾讯课堂、超星自动签到(临时解决方案)
// @description 腾讯课堂、超星自动签到
// @namespace CX&TXKT_auto_sign
// @author 涛之雨
// @version 0.0.2
// @grant none
// @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*
// @license BSD 2-Clause
// @icon https://i.loli.net/2020/03/04/D3h1iWSFeyc8AKG.png
// @homepage https://taozhiyu.gitee.io
// ==/UserScript==
//登录超星,直接打开【我学的课|我教的课】选课界面
//即可所有课程每10秒签到一次
//打开任意课程按钮即可单独课程定时签到
//未做混淆或加密,
//按F12打开console即可看到日志
(function() {
'use strict';
function MySite(){
var home_btn = document.createElement("div");
home_btn.id = 'home_tao';
home_btn.title = "涛之雨的小站";
home_btn.style = "transform: rotate(0deg);background: url('https:\/\/s1.ax1x.com/2020/03/30/GnMT6U.png') no-repeat center center;width: 60px;height: 60px;position: fixed;right: 0px;bottom: 10px;z-index: 999999999;cursor: pointer;border: 4px solid #00bdff96;border-radius: 50%;background-size: 100% 100%;box-sizing: border-box;";
$("body")[0].append(home_btn);
var TaoW = $('#home_tao')[0].offsetWidth;
var TaoH = $('#home_tao')[0].offsetHeight;
var cuntW = 0;
var cuntH = 0;
var wait_out;
$('#home_tao')[0].onmouseover = function () {
this.style.transition = '0.5s';
move(0, 0);
rate(0)
if (!!wait_out) {
clearTimeout(wait_out);
}
}
$('#home_tao')[0].onmouseout = function () {
this.style.transition = '0.5s';
if (!!wait_out) {
clearTimeout(wait_out);
}
wait_out = setTimeout(function () {
move(TaoW / 2, TaoH / 2);
rate(-90);
} , 700);
}
window.onresize = function () {
var bodyH = document.body.offsetHeight;
var TaoT = $('#home_tao')[0].offsetTop;
var bodyW = document.body.offsetWidth;
var TaoL = $('#home_tao')[0].offsetLeft;
if (TaoT + TaoH > bodyH) {
$('#home_tao')[0].style.top = bodyH - TaoH + 'px';
cuntH++;
}
if (bodyH > TaoT && cuntH > 0) {
$('#home_tao')[0].style.top = bodyH - TaoH + 'px';
}
if (TaoL + TaoW > bodyW) {
$('#home_tao')[0].style.left = bodyW - TaoW + 'px';
cuntW++;
}
if (bodyW > TaoL && cuntW > 0) {
$('#home_tao')[0].style.left = bodyW - TaoW + 'px';
}
move(TaoW / 2, TaoH / 2);
}
function move(w, h) {
$('#home_tao')[0].style.left = document.body.offsetWidth - TaoW + w + 'px';
}
function rate(a) {
$('#home_tao')[0].style.transform = 'rotate(' + a + 'deg)'
}
setTimeout(function () {
var wait_out;
$('#home_tao')[0].style.transition = '0.5s';
move(TaoW / 2, TaoH / 2);
rate(-90);
} , 5000);
$("#home_tao").click(function () {
alert("虽然啥都没有。。。但是既然把你骗来了,就看看吧\n");
var window_tab = window.open('');
window_tab.location = 'https://taozhiyu.gitee.io';
});
}
if (location.href.match(/visit\/interaction/) != null) {
window.onload = function () {
MySite();
console.log("一共有%c"+$(".ulDiv .clearfix").length+"%c门课:","color:blue","color:black");
$(".ulDiv .clearfix").each(function(){
var that=this;
console.log("专业\"%c"+$(that)[0].children[0].innerHTML+"%c\"的链接为:"+$(that)[0].children[0].href,"color:red","color:black");
console.log("当前学科的courseID为:%c"+$(that)[0].children[0].href.match(/courseId=\d+/g)[0].match(/\d+/g)[0]+"%c\nclassID为:%c"+$(that)[0].children[0].href.match(/clazzid=\d+/g)[0].match(/\d+/g)[0],"color:red;font-size:20px","color:black;font-size:none","color:red;font-size:20px");
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]+"&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);
$("#loginframe_"+$(that)[0].children[0].href.match(/courseId=\d+/g)[0].match(/\d+/g)[0]).load(function () {
//window.frames[0].$("title")[0].text.match("成功")!=""?(console.log("success!"),$(that).remove()):alert("未知错误!请手动签到!");
});
});
}
return;
}
if(location.href.match(/mobilelearn/) != null){
var url_sign=location.href.match(/tao_auto_refresh_time=\d+/g);
var waite4time=30000,waitingTimes=Number((url_sign==null)?0:url_sign[0].match(/\d+/g)[0]),MAX_waittingTimes=0;
$(document).ready(function () {
MySite();
if(++waitingTimes>=MAX_waittingTimes&&MAX_waittingTimes){
console.log("已达尝试上限,已停止");
return;
}else{
console.log("这是第"+(waitingTimes)+"次尝试");
}
try{
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 puid = $("#puid").val();
var fid = $("#fid").val();
var url="";
url="/widget/sign/pcStuSignController/signIn?activeId="+activeId+"&classId="+classId+"&fid="+fid+"&courseId="+courseId;
//console.log("签到链接:"+url);
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?(console.log("%c签到成功!","color:red;font-size:30px"),$(this).remove()):(console.log("这里应该把主页面上的iframe删除"))):alert("未知错误!请手动签到!");
});//postMessage方法传参
}
}catch(e){
console.log("暂时没有签到任务,等待刷新");
//console.log(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));
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);
},waite4time?waite4time:60000);
}
});
return;
}
if(location.href.match(/ke.qq.com/) != null){//腾讯课堂签到
if(top.location==self.location){
$(document).ready(function () {
MySite();
var sign_times=0;
function auto_sign(timeout=5000){
var auto_sign_interval = setInterval(function () {
try{
if(document.getElementsByClassName("s-btn s-btn--primary s-btn--m").length==1){
document.getElementsByClassName("s-btn s-btn--primary s-btn--m")[0].click();
setTimeout(function () {
document.getElementsByClassName("s-btn s-btn--primary s-btn--m")[0].click();
console.log("%c一共已为您签到%c"+(++sign_times)+"次%c!","color:black","color:red;font-size:20px","color:black");
},2000);
}
}catch(e){}
}, timeout);
}
function auto_Anser(timeout=10000){
var auto_sign_interval = setInterval(function () {
try{
if($(".drag-handler").length!="0"){
var anser_type=$(".drag-handler").children()[0].innerHTML;//单选题、多选题、(未知)
document.getElementsByClassName("s-btn s-btn--primary s-btn--m")[0].click();
setTimeout(function () {
document.getElementsByClassName("s-btn s-btn--primary s-btn--m")[0].click();
},2000);
}
}catch(e){}
}, timeout);
}
var get_endpage = setInterval(function () {
//window.data.timing = 1;
if($("#marquee").length==1){
$("#marquee")[0].innerHTML="";
clearInterval(get_endpage);
}
}, 100);
auto_sign();
//下面那个慎选!
//理论上应该是可以的,只不过每次都选A。。。
//至于后台,腾讯课堂看不见你选的啥。。。
//不过不建议开启
//auto_Anser();
});
}
return;
}
// Your code here...
})();