// ==UserScript==
// @name 大连东软信息学院作业平台答案脚本
// @description 自动填写作业平台客观题答案
// @namespace http://tampermonkey.net/
// @version 0.2
// @include http://hw-neusoft-edu-cn.portal.neutech.com.cn/hw/exercise/*
// @match http://*/*
// ==/UserScript==
$(function () {
function getParameter(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
var r = location.search.substr(1).match(reg);
if (r!=null) return (r[2]); return null;
}
var eid = getParameter("eid");
// alert(eid);
var sj = "semester=1&eid=" + eid;
$.ajax({
type:'post',
url:'getQuestList.do',
data:sj,
cache:false,
dataType:'json',
success : function (data) {
var string = "";
var ans = data.list;
for (var i = 0; i < ans.length;i++){
$.ajax({
type : "POST",
url : "http://hw.neusoft.edu.cn/hw/exercise/saveoa.do",
data : {
qt_id: ans.qt_id,
qid: ans.qid,
objectiveanswer: ans.answer,
position: i + 1,
eid: eid,
},
})
}
}
});
alert("选择完毕");
});