提交 edc64a6e 编写于 作者: C CodFrm

修复异常验证码打码&服务器修改&记录失败时切换的cdn #71

上级 2b44ab22
module.exports = {
url: "https://blog.icodef.com:8081/",
version: 2.08,
version: 2.09,
update: 'https://github.com/CodFrm/cxmooc-tools/releases',
enforce: false,
cx: {
......
......@@ -9,6 +9,10 @@ module.exports = function () {
//作业处验证码
if (document.getElementById('imgVerCode')) {
$('#imgVerCode').on('load', function () {
if($('#imgVerCode').attr('src').indexOf('?')<0){
//节约可能的一次打码
return;
}
console.log('准备打码...');
let notic = until.signleLine('cxmooc自动打码中...', 'dama', $('#sub').parents('td'));
let img = document.getElementById('imgVerCode');
......@@ -75,7 +79,6 @@ module.exports = function () {
common.gm_post(serverConfig.url + 'vcode', 'img=' + encodeURIComponent(base64.substr('data:image/jpeg;base64,'.length)), false, function (ret) {
let json = JSON.parse(ret);
if (json.code == -2) {
alert('cxmooc打码已超限制,请手动输入');
callback(undefined, json.msg);
//TODO:无权限
} else if (json.msg) {
......@@ -84,7 +87,6 @@ module.exports = function () {
getVcode(url, img, callback);
}
}).error(function () {
alert('网络请求失败,请手动输入验证码');
callback(undefined, '网络请求失败');
});
}
......
......@@ -77,6 +77,10 @@ module.exports = function () {
$(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;
......
......@@ -281,9 +281,9 @@ app.use('/gen-token', function (req, res) {
if (!req.query.user) {
return res.send('e1');
}
redis.hincrby('cxmooc:genuser', req.query.user, 1, function (err, val) {
if (val > 1) {
return res.send({ code: -1 });
redis.hget('cxmooc:genuser', req.query.user, function (err, val) {
if (val != undefined) {
return res.send({ code: 1, token: val });
} else {
let retToken = Math.random().toString(36).substr(2);
redis.set('cxmooc:vtoken:' + retToken, 50);
......
import './common';
const chaoxing = require('../cxmooc-tools/chaoxing/chaoxing');
window.onload = function () {
let cx = new chaoxing();
if (window.location.href.indexOf('mycourse/studentstudy?') > 0) {
//超星学习页面
document.addEventListener('load', function (ev) {
var ev = ev || event;
var _this = ev.srcElement || ev.target;
if (_this.id == 'iframe') {
cx.studentstudy();
}
}, true);
var frame = document.getElementById('iframe');
if (frame != null) {
let cx = new chaoxing();
if (window.location.href.indexOf('mycourse/studentstudy?') > 0) {
//超星学习页面
document.addEventListener('load', function (ev) {
var ev = ev || event;
var _this = ev.srcElement || ev.target;
if (_this.id == 'iframe') {
cx.studentstudy();
}
} else if (window.location.href.indexOf('ztnodedetailcontroller/visitnodedetail') > 0) {
//超星阅读页面
cx.read();
}, true);
var frame = document.getElementById('iframe');
if (frame != null) {
cx.studentstudy();
}
}
\ No newline at end of file
} else if (window.location.href.indexOf('ztnodedetailcontroller/visitnodedetail') > 0) {
//超星阅读页面
cx.read();
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册