Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
东方怂天
cxmooc-tools
提交
edc64a6e
C
cxmooc-tools
项目概览
东方怂天
/
cxmooc-tools
通知
11
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cxmooc-tools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
edc64a6e
编写于
4月 25, 2019
作者:
C
CodFrm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复异常验证码打码&服务器修改&记录失败时切换的cdn #71
上级
2b44ab22
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
27 addition
and
23 deletion
+27
-23
src/config.js
src/config.js
+1
-1
src/cxmooc-tools/chaoxing/vcode.js
src/cxmooc-tools/chaoxing/vcode.js
+4
-2
src/cxmooc-tools/chaoxing/video.js
src/cxmooc-tools/chaoxing/video.js
+4
-0
src/server/listen.js
src/server/listen.js
+3
-3
src/tampermonkey/cxmooc-pack.js
src/tampermonkey/cxmooc-pack.js
+15
-17
未找到文件。
src/config.js
浏览文件 @
edc64a6e
module
.
exports
=
{
url
:
"
https://blog.icodef.com:8081/
"
,
version
:
2.0
8
,
version
:
2.0
9
,
update
:
'
https://github.com/CodFrm/cxmooc-tools/releases
'
,
enforce
:
false
,
cx
:
{
...
...
src/cxmooc-tools/chaoxing/vcode.js
浏览文件 @
edc64a6e
...
...
@@ -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
,
'
网络请求失败
'
);
});
}
...
...
src/cxmooc-tools/chaoxing/video.js
浏览文件 @
edc64a6e
...
...
@@ -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
;
...
...
src/server/listen.js
浏览文件 @
edc64a6e
...
...
@@ -281,9 +281,9 @@ app.use('/gen-token', function (req, res) {
if
(
!
req
.
query
.
user
)
{
return
res
.
send
(
'
e1
'
);
}
redis
.
h
incrby
(
'
cxmooc:genuser
'
,
req
.
query
.
user
,
1
,
function
(
err
,
val
)
{
if
(
val
>
1
)
{
return
res
.
send
({
code
:
-
1
});
redis
.
h
get
(
'
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
);
...
...
src/tampermonkey/cxmooc-pack.js
浏览文件 @
edc64a6e
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录