Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
东方怂天
cxmooc-tools
提交
97bd32e4
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 搜索 >>
提交
97bd32e4
编写于
6月 11, 2018
作者:
C
CodFrm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
播放完成监控
上级
83353f89
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
4 deletion
+53
-4
src/cxmooc-tools/action.js
src/cxmooc-tools/action.js
+7
-1
src/cxmooc-tools/common.js
src/cxmooc-tools/common.js
+16
-1
src/cxmooc-tools/start.js
src/cxmooc-tools/start.js
+2
-1
src/cxmooc-tools/video.js
src/cxmooc-tools/video.js
+28
-1
未找到文件。
src/cxmooc-tools/action.js
浏览文件 @
97bd32e4
...
...
@@ -5,13 +5,19 @@ const moocConfig = require('../config');
/**
* 开始监控暂停,自动重新播放
*/
window
.
monitorPlay
=
function
()
{
window
.
monitorPlay
=
function
(
playOver
)
{
var
player
=
document
.
querySelector
(
'
object
'
);
var
reader
=
player
.
parentNode
.
parentNode
;
play
();
$
(
reader
).
bind
(
'
onPause
'
,
function
(
h
,
g
)
{
play
();
});
//监听完成事件
$
(
reader
).
bind
(
'
onEnd
'
,
function
(
h
,
g
)
{
if
(
playOver
!=
undefined
)
{
playOver
();
}
});
function
play
()
{
var
time
=
setInterval
(
function
()
{
...
...
src/cxmooc-tools/common.js
浏览文件 @
97bd32e4
const
topic
=
require
(
'
./topic
'
);
const
video
=
require
(
'
./video
'
);
const
video
=
require
(
'
./video
'
);
/**
* 显示扩展按钮,并绑定事件
* @param {iframe document} _this
...
...
@@ -103,4 +103,19 @@ export function createBtn(title) {
btn
.
style
.
boxShadow
=
''
;
};
return
btn
;
}
export
function
switchChoice
()
{
var
tab
=
document
.
getElementsByClassName
(
'
tabtags
'
);
if
(
tab
.
length
<=
0
)
{
return
false
;
}
var
tabs
=
tab
[
0
].
getElementsByTagName
(
'
span
'
);
for
(
var
i
=
0
;
i
<
tabs
.
length
;
i
++
){
if
(
tabs
[
i
].
className
.
indexOf
(
'
currents
'
)
>
0
){
//现行,切换到下一个
}
}
//可以换页了
console
.
log
(
tabs
);
}
\ No newline at end of file
src/cxmooc-tools/start.js
浏览文件 @
97bd32e4
...
...
@@ -12,9 +12,10 @@ window.onload = function () {
}
injected
(
document
,
'
mooc.js
'
);
document
.
head
.
setAttribute
(
'
chrome-url
'
,
chrome
.
extension
.
getURL
(
''
));
chrome
.
storage
.
sync
.
get
(
'
rand_answer
'
,
function
(
items
)
{
chrome
.
storage
.
sync
.
get
(
[
'
rand_answer
'
,
'
interval
'
,
'
auto
'
]
,
function
(
items
)
{
//设置一下配置
document
.
head
.
setAttribute
(
'
rand-answer
'
,
items
.
rand_answer
);
localStorage
[
'
config
'
]
=
JSON
.
stringify
(
items
);
});
})
}
...
...
src/cxmooc-tools/video.js
浏览文件 @
97bd32e4
...
...
@@ -10,6 +10,7 @@ const get = common.get;
* @param {*} index
*/
module
.
exports
=
function
(
_this
,
elLogo
,
index
)
{
common
.
switchChoice
();
//获取要操作的对象和视频id
var
wid
=
_this
.
contentDocument
.
getElementsByTagName
(
'
iframe
'
)[
index
].
contentWindow
;
var
doc
=
_this
.
contentDocument
.
getElementsByTagName
(
'
iframe
'
)[
index
].
contentDocument
;
...
...
@@ -31,11 +32,37 @@ module.exports = function (_this, elLogo, index) {
},
1000
);
//创建各个按钮
var
hang_btn
=
createBtn
(
'
开始挂机
'
);
hang_btn
.
id
=
'
action-btn
'
;
hang_btn
.
value
=
index
;
hang_btn
.
title
=
"
直接开始
"
;
elLogo
.
appendChild
(
hang_btn
);
hang_btn
.
onclick
=
function
()
{
wid
.
monitorPlay
();
var
config
=
JSON
.
parse
(
localStorage
[
'
config
'
]);
if
(
config
[
'
auto
'
])
{
//全自动挂机开始
hang_btn
.
innerText
=
'
挂机中...
'
;
wid
.
monitorPlay
(
function
()
{
//播放完成
console
.
log
(
'
over
'
);
setTimeout
(
function
()
{
//判断有没有下一个,自动进行下一个任务
var
ans
=
_this
.
contentDocument
.
getElementsByClassName
(
'
ans-job-icon
'
);
if
(
ans
.
length
>
index
+
1
)
{
//点击
console
.
log
(
'
下一任务点
'
);
console
.
log
(
ans
[
index
+
1
]);
var
nextAction
=
ans
[
index
+
1
].
firstElementChild
;
console
.
log
(
nextAction
);
nextAction
.
click
();
}
else
{
//已经是最后一个,搜索下一个选项夹
console
.
log
(
'
下一选项夹
'
);
}
},
config
[
'
interval
'
]
*
1000
*
60
);
});
}
else
{
wid
.
monitorPlay
();
}
}
// var hang_mode_2 = createBtn('挂机模式2(bate)');
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录