|
以下代码为时代光华老网站http://yc.cneln.net:8080/eln3_asp/index.do 自动挂课代码,
现时代光华网站已改成http://yc.21tb.com/,请高手编出新的自动挂课代码,谢谢。
var courseId = getCookie("COURSEID");
if (courseId == null) {
console.log("搜索URL...");
courseId = getUrl("courseId");
}
if (courseId == null) {
throw "未找到课程ID,可能当前窗口不是观看课程页面";
}
var playTime = 10000000;
saveNormal();
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
function getUrl(name) {
var arr, reg = new RegExp(name + "=([^&]*)");
if (arr = window.location.href.match(reg))
return unescape(arr[1]);
else
return null;
}
function saveNormal() {
var request = new XMLHttpRequest();
var url = "../../../../../../eln3_asp/common/learning.do";
var data = "method=saveNormalOnlineCoursePrecent&courseId=" + courseId
+ "&playTime=" + playTime;
request.open("POST", url, true);
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
request.setRequestHeader("Accept",
"text/javascript, text/html, application/xml, text/xml, */*");
request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");
request.onreadystatechange = function() {
if (request.readyState == 4) {
console.log(request.responseText);
console.log("刷新课程列表,看看课程[" + courseId + "]是否已经100%");
}
};
request.send(data);
}
|
|