Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
东方怂天
cxmooc-tools
提交
5600f022
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 搜索 >>
提交
5600f022
编写于
4月 27, 2019
作者:
C
CodFrm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
模拟考试答题和答案采集
上级
8e9e1c6f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
220 addition
and
17 deletion
+220
-17
build/cxmooc-tools/manifest.json
build/cxmooc-tools/manifest.json
+2
-1
src/config.js
src/config.js
+1
-1
src/cxmooc-tools/chaoxing/chaoxing.js
src/cxmooc-tools/chaoxing/chaoxing.js
+8
-0
src/cxmooc-tools/chaoxing/exam.js
src/cxmooc-tools/chaoxing/exam.js
+181
-0
src/cxmooc-tools/chaoxing/util.js
src/cxmooc-tools/chaoxing/util.js
+8
-1
src/tampermonkey/cxmooc-pack.js
src/tampermonkey/cxmooc-pack.js
+20
-14
未找到文件。
build/cxmooc-tools/manifest.json
浏览文件 @
5600f022
...
...
@@ -34,7 +34,8 @@
"*://*/ztnodedetailcontroller/visitnodedetail?*"
,
"*://*/antispiderShowVerify.ac*"
,
"*://*/html/processVerify.ac?*"
,
"*://study.zhihuishu.com/learning/videoList*"
"*://study.zhihuishu.com/learning/videoList*"
,
"*://*/exam/test/reVersionPaperMarkContentNew?*"
],
"js"
:
[
"src/start.js"
...
...
src/config.js
浏览文件 @
5600f022
module
.
exports
=
{
url
:
"
https://cx.icodef.com/
"
,
version
:
2.0
8
,
version
:
2.0
9
,
update
:
'
https://github.com/CodFrm/cxmooc-tools/releases
'
,
enforce
:
false
,
cx
:
{
...
...
src/cxmooc-tools/chaoxing/chaoxing.js
浏览文件 @
5600f022
...
...
@@ -6,6 +6,7 @@ const util = require('./util');
const
Video
=
require
(
'
./video
'
);
const
Topic
=
require
(
'
./topic
'
);
const
Vcode
=
require
(
'
./vcode
'
);
const
Exam
=
require
(
'
./exam
'
);
module
.
exports
=
function
()
{
let
self
=
this
;
...
...
@@ -223,5 +224,12 @@ module.exports = function () {
$
(
el
).
text
(
text
);
}
this
.
exam
=
function
()
{
Exam
.
exam
();
}
this
.
collectExam
=
function
()
{
Exam
.
collect
();
}
return
this
;
}
src/cxmooc-tools/chaoxing/exam.js
0 → 100644
浏览文件 @
5600f022
const
util
=
require
(
'
./util
'
);
const
common
=
require
(
'
../common
'
);
const
moocServer
=
require
(
'
../../config
'
);
module
.
exports
=
{
notic
:
undefined
,
getTopic
:
function
()
{
let
topic
=
$
(
'
.Cy_TItle.clearfix .clearfix
'
);
console
.
log
(
'
exam deal topic
'
);
if
(
topic
.
length
<=
0
)
{
this
.
notic
.
text
(
'
未搜索到题目
'
);
return
undefined
;
}
let
text
=
common
.
removeHTML
(
$
(
topic
).
html
());
text
=
text
.
substr
(
0
,
text
.
lastIndexOf
(
'
分)
'
));
text
=
text
.
substr
(
0
,
text
.
lastIndexOf
(
'
(
'
));
return
text
;
},
exam
:
function
()
{
//生成按钮
let
self
=
this
;
let
btn
=
util
.
createBtn
(
'
搜索答案
'
,
'
搜索题目答案
'
);
$
(
'
.Cy_ulBottom.clearfix.w-buttom,.Cy_ulTk,.Cy_ulBottom.clearfix
'
).
after
(
btn
);
btn
.
onclick
=
function
()
{
//搜索答案
self
.
notic
=
util
.
signleLine
(
'
搜索答案中...
'
,
'
answer
'
,
btn
.
parentElement
);
let
topic
=
self
.
getTopic
();
if
(
topic
==
undefined
)
{
return
false
;
}
console
.
log
(
'
request answer
'
);
common
.
gm_post
(
moocServer
.
url
+
'
v2/answer
'
,
'
topic[0]=
'
+
topic
,
false
,
function
(
data
)
{
let
json
=
JSON
.
parse
(
data
);
if
(
json
[
0
].
result
.
length
<=
0
)
{
return
self
.
notic
.
text
(
'
未找到答案
'
);
}
let
answer
=
json
[
0
].
result
[
Math
.
floor
(
Math
.
random
()
*
Math
.
floor
(
json
[
0
].
result
.
length
))];
//填充
console
.
log
(
answer
);
self
.
fillAnswer
(
answer
);
}).
error
(
function
()
{
self
.
notic
.
text
(
'
网络错误
'
);
});
return
false
;
}
if
(
config
.
auto
)
{
btn
.
onclick
();
}
},
fillAnswer
:
function
(
answer
)
{
let
correct
=
answer
.
correct
;
switch
(
answer
.
type
)
{
case
1
:
case
2
:
{
let
options
=
$
(
'
.Cy_ulBottom.clearfix.w-buttom li input
'
);
if
(
options
.
length
<=
0
)
{
this
.
notic
.
text
(
'
答案搜索错误
'
);
return
false
;
}
let
noticText
=
''
;
$
(
options
).
removeAttr
(
'
checked
'
);
for
(
let
i
=
0
;
i
<
correct
.
length
;
i
++
)
{
let
index
=
(
correct
[
i
].
option
.
charCodeAt
()
|
32
)
-
97
;
$
(
options
[
index
]).
attr
(
'
checked
'
,
true
);
noticText
+=
correct
[
i
].
option
+
'
:
'
+
correct
[
i
].
content
+
'
<br/>
'
;
}
$
(
this
.
notic
).
html
(
noticText
);
break
;
}
case
3
:
{
let
options
=
$
(
'
.Cy_ulBottom.clearfix li input
'
);
if
(
options
.
length
<=
0
)
{
this
.
notic
.
text
(
'
答案搜索错误
'
);
return
false
;
}
$
(
options
).
removeAttr
(
'
checked
'
);
let
index
=
1
;
if
(
correct
[
0
].
option
)
{
index
=
0
;
}
$
(
options
[
index
]).
attr
(
'
checked
'
,
true
);
$
(
this
.
notic
).
html
(
'
答案:
'
+
correct
[
0
].
option
);
break
;
}
case
4
:
{
let
options
=
$
(
'
.Cy_ulTk .XztiHover1
'
);
if
(
options
.
length
<=
0
)
{
this
.
notic
.
text
(
'
答案搜索错误
'
);
return
false
;
}
let
notic
=
''
;
for
(
let
i
=
0
;
i
<
options
.
length
;
i
++
)
{
let
pos
=
common
.
substrEx
(
$
(
options
[
i
]).
find
(
'
.fb.font14
'
).
text
(),
'
第
'
,
'
空
'
);
for
(
let
n
=
0
;
n
<
correct
.
length
;
n
++
)
{
if
(
correct
[
n
].
option
==
pos
)
{
notic
+=
'
第
'
+
pos
+
'
空:
'
+
correct
[
n
].
content
+
'
<br/>
'
;
let
ifDoc
=
$
(
options
[
i
]).
find
(
'
iframe
'
);
if
(
ifDoc
.
length
<=
0
)
{
this
.
notic
.
text
(
'
答案搜索错误
'
);
return
false
;
}
ifDoc
=
ifDoc
[
0
].
contentDocument
;
$
(
ifDoc
.
body
).
html
(
'
<p>
'
+
correct
[
n
].
content
+
'
</p>
'
);
break
;
}
}
}
$
(
this
.
notic
).
html
(
notic
);
break
;
}
default
:
{
this
.
notic
.
text
(
'
不支持的答案类型:
'
+
JSON
.
stringify
(
correct
));
return
false
;
}
}
return
true
;
},
collect
:
function
()
{
let
timu
=
$
(
'
.TiMu
'
);
let
answer
=
[];
for
(
let
i
=
0
;
i
<
timu
.
length
;
i
++
)
{
let
topic
=
$
(
timu
[
i
]).
find
(
'
.Cy_TItle.clearfix .clearfix
'
);
if
(
topic
.
length
<=
0
)
{
console
.
log
(
'
跳过
'
+
timu
[
i
]);
continue
;
}
let
correct
=
$
(
timu
[
i
]).
find
(
'
.Py_answer.clearfix
'
);
if
(
$
(
correct
).
text
().
indexOf
(
'
正确答案
'
)
>=
0
)
{
correct
=
common
.
removeHTML
(
$
(
correct
).
html
());
}
else
if
(
$
(
correct
).
find
(
'
dui
'
).
length
>
0
)
{
correct
=
common
.
removeHTML
(
$
(
correct
).
html
());
}
else
{
continue
;
}
console
.
log
(
correct
);
let
topicText
=
common
.
removeHTML
(
topic
.
html
());
topicText
=
topicText
.
substr
(
0
,
topicText
.
lastIndexOf
(
'
(
'
));
console
.
log
(
topicText
);
let
options
=
$
(
timu
[
i
]).
find
(
'
.Cy_ulTop li
'
);
let
pushOption
=
{
topic
:
topicText
,
answer
:
[],
correct
:
[]
};
if
(
options
.
length
<=
0
)
{
//非选择
let
is
=
false
;
if
((
is
=
correct
.
indexOf
(
'
√
'
))
>
0
||
correct
.
indexOf
(
'
×
'
)
>
0
)
{
if
(
is
>
0
)
{
pushOption
.
correct
.
push
({
option
:
true
,
content
:
true
});
}
else
{
pushOption
.
correct
.
push
({
option
:
false
,
content
:
false
});
}
}
else
{
}
}
else
{
// console.log();
let
correctText
=
correct
.
match
(
/
\w
+/
);
if
(
correctText
==
null
)
{
continue
;
}
correctText
=
correctText
[
0
];
console
.
log
(
correctText
);
for
(
let
n
=
0
;
n
<
options
.
length
;
n
++
)
{
let
option
=
$
(
options
[
n
]).
find
(
'
.fl
'
).
text
().
replace
(
'
、
'
,
''
);
let
tmp
=
{
option
:
$
(
options
[
n
]).
find
(
'
.fl
'
).
text
().
replace
(
'
、
'
,
''
),
content
:
common
.
removeHTML
(
$
(
options
[
n
]).
find
(
'
.clearfix
'
).
html
())
};
if
(
correctText
.
indexOf
(
option
)
>=
0
)
{
pushOption
.
correct
.
push
(
tmp
);
}
pushOption
.
answer
.
push
(
tmp
);
}
}
answer
.
push
(
pushOption
);
}
let
box
=
util
.
pop_prompt
(
"
√ 答案自动记录成功
"
);
$
(
document
.
body
).
append
(
box
);
setTimeout
(
function
()
{
box
.
style
.
opacity
=
"
1
"
;
},
500
);
console
.
log
(
answer
);
// common.gm_post(moocServer.url + 'answer', JSON.stringify(answer), true)
}
};
\ No newline at end of file
src/cxmooc-tools/chaoxing/util.js
浏览文件 @
5600f022
...
...
@@ -62,6 +62,9 @@ export function signleLine(text, label, append) {
}
else
{
$
(
p
).
text
(
text
);
}
p
.
text
=
function
(
text
){
$
(
this
).
text
(
text
);
}
return
p
;
}
...
...
@@ -82,7 +85,7 @@ export function isTask(el) {
export
function
pop_prompt
(
text
,
sec
=
4
)
{
var
box
=
document
.
createElement
(
'
div
'
);
box
.
style
.
position
=
"
absolute
"
;
box
.
style
.
position
=
"
fixed
"
;
box
.
style
.
background
=
"
#aeffab
"
;
box
.
style
.
fontSize
=
"
18px
"
;
box
.
style
.
padding
=
"
4px 20px
"
;
...
...
@@ -101,3 +104,7 @@ export function pop_prompt(text, sec = 4) {
},
sec
*
1000
);
return
box
;
}
export
function
getAnswer
(){
}
\ No newline at end of file
src/tampermonkey/cxmooc-pack.js
浏览文件 @
5600f022
import
'
./common
'
;
const
chaoxing
=
require
(
'
../cxmooc-tools/chaoxing/chaoxing
'
);
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
'
)
{
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
)
{
cx
.
studentstudy
();
}
},
true
);
var
frame
=
document
.
getElementById
(
'
iframe
'
);
if
(
frame
!=
null
)
{
cx
.
studentstudy
();
}
else
if
(
window
.
location
.
href
.
indexOf
(
'
ztnodedetailcontroller/visitnodedetail
'
)
>
0
)
{
//超星阅读页面
cx
.
read
();
}
else
if
(
window
.
location
.
href
.
indexOf
(
'
exam/test/reVersionTestStartNew
'
)
>
0
)
{
cx
.
exam
();
}
else
if
(
window
.
location
.
href
.
indexOf
(
'
exam/test/reVersionPaperMarkContentNew
'
)
>
0
)
{
cx
.
collectExam
();
}
}
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录