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

Commit

Permalink
紧急修复:中国电信网上大学改版之后所有功能不可用,重新支持功能(自动学习和考试切屏复制可正常使用,下载pdf文件暂时不可用)
Browse files Browse the repository at this point in the history
  • Loading branch information
snchengqi committed Jul 1, 2024
1 parent a8a07f2 commit f132abb
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 42 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Course Robot中文译为课程机器人,是用于辅助学习“知学云”

- 考试界面支持复制和切屏。

- pdf文档下载支持,帮助复习和搜题。
- ~~pdf文档下载支持,帮助复习和搜题。~~

## 兼容性

Expand All @@ -20,7 +20,7 @@ Course Robot中文译为课程机器人,是用于辅助学习“知学云”

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

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.5.0/course-robot.zip)
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.6.0/course-robot.zip)

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

Expand Down Expand Up @@ -52,7 +52,7 @@ Course Robot中文译为课程机器人,是用于辅助学习“知学云”

##### 允许复制切屏

<img title="" src="./public/images/options/1695265820150.jpg" alt="" data-align="inline" width="663">
<img src="./public/images/options/2024-07-01-09-12-48-1719796357973.jpg" title="" alt="" width="654">

<img title="" src="./public/images/options/1695265836793.jpg" alt="" data-align="inline" width="703">

