diff --git a/src/config.js b/src/config.js
index a7df2e389c49d1b9975adbe050239b5954ad306b..02277487cb720cdabdcab528482bf68f1cc78987 100644
--- a/src/config.js
+++ b/src/config.js
@@ -1,6 +1,6 @@
module.exports = {
- url: "http://cx.icodef.com/",
- version: 2.10,
+ url: "https://cx.icodef.com/",
+ version: 2.11,
update: 'https://github.com/CodFrm/cxmooc-tools/releases',
enforce: false,
cx: {
@@ -15,8 +15,16 @@ module.exports = {
v2_06: 2.06,
},
getHotVersion: function (ver) {
- let dealver = 'v' + ('' + ver || this.version).replace('.', '_');
+ let dealver = 'v' + pushZero(ver || this.version).replace('.', '_');
hotversion = this.hotversion[dealver] || this.version;
return hotversion;
}
-}
\ No newline at end of file
+}
+
+function pushZero(num) {
+ num = "" + num;
+ for (; num.length < 4;) {
+ num = num + "0";
+ }
+ return num;
+}
diff --git a/src/cxmooc-tools/chaoxing/exam.js b/src/cxmooc-tools/chaoxing/exam.js
index 6907cf951d216c5f60b51b8d673834a76c5bc937..c91424507e56613a8e914e9704530147ad94757d 100644
--- a/src/cxmooc-tools/chaoxing/exam.js
+++ b/src/cxmooc-tools/chaoxing/exam.js
@@ -84,7 +84,7 @@ module.exports = {
switch (topic.type) {
case 1:
case 2: {
- let options = $(topic.options).find('input');
+ let options = $(topic.options).find('li input');
let noticText = this.fillSelect(options, correct);
common.signleLine(noticText, 'answer' + topic.index, undefined, topic.options);
break;
@@ -143,12 +143,20 @@ module.exports = {
fillSelect: function (options, correct) {
let noticText = '';
$(options).removeAttr('checked');
+ let optionContent = $('.Cy_ulTop.w-top li div');
+ if (optionContent.length <= 0) {
+ optionContent = $(options).parents('li').find('a');
+ }
for (let i = 0; i < correct.length; i++) {
- let index = (correct[i].option.charCodeAt() | 32) - 97;
- $(options[index]).click();
- noticText += correct[i].option + ':' + correct[i].content + '
';
+ for (let n = 0; n < options.length; n++) {
+ let option = common.removeHTML($(optionContent[n]).html());
+ if (option == correct[i].option) {
+ $(options[n]).click();
+ noticText += correct[i].option + ':' + correct[i].content + '
';
+ }
+ }
}
- return noticText;
+ return noticText || '没有符合的答案';
},
fillJudge: function (options, correct) {
$(options).removeAttr('checked');
diff --git a/src/cxmooc-tools/chaoxing/video.js b/src/cxmooc-tools/chaoxing/video.js
index 6b66e1ff33525c68d466a82936ffe334430f90ff..a879f6f82d3ac90183c2af36fe6a09b6a509b213 100644
--- a/src/cxmooc-tools/chaoxing/video.js
+++ b/src/cxmooc-tools/chaoxing/video.js
@@ -72,21 +72,33 @@ module.exports = function () {
}
}
initVideoTopic();
- initCdn(self.video);
+ // initCdn(self.video);
//点击切换记录cdn
- $(self.document).find("[title='Playline']+.vjs-menu .vjs-menu-content .vjs-menu-item-text").click(function () {
- localStorage['cdn'] = $(this).text();
- });
- //失败的切换记录
- $(self.document).find('.vjs-error-display.vjs-modal-dialog').on('click', '.ans-vjserrdisplay-opts li.ans-vjserrdisplay-opt label"', function () {
- localStorage['cdn'] = $(this).text();
- });
+ // $(self.document).find("[title='Playline']+.vjs-menu .vjs-menu-content .vjs-menu-item-text").click(function () {
+ // localStorage['cdn'] = $(this).text();
+ // });
+ // //失败的切换记录
+ // $(self.document).find('.vjs-error-display.vjs-modal-dialog').on('click', '.ans-vjserrdisplay-opts li.ans-vjserrdisplay-opt label"', function () {
+ // localStorage['cdn'] = $(this).text();
+ // });
let play = function () {
//静音和倍速选项
self.video.muted = config.video_mute;
self.video.playbackRate = config.video_multiple;
+ let cdn = self.video.currentSrc;
+ cdn = cdn.substr(0, cdn.indexOf('/video/', 10));
+ localStorage['cdn_url'] = cdn;
self.loadover && self.loadover(self);
}
+ /**
+ * 对cdn进行处理
+ */
+ if (localStorage['cdn_url'] != undefined) {
+ let url = self.video.src;
+ url = url.substr(url.indexOf('/video/'));
+ self.video.src = localStorage['cdn_url'] + url;
+ }
+
$(self.video).on('loadstart', play);
$(self.video).on('pause', function () {
diff --git a/src/cxmooc-tools/common.js b/src/cxmooc-tools/common.js
index fc464cc50c35ef5c35b59d6e02d0e307eb46ea7c..a9a1d7ff70ff63da584842e1999d7f80f481a749 100644
--- a/src/cxmooc-tools/common.js
+++ b/src/cxmooc-tools/common.js
@@ -94,11 +94,11 @@ export function removeHTML(html) {
* @param {*} topic
*/
function dealSymbol(topic) {
- topic = topic.replace(',', ',');
- topic = topic.replace('(', '(');
- topic = topic.replace(')', ')');
- topic = topic.replace('?', '?');
- topic = topic.replace(':', ':');
+ topic = topic.replace(/,/g, ',');
+ topic = topic.replace(/(/g, '(');
+ topic = topic.replace(/)/g, ')');
+ topic = topic.replace(/?/g, '?');
+ topic = topic.replace(/:/g, ':');
topic = topic.replace(/[“”]/g, '"');
return topic;
}
@@ -433,8 +433,7 @@ export function fillAnswer(topic, answer, fill, findOption) {
export function fillSelect(options, correct, isTrue) {
let noticText = '';
for (let i = 0; i < correct.length; i++) {
- isTrue(options, correct[i], 2);
- noticText += correct[i].option + ':' + correct[i].content + '
';
+ noticText += isTrue(options, correct[i], 2) + ':' + correct[i].content + '
';
}
return noticText;
}
diff --git a/src/cxmooc-tools/html/popup.html b/src/cxmooc-tools/html/popup.html
index 6b71b1184a054341527a8cc31cb28d6623bf7a76..140e20f4ea1dae71c41bcef910e0f81787a08dca 100644
--- a/src/cxmooc-tools/html/popup.html
+++ b/src/cxmooc-tools/html/popup.html
@@ -562,10 +562,10 @@