// ==UserScript==
// @name 超星学习通教师后台(即超星泛雅平台)加强
// @namespace http://teachroot.com/
// @version 0.30
// @description 针对超星学习通教师后台一些功能进行了优化,方便判卷、分析、预览.
// @require https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js
// @author 辽经职院 冯涛
// @match https://mooc1-1.chaoxing.com/exam/*
// @match https://mooc1-1.chaoxing.com/work/*
// @match https://mooc1-1.chaoxing.com/scoreAnalysis/toSetWeights*
// @match https://mooc1-1.chaoxing.com/moocAnalysis/analysisScore*
// @match https://mooc1.chaoxing.com/exam/test/toReVersionPublishAndExamSet*
// @match https://mooc2-ans.chaoxing.com/exam/test/topublish*
// @grant GM_setValue
// @grant GM_getValue
// @run-at document-end
// @downloadURL https://update.greasyfork.icu/scripts/404030/%E8%B6%85%E6%98%9F%E5%AD%A6%E4%B9%A0%E9%80%9A%E6%95%99%E5%B8%88%E5%90%8E%E5%8F%B0%EF%BC%88%E5%8D%B3%E8%B6%85%E6%98%9F%E6%B3%9B%E9%9B%85%E5%B9%B3%E5%8F%B0%EF%BC%89%E5%8A%A0%E5%BC%BA.user.js
// @updateURL https://update.greasyfork.icu/scripts/404030/%E8%B6%85%E6%98%9F%E5%AD%A6%E4%B9%A0%E9%80%9A%E6%95%99%E5%B8%88%E5%90%8E%E5%8F%B0%EF%BC%88%E5%8D%B3%E8%B6%85%E6%98%9F%E6%B3%9B%E9%9B%85%E5%B9%B3%E5%8F%B0%EF%BC%89%E5%8A%A0%E5%BC%BA.meta.js
// ==/UserScript==
(function() {
'use strict';
//本部分应用于新版超星(编写完才发现,旧版的原已经做这个功能了,时间长自己都忘记了)
//发放设置-按人发放 (可在文本框内批量放置学号)
// https://mooc2-ans.chaoxing.com/exam/test/topublish?clazzid=-1&courseid=202255427&ut=t&cpi=144235191&paperid=103096329&score=0.0
if(window.location.pathname=="/exam/test/topublish"){
let $title=$('批量添加学生
1.先展开相应班级;
2.每行一个学生名。');
let $stuList=$('');
let $stuAdd=$('');
$("a#confirmchoose").before($title);
$("a#confirmchoose").before($stuList);
$("a#confirmchoose").before($stuAdd);
let $tagLi=$('');
$stuAdd.on("click",function(){
//console.log('result:', $stuList.val() );
//console.log( $(".manageTitl.current").next("ul").children("li") );
//取出学生列表
let arrStus=$stuList.val().split('\n');
let findStu=0;
//遍历班级每名学生
$(".manageTitl.current").next("ul").children("li").children(".manageTitl.lastLever").children("a").each(function(index,element){
//判断是否为列表中学生
arrStus.forEach(function(stu){
if(stu.length<=0){
return true;
}
if(stu==$(element).text()){
$(element).css("background-color","red");
$(element).next().click();
findStu++;
};
});
});
alert("共选择学生人数:" + findStu);
});
}
//以下是在旧版超星上的应用
//补考名单批量选择(文本区域内输入多个学生学号,每行一人)
if(window.location.pathname=="/exam/test/toReVersionPublishAndExamSet"){
let $stulab=$("请输入补考学生学号,每行一条 ");
let $cleartext=$("");
let $stus=$("");
let $add=$("");
let $error=$("");
$("#classDiv").after($error);
$("#classDiv").after($add);
$("#classDiv").after($stus);
$("#classDiv").after($stulab);
$("#cleartext").click(function(){
$("#stus").val("");
var checkBoxList = $("#allstu").find("input[type='checkbox']");
checkBoxList.each(function (index, thisObject) {
$(thisObject).attr("checked", false);
});
});
$("#addstus").click(function(){
$("#error").empty();
let students=$("#stus").val();
//console.log(students);
let arrstus=[];
arrstus=students.split(/[(\r\n)\r\n]+/);
$.each(arrstus,function(i,e){
if($.trim(e)==""){
return true
}
let findResult=false;
$("#allstu").children().each(function(idx,obj){
let td=$(obj).children("td")[1];
if($.trim( $(td).text() )==$.trim(e) ){
$(obj).find("input[type='checkbox']").attr("checked", "checked");
findResult=true;
}
});
if(!findResult){
$("#error").prepend("");
}
});
})
}
//快速预览试题(资料-》题库)20200711
if(window.location.pathname=='/exam/search'){
//获取各试题url
window.currentQuestionIndex=-1;
let tr= $("#tableId>tr:gt(0)");
var tagA= $(tr).find("td:eq(1)").children("a");
tagA.each( function(i, e){
let url=$(e).attr("href");
$(e).attr("id","question_" + i);
$(e).attr("data-href",url);
$(e).attr("href","javascript:void(0);");
$(e).removeAttr("target");
$(e).on("click",function(){
$('#reviewFrame').attr('src', url);
$(e).css('font-weight','bold');
currentQuestionIndex=i;
$('#myreviewWindow').show();
});
});
//定义弹出框
let reviewWindow='
优 | 良 | 中 | 及 | 不及 | 总人数 | 平均分 | 标准差 |
---|