-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path党建学习平台伪播放.user.js
60 lines (59 loc) · 2.56 KB
/
党建学习平台伪播放.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// ==UserScript==
// @name 党建学习平台伪播放4.0(alpha)
// @namespace http://tampermonkey.net/
// @version 4.1.0
// @description 注:4.1版使用方法为,点击我的空间-详情-去观看,若提示“已完成该课程”即本次刷课成功。
// @author Dabble
// @match http://xjtudj.edu.cn/course_detail.html?navId=course_list*
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
var reg = /course_detail\.html\?navId=course_list\&courseId=([a-z0-9]{32})\&coursewareId=([a-z0-9]{32})$/;
var msg = reg.exec(window.location.href);
if(msg != null){
var courseId = msg[1];
var coursewareId = msg[2];
safePostAsy($host + '/client/course/getLearnedHistory',
{
"courseId": courseId,
"coursewareId": coursewareId,
"progress": 0
},
function (res) {
if(res.isSuccess) {
if (coursewareId == res.data.coursewareId) {
var DuringTime = res.data.courseAllTime
if(DuringTime>0){
safePost($host + '/client/course/setFinished',
{
"courseId": courseId,
"coursewareId": coursewareId,
"progress": DuringTime
},
function (res) {
if (res.isSuccess) {
if (coursewareId == res.data.coursewareId) {
var progressHtml = "";
progressHtml = "<div class='progress-o'>本集学习进度<i>" + res.data.rateStr + '%' + "</i></div>" +
"<div class='progress-t'>" +
"<div class='progress-t-0' style='width: " + res.data.rateStr + "%;'></div></div>";
$("#progressBar").html(progressHtml);
alert("已完成该课程1");
window.history.go(-1);
}
}
})
}
}
}
})
var videoElement = document.getElementsByTagName("video")[0];
if(videoElement){
videoElement.pause();
videoElement.removeAttribute('src'); // empty source
videoElement.load();
}
}
})();