Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit b25ae48

Browse files
committed
修复培训专题课程不正常工作,需要手动点击加载更多的bug
1 parent 5cbdc2c commit b25ae48

File tree

7 files changed

+24
-6
lines changed

7 files changed

+24
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Course Robot中文译为课程机器人,是用于辅助学习“知学云”
2020

2121
以Chrome浏览器为例安装Course Robot扩展程序,其它浏览器大同小异。
2222

23-
1. 获取course-robot扩展程序安装包,Edge浏览器可在[微软应用商店](https://microsoftedge.microsoft.com/addons/detail/course-robot/iccmcglahjfomdcjgegidnjhjnajbfpo?hl=zh-CN)获取,其它浏览器下载[zip压缩包](https://gitee.com/snchengqi/course-robot/releases/download/1.3.0/course-robot.zip)
23+
1. 获取course-robot扩展程序安装包,Edge浏览器可在[微软应用商店](https://microsoftedge.microsoft.com/addons/detail/course-robot/iccmcglahjfomdcjgegidnjhjnajbfpo?hl=zh-CN)获取,其它浏览器下载[zip压缩包](https://gitee.com/snchengqi/course-robot/releases/download/1.4.0/course-robot.zip)
2424

2525
2. 浏览器【设置-隐私和安全-网站设置-弹出式窗口和重定向-允许发送弹出式窗口并使用重定向列表】,添加https://kc.zhixueyun.com (如果公司知识中心三级域名不是kc.zhixueyun.com,则自行查看添加,或者设置默认允许网站可以发送弹出式窗口并使用重定向)
2626

course-robot.zip

130 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "course-robot",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "The Course Robot For ZhiXueYun",
55
"private": true,
66
"scripts": {

public/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Course Robot",
4-
"version": "1.3.0",
4+
"version": "1.4.0",
55
"description": "The Course Robot For ZhiXueYun",
66
"author": "qi.cheng",
77
"icons": {

size-plugin.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/core/special.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {config} from '../util/config.js'
2-
import {waitUtil} from '../util/common.js'
2+
import {waitUtil, doUntil} from '../util/common.js'
33

44
const urlSubjectPattren = `^${config.baseUrlPattern}/#/study/subject/detail/[^]*$`
55
const urlTrainNewPattren = `^${config.baseUrlPattern}/#/train-new/[^]*$`
@@ -97,7 +97,7 @@ class TrainNewSpecial extends Special {
9797
const condition = () => this.findActivityDoms()[this.activityIndex].lastElementChild.firstElementChild.lastElementChild !== '展开'
9898
await waitUtil(condition)
9999
}
100-
await waitUtil(() => {
100+
await doUntil(() => {
101101
const noMore = this.findActivityDoms()[this.activityIndex].getElementsByClassName('no-more')
102102
return noMore && noMore.length > 0
103103
}, () => {

src/util/common.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,22 @@ export const waitUtil = (condition, func) => {
4444
}
4545
}, 500);
4646
})
47+
}
48+
49+
export const doUntil = (condition, func) => {
50+
return new Promise(resolve => {
51+
if (condition()) {
52+
resolve()
53+
return
54+
}
55+
const taskId = setInterval(() => {
56+
if (condition()) {
57+
clearInterval(taskId)
58+
resolve()
59+
}
60+
if (func) {
61+
func()
62+
}
63+
}, 500);
64+
})
4765
}

0 commit comments

Comments
 (0)