return this._json;
}
refresh() { //刷新当前课程信息
var json = null;
if(this.parseIndex() != -1 && this.requireJson()) {
this._updateProperty();
return true;
}
else {
return false;
}
}
_updateProperty() { //设置属性
this.id = this._json.list[this.index % 20].id;
this.chapterId = this._json.list[this.index % 20].chapterId;
this.courseId = this._json.list[this.index % 20].courseId;
this.name = this._json.list[this.index % 20].name;
this.viewCount = parseInt(this._json.list[this.index % 20].viewCount);
this.duration = parseInt(this._json.list[this.index % 20].duration);
this.videoDuration = parseSec(this._json.list[this.index % 20].videoDuration);
this.state = /(未学完|未学|已学)/.exec(this._json.list[this.index % 20].state)[0];
if(this.state == “已学”) this.finished = true;
this.url = this.prefixURL1 + this._json.list[this.index % 20].url;
this.pageInfo = this._json.pageInfo;
// 保存 json 至本地(SKM_courseId_page_recordsCount_pageSize)
writeSessionStorage(SKM_${this.courseId}_${this._json.pageInfo.page}_${this._json.pageInfo.recordsCount}_${this._json.pageInfo.pageSize}
, JSON.stringify(this._json), true);
}
}
class YHAssistant {
constructor() {
this.HTML = document.createElement(“div”);
this.baseInfo = null;
this.mainTimer = 0; //主时钟
this.currentDuration = -1; //观看时长
this.countdown = -1; //倒计时
this.course = null; //自定义课程对象
this.elTable = null; //HTML 表格对象
this.video = null; //HTML 视频对象
this.autoplay = true;
this.onduty = false; //是否值守
this.ocTip = null;
this._timer1 = 0; //值守计时器
this._timer2 = 0; //播放时长计时器(非Interval)
this._mtID = null; //主时钟 ID
this._tID1 = null; //值守计时器 ID
this._fg1 = false; //已切换背景
this._fg2 = false; //倒计时为 0
this._fg3 = false; //暂停计时
this._pageOther = false; //是否为其他页面
if(/\w+://mooc.yinghuaonline.com/user/node?\S+/.exec(location.href)) this.init();
else {
this.initOther();
this._pageOther = true;
}
}
init() { //播放界面初始化
var elStyle = null;
//添加 innerHTML
this.HTML.className = “YHAssistant”;
this.HTML.innerHTML += ‘