`)
shadow.appendChild(this.xm_ui[0])
this.xm_ui[0].appendChild($menu[0])
this.xm_ui[0].appendChild(mask[0])
$(document).ready(()=>{
$('html').append(element)
setInterval(()=>{
if(!$('html').find(element).length){
$('html').append(element)
}
},1000)
})
this.fcq_xm_answer = this.xm_ui.find('#fcq_xm_answer');
this.xm_ui.find('#fcq_xm_set').on('mousedown',(e)=>{
window.mainProcedure.arrowMoveMenu(e);//.target.parentNode.id
})
var click_set= ()=> {
this.xm_ui.find("#fcq_xm_set_2").toggle('active');
this.xm_ui.find("#fcq_xm_answer").hide("slow");
}
this.xm_ui.find('#fcq_xm_set').on('click',click_set)
this.xm_ui.find('#token').on('input',()=>{
console.log('修改',this.xm_ui.find('#token').val())
GM_setValue("token", this.xm_ui.find('#token').val())
})
this.xm_ui.find('#fcq_xm_search').on('click',async ()=>{
let fcq_xm_answer = this.xm_ui.find("#fcq_xm_answer")
let text = this.xm_ui.find("#fcq_xm_search_text")[0]
fcq_xm_answer.show("slow");
fcq_xm_answer.text("");
if (text.value.length < 6&&0) {
fcq_xm_answer.append("搜索题目需要6个字符以上");
return;
}
fcq_xm_answer.append("正在搜索题库中,若长时间未返回信息,请加群"+qq_group+"反馈,注:该接口极易遭受攻击,如果无法正常使用,推荐使用官网内第二个,或耐心等待修复即可
");
await window.mainProcedure.search(text.value.replace(/ /g, " "))
fcq_xm_answer.text("");
fcq_xm_answer.append("搜索到" + window.mainProcedure.config.answer.rows.length + "条相关题目
");
window.mainProcedure.config.answer.rows.forEach(row => {
fcq_xm_answer.append("题目:" + row.subject + "
" + "答案:");
row.answers.forEach(answer => {
fcq_xm_answer.append(answer + " ");
});
fcq_xm_answer.append("
");
});
})
}
opeationUi.prototype.tanchu = function (text,fn){
if(window.load_zhushou_state||window.fcq_state){
return
}
this.xm_ui.find('.mask_box').css('display','block')
this.xm_ui.find('.xm_content_trip').html(text)
var end=()=>{
this.xm_ui.find('.mask_box').css('display','none')
this.xm_ui.find('#xm_close')[0].removeEventListener('click', cancelClick)
this.xm_ui.find('#xm_confirm')[0].removeEventListener('click', confirmClick)
}
var confirmClick=()=>{
if(fn){
fn(true)
GM_setValue('userFirst',true)
}
end()
}
var cancelClick=()=>{
if(fn){
fn(!GM_setValue('userFirst'))
GM_setValue('userFirst',true)
}
end()
}
this.xm_ui.find('#xm_confirm')[0].addEventListener('click', confirmClick)
this.xm_ui.find('#xm_close')[0].addEventListener('click', cancelClick)
}
opeationUi.prototype.search = function (text){
return new Promise(resolve => {
let obj = {
"action": "search",
"search": text,
"token": GM_getValue("token") || ""
};
console.log('开始',obj)
this.xm_ui.find('#token').val(GM_getValue("token"))
var xm_answer=this.xm_ui.find("#fcq_xm_answer")
GM_xmlhttpRequest({
timeout: 10000,
method: "POST",
url: "https://fc-mp-1420928c-320a-4dca-a246-45b4e1ddf142.next.bspapp.com/api",
data: JSON.stringify(obj),
onload: response=> {
var data = JSON.parse(response.response)
console.log('返回结果',data)
window.mainProcedure.config.answer = {}
if (data.list) {
window.mainProcedure.config.answer.rows = data.list.map(c => {
return {
subject: c.title,
answers: c.answer
}
})
resolve()
} else {
if(data.msg){
this.tanchu(data.msg)
}else{
this.tanchu('FCQ服务器出错,可能被人恶意攻击了,请耐心等待修复或者点击确认查看官网更多版本',(clickState)=>{
if(clickState){
openFCQ()
}
},{
btn:['确认']
})
}
}
},
onerror: function (err) {
console.log('error')
xm_answer.append("发生异常:" + err);
},
ontimeout: function (inf) {
console.log('请求超时')
xm_answer.append("请求超时:" + inf);
}
})
})
}
opeationUi.prototype.start = function (reslist) {
return this.api.start_search()
}
_this.opeationUi = opeationUi;
})(window);
var fingerprintLog=(key)=>{
if(typeof Fingerprint2!='undefined'&&window === window.parent){
if(!GM_getValue('fingerprintLog')||GM_getValue('fingerprintLog')[key]!=0){
Fingerprint2.get(components => {
const values = components.map(function (component, index) {
if (index === 0) {
return component.value.replace(/\bNetType\/\w+\b/, "")
}
return component.value
})
const murmur = Fingerprint2.x64hash128(values.join(''), 31);
var data=GM_getValue('fingerprintLog')||{
fingerprint:murmur,
plugin:{
scriptHandler:GM_info.scriptHandler,
scriptVersion:GM_info.version,
name:GM_info.script.name,
version:GM_info.script.version
},
userAgent:navigator.userAgent
}
if(key){
data[key]=0
}
GM_xmlhttpRequest({
timeout: 10000,
method: "POST",
url: "http://121.4.44.3:6397/fingerprint",
headers: {
"Content-type": "application/json;charset=UTF-8"
},
data: JSON.stringify(data),
onload: response=> {
GM_setValue('fingerprintLog',data)
}
})
});
}
}
}
if (window.location == window.parent.location||window.location.host.indexOf('tcloudbaseapp.com')!=-1) { // 判断是否为ifarm
new window.opeationUi({
id: "niu",
width: 80,
background: '#fff',
opacity: 0.8,
pos: {
x: 50,
y: 300
}
}).toLog('0');
if(!GM_getValue("fcq_xm_init")){
window.mainProcedure.xm_ui.find("#fcq_xm_set_2").toggle('active');
window.mainProcedure.xm_ui.find("#fcq_xm_answer").hide("slow");
GM_setValue("fcq_xm_init",true)
}
var userFirst=GM_getValue('userFirst')
if(!GM_getValue('userFirst')){
fingerprintLog('step')
}
setTimeout(()=>{
if(!(userFirst&&!GM_getValue('token')&&!unsafeWindow.load_zhushou_state)&&window.location.host.indexOf('tcloudbaseapp.com')==-1&&!unsafeWindow.fcq_state){
window.mainProcedure.tanchu('FCQ网课助手提示:首次使用脚本需要填写token,点击确定前往获取',(clickState)=>{
if(clickState){
openFCQ()
}
},{
btn:['确认']
})
}
if(!unsafeWindow.fcq_state&&window.location == window.parent.location){
$('html').append(`
`)
}
},2000)
}
// 判断url是在课程首页
if (/https:\/\/lms.ouchn.cn\/course\/\d+\/ng#\//m.test(document.URL)) {
nsd("当前在课程首页");
// 判断全部展开按钮
let cai = $(".expand-collapse-all-button>i");
if (cai.hasClass("font-toggle-all-collapsed")) {
nsd("点击全部展开");
cai.click();
}
// 加载所有课程
setInterval(function () {
nsd("获取所有课程");
ns_nostudy();
}, 5000);
} else if (/https:\/\/lms.ouchn.cn\/course\/\d+\/learning-activity\/full-screen#\/\d+/m.test(document.URL)) {
nsd("在详情页");
// 处理详情
setTimeout(function () {
// 2秒监控一次
setInterval(function () {
ns_player = $(".vjs-tech")[0];
if (ns_player) {
nsd("页面有视频")
ns_playover();
ns_start();
} else {
nsd("页面没视频")
ns_todown();
}
}, 5000);
}, 15000);
}
function ns_todown() {
if ($(".open-link-button").html() && $(".open-link-button").html().indexOf("新页签打开") > -1) {
nsd("处理点击链接")
$(".open-link-button>i").click();
ns_back();
} else if ($(".embeded-new-topic").html() && $(".embeded-new-topic").html().indexOf("发表帖子") > -1 && !ns_pl) {
nsd("处理发表帖子")
$(".embeded-new-topic>i").click();
$("#add-topic-popup > div > div.topic-form-section.main-area > form > div:nth-child(1) > div.field > input").val("好好学习").trigger('change');
setTimeout(function () {
$("#add-topic-popup > div > div.popup-footer > div > button.button.button-green.medium").click();
ns_pl = true;
ns_back(10000);
}, 1000);
} else if ($("div.attachment-column.column.large-3 a:eq(0)")[0]) {
nsd("处理文件预览")
$("div.attachment-column.column.large-3 a:eq(0)").click();
ns_back();
} else {
nsd("处理其他")
$(".___content").scrollTop(999999);
$(document.getElementById("previewContentInIframe").contentWindow.document).scrollTop(999999);
ns_back();
}
}
/**
* 点击所有li
*/
function ns_allclick() {
let ali = $(".module-list>ul>li>div");
for (let index = 0; index < ali.length; index++) {
const element = ali[index];
$(element).click();
}
}
/**
* 播放方法
*/
function ns_play() {
ns_player.playbackRate = 16;
ns_player.muted = true;
$("div.mvp-replay-player-all-controls > div.mvp-controls-left-area > button > i").click();
}
/**
* 判断是否暂停,如果暂停,就调用播放方法
*/
function ns_start() {
if (ns_player.paused && ns_player.duration !== ns_player.currentTime) {
ns_play();
}
}
/**
* 设置播放速度
*/
var initSet=`var VideoSpeed=1`;
if(!GM_getValue('initSet')){
GM_setValue('initSet',initSet)
};
eval(GM_getValue('initSet'))
/**
* 如果播放完毕,调用播放下一个视频的方法
*/
function ns_playover() {
if (ns_player.duration === ns_player.currentTime) {
ns_back();
}
}
/**
* 播放下一个视频,如果有弹窗,那就播放当前视频
*/
function ns_playnext() {
let actlist = $(".activity-list>li");
let flag = false;
for (let i = 0; i < actlist.length; i++) {
if (flag) {
if ($($(".activity-list>li")[i]).parent().parent().find("> div > div > span").text() != "视频学习") {
continue;
}
$(".activity-list>li:eq(" + i + ")>div").click();
let popup = $(".prerequisites-confirmation-popup");
for (let j = 0; j < popup.length; j++) {
if (popup[j].style.display === "block") {
$(".prerequisites-confirmation-popup:eq(" + j + ") .form-buttons>button").click();
ns_play();
break;
}
}
break;
}
if ($(actlist[i]).hasClass("active")) {
flag = true;
}
}
}
function nsd(str) {
if (dbg) {
console.log(str);
}
}
var startTime = 5000; //刷课间隔时间 //若超过该时间页面还未加载则自动跳过
var IntervalTime = 2000;//监测时长
var Video_muted = true; //开启静音
var Video_speed = 4; //倍速设置 最大16
(function () {
'use strict';
const urls = { 'course': 'https://www.zjooc.cn/ucenter/student/course/study/[A-Za-z0-9]+/plan/detail/[A-Za-z0-9]+' };
var ListStudy_main = [];
var ListStudy_view = [];
var ListStudy_main_now;
var ListStudy_view_now;
var Interval;
var LN = 0;
var MN = 0;
var url = unsafeWindow.location.href;
var href = new RegExp(urls.course);
CONSOLE();
LOG(href.test(url));
if (href.test(url)) {
unsafeWindow.setTimeout(function () {
LOG("=========== 开始执行脚本 =========");
for (var i = 0; i < document.querySelectorAll('.el-submenu__title').length; i++) { if (i > 0) document.querySelectorAll('.el-submenu__title')[i].click() }
GET_MAIN_LIST();
LOG("------------");
GET_VIEW_LIST();
LOG("------------");
//LOG(ListStudy_main);
//LOG(ListStudy_view);
if (ListStudy_main == "") {
LOG("全部完成");
} else {
ListStudy_main_now.click();
if (ListStudy_view == "") {
LOG("当前小节已完成");
NEXT_MAIN();
} else {
ListStudy_view_now.click();
unsafeWindow.setTimeout(AUTO_COURSE, startTime);
}
}
}, startTime);
}
function AUTO_COURSE() {
if (Interval) {
unsafeWindow.clearInterval(Interval);
}
LOG("============= 开始刷课 ===========");
LOG("当前课时:" + ListStudy_view_now.innerText);
if (document.querySelector('iframe')) {
LOG("类型【文档】");
var document_ok = document.querySelector('.contain-bottom').querySelectorAll('button.el-button.el-button--default');
LOG("文档按钮" + document_ok);
if (document_ok) {
for (var i = 0; i < document_ok.length; i++) document_ok[i].click();
LOG("正在执行文档程序");
}
LOG("============= 结束刷课 ===========");
NEXT_VIEW();
} else {
LOG("类型【视频】");
var video = document.querySelector('video');
LOG("[寻找VIDEO]" + video);
if (video) {
video.autoplay = "autoplay";
video.muted = Video_muted;
video.playbackRate = Video_speed;
var p = document.querySelector('video');
if (p) p.click();
Interval = unsafeWindow.setInterval(VIDEO_OK, IntervalTime);
}
}
}
function VIDEO_OK() {
try {
var video = document.querySelector('video');
var bar = video.parentNode.children[2];
var processBar = bar.children[7];
var times = processBar.innerText.split('/');
var now = times[0].trim();
var end = times[1].trim();
LOG(times);
if (now == end) {
if (Interval) {
unsafeWindow.clearInterval(Interval);
}
LOG("============= 结束刷课 ===========");
unsafeWindow.setTimeout(NEXT_VIEW, startTime);
}
} catch (err) {
LOG("[ERROR] " + err);
if (Interval) {
unsafeWindow.clearInterval(Interval);
}
unsafeWindow.setTimeout(NEXT_VIEW, startTime);
}
}
function NEXT_MAIN() {
MN += 1;
if (MN >= ListStudy_main.length) {
LOG("全部完成");
alert("🎉 本课程学习完毕");
} else {
ListStudy_main_now = ListStudy_main[MN];
ListStudy_main_now.click();
LOG("正在切换下一章节");
unsafeWindow.setTimeout(function () {
GET_VIEW_LIST();
if (ListStudy_view == "") {
LOG("当前小节已完成");
NEXT_MAIN();
} else {
ListStudy_view_now.click();
unsafeWindow.setTimeout(function () { AUTO_COURSE() }, startTime);
}
}, startTime);
}
}
function NEXT_VIEW() {
LN += 1;
if (LN >= ListStudy_view.length) {
LOG("当前小节已完成");
NEXT_MAIN();
} else {
ListStudy_view_now = ListStudy_view[LN];
ListStudy_view_now.click();
//LOG("当前课时:"+ListStudy_view_now.innerText);
//LOG("下一课时:"+ListStudy_view_now.nextSibling.innerText);
unsafeWindow.setTimeout(AUTO_COURSE, startTime);
}
}
function GET_MAIN_LIST() {
ListStudy_main = [];
MN = 0;
LOG("[学习章节]");
LOG("-------------");
//get main list
var main_list = document.querySelector('.base-asider ul[role="menubar"]');
for (var a = 0; a < main_list.childElementCount; a++) {
var sec_list = main_list.children[a].children[1];
for (var b = 0; b < sec_list.childElementCount; b++) {
var _e = sec_list.children[b];
//if(_e.getAttribute('tabindex')=='0')//-1 unfinish 0 finish
//{
// LOG("finished");
//}else{
LOG(_e.innerText);
ListStudy_main.push(_e);
//}
}
}
//end
ListStudy_main_now = ListStudy_main[0];
ListStudy_main_now.click();
LOG("-------------");
}
function GET_VIEW_LIST() {
ListStudy_view = [];
LN = 0;
LOG("[学习小节]");
LOG("-------------");
var list = document.querySelector('.plan-detailvideo div[role="tablist"]');
for (var i = 0; i < list.childElementCount; i++) {
var e = list.children[i];
if (e.querySelector('i').classList.contains('complete'))//finished
{
LOG("finished");
} else {
LOG(e.innerText);
ListStudy_view.push(e);
}
}
ListStudy_view_now = ListStudy_view[0];
LOG("-------------");
}
function LOG(info) {
$('#console').append('
' + info + '
');
$('#console').scrollTop(10000000);
}
function CONSOLE() {
unsafeWindow.onload = function () {
return;
var box = '
';
$('body').append(box);
document.getElementById("close_console").onclick = function () {
var b = document.getElementById("console");
if (document.getElementById("close_console").innerText == '隐藏控制台') {
b.style.display = "none";
document.getElementById("close_console").innerText = "显示控制台";
}
else {
b.style.display = "";
document.getElementById("close_console").innerText = "隐藏控制台";
}
}
}
}
})();
function show_homework_answer(str) {
var ua = navigator.userAgent;
var opacity = '0.95';
if (ua.indexOf("Edge") >= 0) {
opacity = '0.6';
} else {
opacity = '0.95';
}
var copyTextBox = '
"';
$('#copy-text-box').remove();
$('body').append(copyTextBox);
$('#copy-text-content').html(str);
$('#copy-text-box-close').click(function () {
$('#copy-text-box').remove();
});
}
function get_spoc_homework_answer(id) {
if (id) {
var post_data = `callCount=1
scriptSessionId=\${scriptSessionId}190
c0-scriptName=MocQuizBean
c0-methodName=getHomeworkPaperDto
c0-id=0
c0-param0=number:PARAM_ID
c0-param1=null:null
c0-param2=boolean:false
c0-param3=number:1
c0-param4=number:0
batchId=0`
post_data = post_data.replace("PARAM_ID", id)
console.log(post_data)
//post start
GM_xmlhttpRequest({
method: "POST",
data: post_data,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
url: "https://www.icourse163.org/dwr/call/plaincall/MocQuizBean.getHomeworkPaperDto.dwr",
onload: function (response) {
//console.log(response.responseText)
//console.log(s2)
var answer_str = ""
for (var i = 0; i < s2.length; i++) {
var judgeDtos = s2[i].judgeDtos
for (var j = 0; j < judgeDtos.length; j++) {
console.log(judgeDtos[j].msg)
answer_str += "
" + String(i + 1) + ":" + judgeDtos[j].msg + "
"
}
}
show_homework_answer(answer_str)
}
});
//post end
}
}
function get_answer(aid, id) {
if (aid && id) {
var post_data = "callCount=1\n"
post_data += "scriptSessionId=${scriptSessionId}190\n"
post_data += "httpSessionId=1d4ae12c733f41f495fc1fcbaeccd4f2\n"
post_data += "c0-scriptName=MocQuizBean\n"
post_data += "c0-methodName=getQuizPaperDto\n"
post_data += "c0-id=0\n"
post_data += "c0-param0=string:" + id + "\n"
post_data += "c0-param1=number:" + aid + "\n"
post_data += "c0-param2=boolean:true\n"
post_data += "batchId=0"
GM_xmlhttpRequest({
method: "POST",
data: post_data,
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
url: "https://www.icourse163.org/dwr/call/plaincall/MocQuizBean.getQuizPaperDto.dwr",
onload: function (response) {
var qlist = document.getElementsByClassName("j-list")[0].children[0].children
//s1 is question list
//var qnum=qlist.childElementCount
for (var i = 0; i < s1.length; i++) {
var answer = "";
var analyse = "";
if (s1[i].stdAnswer) {
answer = s1[i].stdAnswer;
} else {
for (var j = 0; j < s1[i].optionDtos.length; j++) {
var choice = s1[i].optionDtos[j]
if (choice.answer) {
answer += "ABCD"[j]//+":"
//answer+=choice.content+"\n"
}
if (choice.analyse) {
analyse += choice.analyse
}
}
}
if (s1[i].analyse) {
analyse += s1[i].analyse
}
console.log(answer)
console.log(analyse)
answer = answer.replace("##%_YZPRLFH_%##", "或")
var raw_html = `
`
var $node = $(qlist[i])
raw_html = raw_html.replace("ANSWER", answer)
raw_html = raw_html.replace("ANALYSE", analyse ? analyse : "无")
$node.append(raw_html)
}
}
});
}
}
function main() {
var aid = 0;
var id = 0;
if (aid && id) {
var topBox = "
";
$("body").append(topBox);
$("body").on("click", "#pre_analysis", function () {
get_answer(aid, id);
});
} else {
var hash = document.location.hash;
if (hash.indexOf("/learn/hw?id=") > 0) {
//parse hash
var homework_Box = "
";
$("body").append(homework_Box);
$("body").on("click", "#get_homework_answer", function () {
get_spoc_homework_answer(id)
});
}
}
};
var wait_time = 6;
function enableStartExam() {
var btn_exam = $("#jrks");
showExam(true);
var p = $("
");
p.appendTo(btn_exam);
setTimeout(() => {
p.trigger('click');
}, wait_time);
}
function sleep(time, unit) {
if (time == null) { time = wait_time * 1000; }
if (unit != null) { time = time * 1000; }
for (var t = Date.now(); Date.now() - t <= time;);
}
var fuc = setInterval(function () {
//晚点再写
}, wait_time * 1000);
// xm_window.GM_info
if (window.location.href.indexOf("onlineenew.enetedu.com") != -1) {
function randomNum(minNum, maxNum) {
switch (arguments.length) {
case 1:
return parseInt(Math.random() * minNum + 1, 10);
break;
case 2:
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
break;
default:
return 0;
break;
}
}
window.onload=function(){
let pppplay = setInterval(function(){
if($(".classcenter-chapter1 iframe").contents().find(".layui-layer-content iframe").length > 0){
setTimeout(function(){
$(".classcenter-chapter1 iframe").contents().find(".layui-layer-content iframe").contents().find("#questionid~div button").trigger("click")
}, randomNum(15, 40) * 100);
} else {
$(".classcenter-chapter1 iframe").contents().find("video").trigger("play")
}
console.log(new Date().getTime(), $(".classcenter-chapter1 iframe").length, $(".classcenter-chapter1 iframe").contents().find(".layui-layer-content iframe").length)
},5000);
setTimeout(function(){
$(".classcenter-chapter1 iframe").contents().find("video").on("timeupdate",function(){
if(Math.ceil(this.currentTime) >= Math.ceil(this.duration)) {
//clearInterval(pppplay);
let flag = false;
$(".classcenter-chapter2 ul li").each(function(t){
console.log($(this).css("background-color") == "rgb(204, 197, 197)")
if ($(this).css("background-color") != "rgb(204, 197, 197)") {
if ($(this).find("span").text() != "[100%]") {
flag = true;
$(this).trigger("click");
return false;
}
}
});
if(!flag) {
clearInterval(pppplay);
}
}
})
},8000);
}
}
if (window.location.href.indexOf("qingshunxuetang.com") != -1) {
let domain = 'https://degree.qingshuxuetang.com/'
let url=location.href;
if (url.indexOf('Course/CourseList') > -1) {
setTimeout(function() {
console.log('currentCourse',currentCourse)
sessionStorage.setItem('courses',JSON.stringify(currentCourse))
let course = currentCourse[0];
window.location.href=`${domain}cgjy/Student/Course/CourseStudy?courseId=${course.courseId}&teachPlanId=${course.teachPlanId}&periodId=${course.periodId}`
}, 3000)
}else if(url.indexOf('Course/CourseStudy') > -1){
setTimeout(function() {
console.log('coursewareMedias',coursewareMedias)
var videos=[];
getVideoNode(coursewareMedias,videos)
console.log('videos',videos);
let video = videos[0];
let courseId = getQueryString('courseId');
let teachPlanId = getQueryString('teachPlanId');
let periodId = getQueryString('periodId');
let videoMaps = {}
videoMaps[courseId] = videos;
sessionStorage.setItem('videos',JSON.stringify(videoMaps))
window.location.href=`https://degree.qingshuxuetang.com/cgjy/Student/Course/CourseShow?teachPlanId=${teachPlanId}&periodId=${periodId}&courseId=${courseId}&nodeId=${video.id}`
}, 3000)
}else if(url.indexOf('Course/CourseShow') > -1){
let courseId = getQueryString('courseId');
let nodeId = getQueryString('nodeId');
let videoMaps = JSON.parse(sessionStorage.getItem('videos'))
let teachPlanId = getQueryString('teachPlanId');
let periodId = getQueryString('periodId');
let nextVideo = getNextVideo(nodeId,videoMaps[courseId])
setTimeout(function() {
var video = document.getElementsByTagName("video")[0]
//设置静音
video.muted = true
//视频倍速
video.playbackRate = 2
//视频开始
video.play()
const nextUrl = `https://degree.qingshuxuetang.com/cgjy/Student/Course/CourseShow?teachPlanId=${teachPlanId}&periodId=${periodId}&courseId=${courseId}&nodeId=${nextVideo}`
// 下一条视频
video.addEventListener("ended",function(){
if(nextVideo == null){
let courses = JSON.parse(sessionStorage.getItem('courses'))
let course = getNextCourse(courseId,courses)
if(course == null){
window.location.href='https://baidu.com'
}
window.location.href=`${domain}cgjy/Student/Course/CourseStudy?courseId=${course.courseId}&teachPlanId=${course.teachPlanId}&periodId=${course.periodId}`
}else{
location.replace(nextUrl);
}
})
}, 5000)
getVideoTime()
}
function getNextVideo(current,videos){
let next =null;
Array.prototype.forEach.call(videos,function (value,index) {
if(value.id === current && videos.length-1 > index+1){
next = videos[index+1].id
return false
}
})
return next;
}
function getNextCourse(current,courses){
let next =null;
Array.prototype.forEach.call(courses,function (value,index) {
if(value.courseId == current && courses.length-1 > index+1){
next = courses[index+1]
return false
}
})
return next;
}
function getVideoNode(medias,videos){
Array.prototype.forEach.call(medias,function (value,index) {
if(value.type === 'video'){
videos.push(value)
}
if(value.nodes !=null){
getVideoNode(value.nodes,videos)
}
})
}
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
}
return null;
}
let currentVideoTime =null;
function getVideoTime() {
setInterval(function () {
var vid = document.getElementsByTagName("video")[0]
var currentTime = vid.currentTime.toFixed(1);
if(currentTime == currentVideoTime){
console.log('视频卡住了,刷新~');
location.reload()
}
currentVideoTime = currentTime;
console.log('视频时间:', currentTime);
}, 5000);
}
}
if (window.location.href.indexOf("172.20.32.191/redir.php?catalog_id=6&cmd=dati") != -1) {
var host = window.location.host;
if (host != "10.66.100.207" && host != "172.26.0.150") {
var questions = document.getElementsByClassName("shiti");
var _question, question, index, answer;
var notfounds = new Array(), dislocations = new Array();
var notfound = 0, dislocation = 0;
for (let i = 0, __qlength__ = questions.length; i < __qlength__; ++i) {
_question = questions[i].children[0].textContent.split("\u3001");
index = _question.shift();
question = _question.join("\u3001").replace(/[^0-9A-Za-z\u4e00-\u9fff]/g, "").replace(/^(\u5224\u65ad|\u5355\u9009|\u591a\u9009)\u9898/, "");
answer = findAnswer(question);
var _text, _c, c, answers;
var answered = false;
if (answer != "") {
answers = answer.split("\u000a");
for (let choice = 0, __clength__ = questions[i].children[1].childElementCount; choice < __clength__; ++choice) {
var ipt = document.getElementById("ti_" + index + "_" + String(choice));
_text = ipt.parentNode.children[1].textContent.replace(/[\s\?]/g, "");
if (_text.length == 0) {
dislocations[dislocation++] = String(index);
questions[i].children[0].setAttribute("style", "color: red");
} else {
_c = _text.replace(/\./, "\u3001").replace(/\uff0e/, "\u3001").split("\u3001");
if (_c.length > 1) {
_c.shift();
}
c = _c.join("\u3001");
c = c.replace("\u6b63\u786e", "\u5bf9").replace("\u9519\u8bef", "\u9519");
for (let ai = 0, __alength__ = answers.length; ai < __alength__; ++ai) {
if (answers[ai] == c) {
ipt.click();
answered = true;
break;
}
}
}
}
if (!answered) {
notfounds[notfound++] = String(index);
questions[i].children[0].setAttribute("style", "color: red");
}
} else {
notfounds[notfound++] = String(index);
questions[i].children[0].setAttribute("style", "color: red");
}
}
if (notfound > 0 || dislocation > 0) {
if (notfound > 0) {
alert("\u6b64\u9875\u9762\u5171\u6709" + String(notfound) + "\u9053\u9898\u672a\u80fd\u81ea\u52a8\u586b\u5145\uff1a" + notfounds.join("\u3001"));
}
if (dislocation > 0) {
alert("\u6b64\u9875\u9762\u5171\u6709" + String(dislocation) + "\u9053\u9898\u7531\u4e8e\u9009\u9879\u9519\u4f4d\uff0c\u5df2\u9009\u62e9\u6b63\u786e\u4f46\u4e0d\u5f97\u5206\u9009\u9879\uff1a" + dislocations.join("\u3001"));
}
} else {
var next = document.getElementsByClassName("nav")[0].children[0];
if (next && next.value == "\u4e0b\u4e00\u9875") {
next.click();
} else {
document.getElementsByClassName("nav")[0].children[1].click();
}
}
} else {
let Qs = new Array();
let __QsLen__ = 0;
if (document.getElementById("DataGridA")) {
for (let i = 0, __Q__ = document.getElementById("DataGridA").children[0], __QLen__ = __Q__.childElementCount; i < __QLen__; ++i) {
Qs[__QsLen__++] = __Q__.children[i];
}
}
if (document.getElementById("DataGridB")) {
for (let i = 0, __Q__ = document.getElementById("DataGridB").children[0], __QLen__ = __Q__.childElementCount; i < __QLen__; ++i) {
Qs[__QsLen__++] = __Q__.children[i];
}
}
if (document.getElementById("DataGridC")) {
for (let i = 0, __Q__ = document.getElementById("DataGridC").children[0], __QLen__ = __Q__.childElementCount; i < __QLen__; ++i) {
Qs[__QsLen__++] = __Q__.children[i];
}
}
let notfounds = new Array();
let notfound = 0;
for (let i = 0; i < __QsLen__; ++i) {
let t = Qs[i].children[0].children[0].children[0];
let _Q = t.children[0].children[0].children[0].textContent.split("\u3001");
let index = _Q.shift();
let Q = _Q.join("\u3001").replace(/[^0-9A-Za-z\u4e00-\u9fff]/g, "");
let A = findAnswer(Q);
let As = A.split("\u000a");
let Cs = t.children[1].children[0].children[0].children[0].children[0];
let answered = false;
for (let j = 0, __CsLen__ = Cs.childElementCount; j < __CsLen__; ++j) {
let _C = Cs.children[j].children[1].textContent.replace(/\./, "\u3001").replace(/\uff0e/, "\u3001").split("\u3001");
if (_C.length > 1) {
_C.shift();
}
let C = _C.join("\u3001");
C = C.replace("\u6b63\u786e", "\u5bf9").replace("\u9519\u8bef", "\u9519");
for (let k = 0, __AsLen__ = As.length; k < __AsLen__; ++k) {
if (C == As[k]) {
Cs.children[j].children[0].click();
answered = true;
break;
}
}
}
if (!answered) {
notfounds[notfound++] = String(index);
t.children[0].children[0].children[0].setAttribute("style", "color: red");
}
}
if (notfound > 0) {
alert("\u6b64\u9875\u9762\u5171\u6709" + String(notfound) + "\u9053\u9898\u672a\u80fd\u81ea\u52a8\u586b\u5145\uff1a" + notfounds.join("\u3001"));
}
}
}
}
ready_main()