Expand Down
Binary file modified course-robot.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "course-robot",
"version": "1.5.0",
"version": "1.6.0",
"description": "The Course Robot For ZhiXueYun",
"private": true,
"scripts": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Course Robot",
"version": "1.5.0",
"version": "1.6.0",
"description": "The Course Robot For ZhiXueYun",
"author": "qi.cheng",
"icons": {
Expand Down
24 changes: 12 additions & 12 deletions public/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -1250,54 +1250,54 @@
<body>
<article class="markdown-body"><h1 class="atx" id="course-robot使用说明">Course Robot使用说明</h1>
<p>Course Robot中文译为课程机器人,是用于辅助学习“知学云”平台网上大学课程的浏览器扩展程序。</p>
<p>适用范围:中国移动、中国电信、国家电投、中国石油、中国广核集团等企业使用“知学云在线学习平台”要求完成网上课程学习的员工。</p>
<p>适用范围:中国移动、中国电信、中国人民保险、国家电投、中国石油、中国广核集团等企业使用“知学云在线学习平台”要求完成网上课程学习的员工。</p>
<h2 class="atx" id="软件特性">软件特性</h2>
<ul>
<li><p>专题和活动等课程无人值守功能,自动完成视频、文档等课程学习。</p>
</li>
<li><p>考试界面支持复制和切屏。</p>
</li>
<li><p>pdf文档下载支持,帮助复习和搜题。</p>
<li><p><del>pdf文档下载支持,帮助复习和搜题。</del></p>
</li>
</ul>
<h2 class="atx" id="兼容性">兼容性</h2>
<p>使用[Chrome Manifest V3](<a href="https://doc.yilijishu.info/chrome/mv3-overview.html">Manifest V3 概述 · GitBook</a>)开发,推荐使用Chrome浏览器88及以上版本和Edge浏览器安装,目前部分浏览器不兼容Chrome Manifest V3。</p>
<h2 class="atx" id="安装说明">安装说明</h2>
<p>以Chrome浏览器为例安装Course Robot扩展程序,其它浏览器大同小异。</p>
<ol>
<li><p>获取course-robot扩展程序安装包,Edge浏览器可在<a href="https://microsoftedge.microsoft.com/addons/detail/course-robot/iccmcglahjfomdcjgegidnjhjnajbfpo?hl=zh-CN">微软应用商店</a>获取,其它浏览器下载<a href="https://gitee.com/snchengqi/course-robot/releases/download/1.3.0/course-robot.zip">zip压缩包</a></p>
<li><p>获取course-robot扩展程序安装包,Edge浏览器可在<a href="https://microsoftedge.microsoft.com/addons/detail/course-robot/iccmcglahjfomdcjgegidnjhjnajbfpo?hl=zh-CN">微软应用商店</a>获取,其它浏览器下载<a href="https://gitee.com/snchengqi/course-robot/releases/download/1.6.0/course-robot.zip">zip压缩包</a></p>
</li>
<li><p>浏览器【设置-隐私和安全-网站设置-弹出式窗口和重定向-允许发送弹出式窗口并使用重定向列表】,添加<a href="https://kc.zhixueyun.com">https://kc.zhixueyun.com</a> (如果公司知识中心三级域名不是kc.zhixueyun.com,则自行查看添加,或者设置默认允许网站可以发送弹出式窗口并使用重定向)</p>
<p><img alt="" src="./images/options/2022-08-28-12-23-50-1661660626221.jpg"><img alt="" src="./images/options/2022-08-28-12-26-08-1661660762546.jpg"><img alt="" src="./images/options/2022-08-28-12-28-48-1661660895453.jpg"><img alt="" src="./images/options/2022-08-28-12-31-04-1661661057301.jpg"></p>
<p><img alt="" src="./public/images/options/2022-08-28-12-23-50-1661660626221.jpg"><img alt="" src="./public/images/options/2022-08-28-12-26-08-1661660762546.jpg"><img alt="" src="./public/images/options/2022-08-28-12-28-48-1661660895453.jpg"><img alt="" src="./public/images/options/2022-08-28-12-31-04-1661661057301.jpg"></p>
</li>
<li><p>如果你是下载的zip压缩包(如果你是通过微软商店获取,则默认已经完成安装,直接跳过此步骤。),将安装包解压缩,然后打开浏览器扩展程序管理界面,打开开发者模式,加载已解压的扩展程序,选择刚刚解压缩的course-robot文件夹。</p>
<p><img alt="" src="./images/options/2022-08-28-16-12-53-1661674365048.jpg"><img alt="" src="./images/options/2022-08-28-16-17-27-1661674639981.jpg"><img alt="" src="./images/options/2022-08-28-16-20-04-1661674788304.jpg"><img alt="" src="./images/options/2022-08-28-16-21-51-1661674907614.jpg"></p>
<p><img alt="" src="./public/images/options/2022-08-28-16-12-53-1661674365048.jpg"><img alt="" src="./public/images/options/2022-08-28-16-17-27-1661674639981.jpg"><img alt="" src="./public/images/options/2022-08-28-16-20-04-1661674788304.jpg"><img alt="" src="./public/images/options/2022-08-28-16-21-51-1661674907614.jpg"></p>
</li>
<li><p>将程序固定到浏览器工具栏</p>
<p><img width="624" alt="" title="" src="./images/options/2022-08-28-16-25-09-1661675105797.jpg"><img width="621" alt="" title="" src="./images/options/2022-08-28-16-26-40-1661675195196.jpg"></p>
<p><img width="624" alt="" title="" src="./public/images/options/2022-08-28-16-25-09-1661675105797.jpg"><img width="621" alt="" title="" src="./public/images/options/2022-08-28-16-26-40-1661675195196.jpg"></p>
</li>
</ol>
<h2 class="atx" id="如何使用">如何使用</h2>
<h5 class="atx" id="无人值守">无人值守</h5>
<ol>
<li><p>登录所在企业的学习平台,进入知识中心。以中国电信为例,登录中国电信网上大学-知识中心</p>
<p><img alt="" src="./images/options/2022-08-28-16-31-03-1661675456028.jpg"></p>
<p><img alt="" src="./public/images/options/2022-08-28-16-31-03-1661675456028.jpg"></p>
</li>
<li><p>选择要学习的专题,复制专题链接</p>
<p><img alt="" src="./images/options/2022-08-28-16-34-11-1661675605436.jpg"></p>
<p><img alt="" src="./public/images/options/2022-08-28-16-34-11-1661675605436.jpg"></p>
</li>
<li><p>点击应用程序图标,填入复制的专题链接,开始学习</p>
<img width="623" alt="" title="" src="./images/options/2022-08-28-16-38-46-1661675920338.jpg">
<img width="623" alt="" title="" src="./public/images/options/2022-08-28-16-38-46-1661675920338.jpg">

</li>
</ol>
<h5 class="atx" id="允许复制切屏">允许复制切屏</h5>
<img width="663" data-align="inline" alt="" src="./images/options/1695265820150.jpg" title="">
<img width="654" alt="" title="" src="./public/images/options/2024-07-01-09-12-48-1719796357973.jpg">

<img width="703" data-align="inline" alt="" src="./images/options/1695265836793.jpg" title="">
<img width="703" data-align="inline" alt="" src="./public/images/options/1695265836793.jpg" title="">

<h5 class="atx" id="下载pdf文档">下载pdf文档</h5>
<img width="679" alt="" src="./images/options/1695266047749.jpg" title="">
<img width="679" alt="" src="./public/images/options/1695266047749.jpg" title="">

<h2 class="atx" id="注意事项">注意事项</h2>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion size-plugin.json

Large diffs are not rendered by default.

53 changes: 34 additions & 19 deletions src/core/course.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ class CommonCourse extends Course {
return item.lastElementChild.children[1]
}

parseType(innerDom) {
return innerDom.firstElementChild.innerHTML
}

parseStatus(innerDom) {
return innerDom.lastElementChild.lastElementChild.innerHTML
}

isCompleted(status) {
return status === '重新学习' || status === '已完成'
}
Expand All @@ -29,8 +37,8 @@ class CommonCourse extends Course {
const lists = Array.from(document.getElementsByClassName('chapter-list-box'))
const needCoutinue = lists.some(item => {
const innerDom = this.parseInnerDom(item)
const type = innerDom.firstElementChild.innerHTML
const status = innerDom.lastElementChild.lastElementChild.innerHTML
const type = this.parseType(innerDom)
const status = this.parseStatus(innerDom)
return (type === '视频' || type === '文档') && !this.isCompleted(status)
})
return needCoutinue
Expand All @@ -55,8 +63,8 @@ class CommonCourse extends Course {
if (this.currentFinish()) {
const nextCourse = Array.from(document.getElementsByClassName('chapter-list-box')).filter(item => {
const innerDom = this.parseInnerDom(item)
const type = innerDom.firstElementChild.innerHTML
const status = innerDom.lastElementChild.lastElementChild.innerHTML
const type = this.parseType(innerDom)
const status = this.parseStatus(innerDom)
return (type === '视频' || type === '文档') && !this.isCompleted(status)
}).shift()
if (nextCourse) {
Expand All @@ -72,17 +80,24 @@ class CommonCourse extends Course {
}

currentFinish() {
const itemDom = this.parseInnerDom(currentNode())
const type = itemDom.firstElementChild.innerHTML
const status = itemDom.lastElementChild.lastElementChild.innerHTML
const innerDom = this.parseInnerDom(currentNode())
const type = this.parseType(innerDom)
const status = this.parseStatus(innerDom)
return (this.isCompleted(status)) || (type === '考试' && status !== '参与考试')
}
}

class RenbaoCourse extends CommonCourse {
class NewVersionCourse extends CommonCourse {

parseInnerDom(item) {
return item.lastElementChild.children[1]
parseType(innerDom) {
return innerDom.firstElementChild.children[1].innerHTML
}

parseStatus(innerDom) {
if (innerDom.firstElementChild.children[3]) {
return '未完成'
}
return '已完成'
}
}

Expand Down Expand Up @@ -139,15 +154,15 @@ export const createCourse = () => {
resolve(new CommonCourse())
return
}
// hasCourse = lists.some(item => {
// const innerDom = item.lastElementChild.children[1]
// const type = innerDom.firstElementChild.innerHTML
// return type === '视频'|| type === '文档'
// })
// if (hasCourse) {
// resolve(new RenbaoCourse())
// return
// }
hasCourse = lists.some(item => {
const innerDom = item.lastElementChild.children[1]
const type = innerDom.firstElementChild.children[1].innerHTML
return type === '视频'|| type === '文档'
})
if (hasCourse) {
resolve(new NewVersionCourse())
return
}
resolve(new OtherCourse())
}
}, 1000);
Expand Down
8 changes: 4 additions & 4 deletions src/core/exam.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ let interval = null

// #/exam/exam/answer-paper
if (location.hash.match('#/exam/exam/answer-paper')) {
const allowDom = document.createElement('a')
const allowDom = document.createElement('div')
allowDom.id = 'allowSwitchAndCopy'
allowDom.className = 'btn block w-half m-top'
allowDom.className = 'hand-save-btn themeColor-border-color themeColor-color'
allowDom.innerText = '允许复制/切屏'
allowDom.addEventListener('click', allowSwitchAndCopy)
waitUtil(() => document.querySelector('.side-main #D165submit'), () => {
const submitDom = document.querySelector('.side-main #D165submit')
waitUtil(() => document.querySelector('.hand-save-btn'), () => {
const submitDom = document.querySelector('.hand-save-btn')
submitDom.parentNode.insertBefore(allowDom, submitDom)
})
}
Expand Down
6 changes: 5 additions & 1 deletion src/core/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ if (location.hash.match('#/study/course/detail')) {

setInterval(() => {

const fullScreenDiv = document.querySelector('.pull-right .iconfont.icon-full-screen')
const fullScreenDiv = document.querySelector('.title-screen')
let downloadDiv = document.querySelector('#download')
// console.log('pdfViewer')
// console.log(window.pdfViewer)
// console.log('fullScreenDiv')
// console.log(fullScreenDiv)
if (window.pdfViewer && fullScreenDiv && !downloadDiv) {
downloadDiv = document.createElement('div')
downloadDiv.id = 'download'
Expand Down

0 comments on commit f132abb

Please sign in to comment.