├── assets ├── image-20231013131227594.png ├── image-20231013131247416.png ├── image-20231013131545509.png └── image-20231013131645043.png ├── .idea ├── misc.xml ├── vcs.xml ├── .gitignore ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── modules.xml └── UCAS-MOOC-AutoWatch.iml ├── README.md ├── REAMD-eng.md ├── LICENSE └── src └── script2.js /assets/image-20231013131227594.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linkedlist771/UCAS-MOOC-AutoWatch/HEAD/assets/image-20231013131227594.png -------------------------------------------------------------------------------- /assets/image-20231013131247416.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linkedlist771/UCAS-MOOC-AutoWatch/HEAD/assets/image-20231013131247416.png -------------------------------------------------------------------------------- /assets/image-20231013131545509.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linkedlist771/UCAS-MOOC-AutoWatch/HEAD/assets/image-20231013131545509.png -------------------------------------------------------------------------------- /assets/image-20231013131645043.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linkedlist771/UCAS-MOOC-AutoWatch/HEAD/assets/image-20231013131645043.png -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/UCAS-MOOC-AutoWatch.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UCAS-MOOC-AutoWatch 2 | > 这个脚本适用于果壳`研一英语慕课`自动刷课, 3 | > 主要通过油猴脚本来实现自动刷课和选课。 4 | > 5 | > 如果该项目对你有用,或者喜欢该项目,请不要吝啬点赞。 6 | 7 | 8 | [中文版](README.md) | [English Version](REAMD-eng.md) 9 | ## 主要脚本: 10 | [script1.js](src/script1.js) 用于自动刷课,主要是通过`setInterval`来实现的。 11 | 12 | [script2.js](src/script2.js) 用于自动选课,主要是通过`MutationObserver`来实现的。 13 | 14 | ## 使用方法: 15 | 16 | > 首先需要配置油猴脚本,该配置方案在主流视频网站都有教程,这里不过多介绍。 17 | 18 | ### 1.直接使用油猴下载: 19 | 20 | **安装两个必须的脚本** 21 | 22 | 1. [✅国科大慕课自动刷课脚本: 版本1 (greasyfork.org)](https://greasyfork.org/zh-CN/scripts/477309-国科大慕课自动刷课脚本-版本1) 23 | 24 | ​ 2. [✅国科大慕课自动刷课脚本: 版本2 (greasyfork.org)](https://greasyfork.org/zh-CN/scripts/477732-国科大慕课自动刷课脚本-版本2) 25 | 26 | 27 | ### 2.使用油猴创建代码(此教程适用于方法1中的链接被举报下架): 28 | 29 | **打开油猴脚本页面** 30 | 31 | ![image-20231013131227594](assets/image-20231013131227594.png) 32 | 33 | **添加[script1.js](src/script1.js) 与[script2.js](src/script2.js) 到自定义脚本中** 34 | 35 | ![image-20231013131247416](assets/image-20231013131247416.png) 36 | 37 | 直接复制即可,添加两个脚本在其中。 38 | 39 | ### 3. 启动脚本 40 | 41 | 1. 首先进入国科大英语慕课页面(不开脚本进入。) 42 | 43 | ![image-20231013131545509](assets/image-20231013131545509.png) 44 | 45 | 2. 开启脚本,然后刷新一下页面,如果看到视频开始自动播放则证明已经成功,这个时候就可以不管了。 46 | 47 | ![image-20231013131645043](assets/image-20231013131645043.png) 48 | 49 | > 注: 可能存在刷完一章的课出现弹窗卡主的情况,此时取消脚本,重复1,2步骤即可解决。 50 | -------------------------------------------------------------------------------- /REAMD-eng.md: -------------------------------------------------------------------------------- 1 | # UCAS-MOOC-AutoWatch 2 | > This script is designed for the UCAS "First Year English MOOC" automatic course watching, mainly implemented through Tampermonkey scripts for automatic course watching and course selection. 3 | 4 | > If you find this project useful or like it, please don't hesitate to give it a thumbs up. 5 | 6 | [中文版](README.md) | [English Version](REAMD-eng.md) 7 | 8 | ## Main Scripts: 9 | [script1.js](src/script1.js) is used for automatic course watching, mainly implemented through `setInterval`. 10 | 11 | [script2.js](src/script2.js) is used for automatic course selection, mainly implemented through `MutationObserver`. 12 | 13 | ## How to Use: 14 | 15 | > First, you need to configure the Tampermonkey script. There are tutorials on mainstream video websites, so I won't go into detail here. 16 | 17 | ### 1. Directly use Tampermonkey to download: 18 | 19 | **Install the two required scripts** 20 | 21 | 1. [✅UCAS MOOC Auto Course Watching Script: Version 1 (greasyfork.org)](https://greasyfork.org/zh-CN/scripts/477309-国科大慕课自动刷课脚本-版本1) 22 | 23 | ​ 2. [✅UCAS MOOC Auto Course Watching Script: Version 2 (greasyfork.org)](https://greasyfork.org/zh-CN/scripts/477310-国科大慕课自动刷课脚本-版本2) 24 | 25 | ### 2. Use Tampermonkey to create code (this tutorial is for when the links in method 1 are reported and removed): 26 | 27 | **Open the Tampermonkey script page** 28 | 29 | ![image-20231013131227594](assets/image-20231013131227594.png) 30 | 31 | **Add [script1.js](src/script1.js) and [script2.js](src/script2.js) to custom scripts** 32 | 33 | ![image-20231013131247416](assets/image-20231013131247416.png) 34 | 35 | Just copy and paste. Add both scripts to it. 36 | 37 | ### 3. Launch the script 38 | 39 | 1. First, go to the UCAS English MOOC page (enter without the script). 40 | 41 | ![image-20231013131545509](assets/image-20231013131545509.png) 42 | 43 | 2. Turn on the script, then refresh the page. If you see the video starting to play automatically, it means it's successful. You can leave it running now. 44 | 45 | ![image-20231013131645043](assets/image-20231013131645043.png) 46 | 47 | > Note: There might be a pop-up window that gets stuck after finishing a chapter. In this case, turn off the script and repeat steps 1 and 2 to solve the issue. -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 89 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/script2.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name ✅国科大慕课自动刷课脚本: 版本2 3 | // @namespace xhygtf 4 | // @version 2.6.0 5 | // @description 国科大刷课版本2, 请配合刷课版本1一起使用 6 | // @author Muketool 7 | // @match *://*.chaoxing.com/* 8 | // @match *://*.edu.cn/* 9 | // @match *://*.nbdlib.cn/* 10 | // @match *://*.hnsyu.net/* 11 | // @match *://*.mooc.ucas.edu.cn/* 12 | // @connect api.muketool.com 13 | // @connect api2.muketool.com 14 | // @run-at document-end 15 | // @grant unsafeWindow 16 | // @grant GM_xmlhttpRequest 17 | // @grant GM_setValue 18 | // @grant GM_getValue 19 | // @grant GM_setClipboard 20 | // @license MIT 21 | // @supportURL http://docs.muketool.com 22 | // @homepage http://www.muketool.com 23 | // @original-script https://greasyfork.org/zh-CN/scripts/369625-%E8%B6%85%E6%98%9F%E7%BD%91%E8%AF%BE%E5%8A%A9%E6%89%8B 24 | // @original-author wyn665817 25 | // @original-script https://scriptcat.org/script-show-page/10/code 26 | // @original-author coder_tq 27 | // @original-license MIT 28 | // ==/UserScript== 29 | GM_setValue("video_url", 0) 30 | 31 | // 下方为脚本设置,设置修改后,需要刷新或重新打开网课页面才会生效 32 | var setting = { 33 | 34 | //这里设置脚本所使用的题库接口。默认使用Muketool的题库,您也可以自行替换为其他题库服务器。(修改第三方题库后可能需要同时修改部分其他代码,一点都不了解的就不要乱改了) 35 | //脚本自带两个题库接口:“http://api.muketool.com”(默认使用该接口)和“http://api2.muketool.com”, 36 | //二个题库试题数据一样,区别在于前者使用加速线路,响应更快但是易受攻击;后者采用国外高防线路速度略慢但无视网络攻击。如果您发现其中一个题库失联,可以尝试切换为另一个。 37 | tiku: 'http://api.muketool.com' 38 | 39 | // 常用设置 40 | , time: 8E3 // 默认响应速度为5秒,不建议小于5秒。5E3 == 5000,科学记数法,表示毫秒数 41 | , review: 0 // 复习模式,完整挂机视频(音频)时长,支持挂机任务点已完成的视频和音频,默认关闭 42 | , queue: 1 // 队列模式,开启后任务点逐一完成,关闭则单页面所有任务点同时进行,默认开启 43 | , video: 1 // 视频支持后台、切换窗口不暂停,支持多视频,默认开启。1代表开启,0代表关闭 44 | , work: 1 // 自动答题功能(章节测验),作业需要手动开启查询,高准确率,默认开启 45 | , audio: 1 // 音频自动播放,与视频功能共享vol和rate参数,默认开启 46 | , book: 1 // 图书阅读任务点,非课程阅读任务点,默认开启 47 | , docs: 1 // 文档阅读任务点,PPT类任务点自动完成阅读任务,默认开启 48 | 49 | // 本区域参数,上方为任务点功能,下方为独立功能 50 | , jump: 1 // 自动切换任务点、章节、课程(需要配置course参数),默认开启 51 | , read: '65' // 挂机课程阅读时间,单位是分钟,'65'代表挂机65分钟,请手动打开阅读页面,默认'65'分钟 52 | , face: 1 // 解除面部识别(不支持二维码类面部采集),此功能仅为临时解除,默认开启 53 | , total: 1 // 显示课程进度的统计数据,在学习进度页面的上方展示,默认开启 54 | 55 | // 仅开启video(audio)时,修改此处才会生效 56 | , line: '公网1' // 视频播放的默认资源线路,此功能适用于系统默认线路无资源,默认'公网1' 57 | , http: '标清' // 视频播放的默认清晰度,无效参数则使用系统默认清晰度,默认'标清' 58 | // 本区域参数,上方为video功能独享,下方为audio功能共享 59 | , vol: '0' // 默认音量的百分数,设定范围:[0,100],'0'为静音,默认'0' 60 | , rate: '1' // 视频播放默认倍率,参数范围0∪[0.0625,16],'0'为秒过,默认'1'倍 61 | 62 | // 仅开启work时,修改此处才会生效 63 | // auto: 1 已放置面板,请在面板配置,默认为自动提交 // 答题完成后自动提交,默认开启 64 | , none: 0 // 无匹配答案时执行默认操作,关闭后若题目无匹配答案则会暂时保存已作答的题目,默认开启 65 | , scale: 0 // 富文本编辑器高度自动拉伸,用于文本类题目,答题框根据内容自动调整大小,默认关闭 66 | 67 | // 仅开启jump时,修改此处才会生效 68 | , course: 0 // 当前课程完成后自动切换课程,仅支持按照根目录课程顺序切换,默认开启 69 | , lock: 1 // 跳过未开放(图标是锁)的章节,即闯关模式或定时发放的任务点,默认开启 70 | 71 | // 自动登录功能配置区 72 | , school: '账号为手机号可以不修改此参数' // 学校/单位/机构码,要求完整有效可查询,例如'清华大学' 73 | , username: '' // 学号/工号/借书证号(邮箱/手机号/账号),例如'2018010101',默认'' 74 | , password: '' // 密码,例如'123456',默认'' 75 | 76 | // 脚本的信息,主要用于接口适配和升级检测 77 | , script: 'v1cx', version: '1.1.4' 78 | 79 | }, _self = unsafeWindow, url = location.pathname, top = _self; 80 | 81 | var tmpSubmit = 1; //本次 82 | Object.defineProperty(setting, "auto", { 83 | get: function () { 84 | if (tmpSubmit >= 2) { 85 | return tmpSubmit === 3; 86 | } 87 | return GM_getValue("autosubmit"); 88 | }, set: function (value) { 89 | tmpSubmit = value + 2; 90 | } 91 | }); 92 | 93 | setting.notice = '公告栏'; 94 | 95 | if (url != '/studyApp/studying' && top != _self.top) document.domain = location.host.replace(/.+?\./, ''); 96 | 97 | try { 98 | while (top != _self.top) { 99 | top = top.parent.document ? top.parent : _self.top; 100 | if (top.location.pathname == '/mycourse/studentstudy') break; 101 | } 102 | } catch (err) { 103 | // console.log(err); 104 | top = _self; 105 | } 106 | 107 | var $ = _self.jQuery || top.jQuery, parent = _self == top ? self : _self.parent, Ext = _self.Ext || parent.Ext || {}, 108 | UE = _self.UE, vjs = _self.videojs; 109 | 110 | // 回到旧版页面 111 | $('.Header').find('a:contains(回到旧版)')[0] ? $('.Header').find('a:contains(回到旧版)')[0].click() : ''; 112 | 113 | String.prototype.toCDB = function () { 114 | return this.replace(/\s/g, '').replace(/[\uff01-\uff5e]/g, function (str) { 115 | return String.fromCharCode(str.charCodeAt(0) - 65248); 116 | }).replace(/[“”]/g, '"').replace(/[‘’]/g, "'").replace(/。/g, '.'); 117 | }; 118 | 119 | setting.normal = ''; // ':visible' 120 | // setting.time += Math.ceil(setting.time * Math.random()) - setting.time / 2; 121 | setting.job = [':not(*)']; 122 | 123 | setting.video && setting.job.push('iframe[src*="/video/index.html"]'); 124 | setting.work && setting.job.push('iframe[src*="/work/index.html"]'); 125 | setting.audio && setting.job.push('iframe[src*="/audio/index.html"]'); 126 | setting.book && setting.job.push('iframe[src*="/innerbook/index.html"]'); 127 | setting.docs && setting.job.push('iframe[src*="/ppt/index.html"]', 'iframe[src*="/pdf/index.html"]'); 128 | 129 | setting.tip = !setting.queue || top != _self && jobSort($ || Ext.query); 130 | 131 | setInterval(function() { 132 | location.reload(); // 刷新当前网页 133 | }, 300000 134 | ); // 300000毫秒等于5分钟 135 | 136 | 137 | if (url == '/mycourse/studentstudy') { 138 | _self.checkMobileBrowerLearn = $.noop; 139 | var classId = location.search.match(/cla[zs]{2}id=(\d+)/i)[1] || 0, 140 | courseId = _self.courseId || location.search.match(/courseId=(\d+)/i)[1] || 0; 141 | setting.lock || $('#coursetree').on('click', '[onclick*=void], [href*=void]', function () { 142 | _self.getTeacherAjax(courseId, classId, $(this).parent().attr('id').slice(3)); 143 | }); 144 | } else if (url == '/ananas/modules/video/index.html' && setting.video) { 145 | if (setting.review) _self.greenligth = Ext.emptyFn; 146 | checkPlayer(_self.supportH5Video()); 147 | click_bo(); 148 | } else if (url == '/work/doHomeWorkNew' || url == '/api/work' || url == '/work/addStudentWorkNewWeb' || url == '/mooc2/work/dowork') { 149 | console.log("进入答题界面!"); 150 | if (!UE) { 151 | var len = ($ || Ext.query || Array)('font:contains(未登录)', document).length; 152 | setTimeout(len == 1 ? top.location.reload : parent.greenligth, setting.time); 153 | } else if (setting.work) { 154 | setTimeout(relieveLimit, 0); 155 | beforeFind(); 156 | } 157 | } else if (url == '/ananas/modules/audio/index.html' && setting.audio) { 158 | if (setting.review) _self.greenligth = Ext.emptyFn; 159 | // _self.videojs = hookAudio; 160 | _self.alert = console.log; 161 | let OriginPlayer = _self.videojs.getComponent('Player') 162 | let woailiyinhe = function (tag, options, ready) { 163 | var config = options; 164 | config.plugins.studyControl.enableSwitchWindow = 1; 165 | config.plugins.seekBarControl.enableFastForward = 1; 166 | if (!setting.queue) delete config.plugins.studyControl; 167 | let player = OriginPlayer.call(this, tag, options, ready) 168 | var a = '', 169 | img = ''; 170 | player.volume(Math.round(setting.vol) / 100 || 0); 171 | player.playbackRate(setting.rate > 16 || setting.rate < 0.0625 ? 1 : setting.rate); 172 | Ext.get(player.controlBar.addChild('Button').el_).setHTML(a + img + '').dom.title = '下载音频'; 173 | player.on('loadeddata', function () { 174 | setting.tip && this.play().catch(Ext.emptyFn); 175 | }); 176 | player.one('firstplay', function () { 177 | setting.rate === '0' && config.plugins.seekBarControl.sendLog(this.children_[0], 'ended', Math.floor(this.cache_.duration)); 178 | }); 179 | player.on('ended', function () { 180 | Ext.fly(frameElement).parent().addCls('ans-job-finished'); 181 | }); 182 | return player; 183 | } 184 | woailiyinhe.prototype = Object.create(OriginPlayer.prototype) 185 | _self.videojs.getComponent('Component').components_['Player'] = woailiyinhe 186 | } else if (url == '/ananas/modules/innerbook/index.html' && setting.book && setting.tip) { 187 | setTimeout(function () { 188 | _self.setting ? _self.top.onchangepage(_self.getFrameAttr('end')) : _self.greenligth(); 189 | }, setting.time); 190 | } else if (url.match(/^\/ananas\/modules\/(ppt|pdf)\/index\.html$/) && setting.docs && setting.tip) { 191 | setTimeout(function () { 192 | _self.setting ? _self.finishJob() : _self.greenligth(); 193 | }, setting.time); 194 | frameElement.setAttribute('download', 1); 195 | } else if (url == '/knowledge/cards') { 196 | $ && checkToNext(); 197 | } else if (url.match(/^\/(course|zt)\/\d+\.html$/)) { 198 | setTimeout(function () { 199 | +setting.read && _self.sendLogs && $('.course_section:eq(0) .chapterText').click(); 200 | }, setting.time); 201 | } else if (url == '/ztnodedetailcontroller/visitnodedetail') { 202 | setting.read *= 60 / $('.course_section').length; 203 | setting.read && _self.sendLogs && autoRead(); 204 | } else if (url == '/mycourse/studentcourse') { 205 | var gv = location.search.match(/d=\d+&/g); 206 | setting.total && $('', { 207 | href: '/moocAnalysis/chapterStatisticByUser?classI' + gv[1] + 'courseI' + gv[0] + 'userId=' + _self.getCookie('_uid') + '&ut=s', 208 | target: '_blank', 209 | title: '点击查看章节统计', 210 | style: 'margin: 0 25px;', 211 | html: '本课程共' + $('.icon').length + '节,剩余' + $('em:not(.openlock)').length + '节未完成' 212 | }).appendTo('.zt_logo').parent().width('auto'); 213 | } else if (url.match(/^\/visit\/(courses|interaction)$/)) { 214 | setting.face && $('.zmodel').on('click', '[onclick^=openFaceTip]', DisplayURL); 215 | } else if (location.host.match(/^passport2/)) { 216 | setting.username && getSchoolId(); 217 | } else if (location.hostname == 'i.mooc.chaoxing.com') { 218 | _self.layui.use('layer', function () { 219 | this.layer.open({ 220 | content: '拖动进度条、倍速播放、秒过可能会导致不良记录!题库在慢慢补充,搜不到的题目系统会在全网检索并定时补充进题库。本脚本完全免费下载和使用,严禁倒卖!', 221 | title: 'Muketool超星网课助手提示', 222 | btn: '了解并继续使用', 223 | offset: 't', 224 | closeBtn: 0 225 | }); 226 | }); 227 | } else if (url == '/widget/pcvote/goStudentVotePage') { 228 | $(':checked').click(); 229 | $('.StudentTimu').each(function (index) { 230 | var ans = _self.questionlist[index].answer; 231 | $(':radio, :checkbox', this).each(function (num) { 232 | ans[num].isanswer && this.click(); 233 | }); 234 | $(':text', this).val(function (num) { 235 | return $(ans[num].content).text().trim(); 236 | }); 237 | }); 238 | } else if (url == '/work/selectWorkQuestionYiPiYue') { 239 | submitAnswer(getIframe().parent(), $.extend(true, [], parent._data)); 240 | } 241 | 242 | function getIframe(tip, win, job) { 243 | if (!$) return Ext.get(frameElement || []).parent().child('.ans-job-icon') || Ext.get([]); 244 | do { 245 | win = win ? win.parent : _self; 246 | job = $(win.frameElement).prevAll('.ans-job-icon'); 247 | } while (!job.length && win.parent.frameElement); 248 | return tip ? win : job; 249 | } 250 | 251 | function jobSort($) { 252 | var fn = $.fn ? [getIframe(1), 'length'] : [self, 'dom'], 253 | sel = setting.job.join(', :not(.ans-job-finished) > .ans-job-icon' + setting.normal + ' ~ '); 254 | if ($(sel, fn[0].parent.document)[0] == fn[0].frameElement) return true; 255 | if (!getIframe()[fn[1]] || getIframe().parent().is('.ans-job-finished')) return null; 256 | setInterval(function () { 257 | $(sel, fn[0].parent.document)[0] == fn[0].frameElement && fn[0].location.reload(); 258 | }, setting.time); 259 | } 260 | 261 | // 检查播放器 262 | function checkPlayer(tip) { 263 | _self.alert = console.log; 264 | let OriginPlayer = _self.videojs.getComponent('Player') 265 | let woailiyinhe = function (tag, options, ready) { 266 | let config = options 267 | if (!config) { 268 | return options; 269 | } 270 | var line = Ext.Array.filter(Ext.Array.map(config.playlines, function (value, index) { 271 | return value.label == setting.line && index; 272 | }), function (value) { 273 | return Ext.isNumber(value); 274 | })[0] || 0, http = Ext.Array.filter(config.sources, function (value) { 275 | return value.label == setting.http; 276 | })[0]; 277 | config.playbackRates = [0.5, 1, 1.5, 2, 4, 8, 16]; 278 | config.playlines.unshift(config.playlines[line]); 279 | config.playlines.splice(line + 1, 1); 280 | config.plugins.videoJsResolutionSwitcher.default = http ? http.res : 360; 281 | config.plugins.studyControl.enableSwitchWindow = 1; 282 | config.plugins.timelineObjects.url = '/richvideo/initdatawithviewer?'; 283 | config.plugins.seekBarControl.enableFastForward = 1; 284 | 285 | if (!setting.queue) delete config.plugins.studyControl; 286 | let player = OriginPlayer.call(this, tag, options, ready) 287 | var a = '', 288 | img = ''; 289 | player.playbackRate = function (t) { 290 | if (void 0 === t) return; 291 | this.tech_ && this.tech_.featuresPlaybackRate ? this.cache_.lastPlaybackRate || this.techGet_("playbackRate") : setting.rate; 292 | this.techCall_("setPlaybackRate", t) 293 | }; 294 | player.volume(Math.round(setting.vol) / 100 || 0); 295 | Ext.get(player.controlBar.addChild('Button').el_).setHTML(a + img + '').dom.title = '下载视频'; 296 | player.on('loadstart', function () { 297 | setting.tip && this.play().catch(Ext.emptyFn); 298 | this.playbackRate(setting.rate > 16 || setting.rate < 0.0625 ? 1 : setting.rate); 299 | }); 300 | player.one(['loadedmetadata', 'firstplay'], function () { 301 | setting.two = setting.rate === '0' && setting.two < 1; 302 | setting.two && config.plugins.seekBarControl.sendLog(this.children_[0], 'ended', Math.floor(this.cache_.duration)); 303 | }); 304 | player.on('ended', function () { 305 | Ext.fly(frameElement).parent().addCls('ans-job-finished'); 306 | }); 307 | return player; 308 | } 309 | woailiyinhe.prototype = Object.create(OriginPlayer.prototype) 310 | _self.videojs.getComponent('Component').components_['Player'] = woailiyinhe 311 | Ext.isSogou = Ext.isIos = Ext.isAndroid = false; 312 | var data = Ext.decode(_self.config('data')) || {}; 313 | delete data.danmaku; 314 | data.doublespeed = 1; 315 | frameElement.setAttribute('data', Ext.encode(data)); 316 | 317 | //_self.videojs = hookVideo; 318 | if (tip) return; 319 | _self.supportH5Video = function () { 320 | return true; 321 | }; 322 | alert('此浏览器不支持html5播放器,请更换浏览器(推荐使用微软Edge浏览器或谷歌Chrome浏览器)'); 323 | } 324 | 325 | 326 | function click_bo() { 327 | var interval = setInterval(function () { 328 | if (document.querySelector("#video > button")) { 329 | var video = document.getElementById("video_html5_api"); 330 | var video_url = video.src; 331 | var suspend = document.querySelector("#video > div.vjs-control-bar > button.vjs-play-control.vjs-control.vjs-button.vjs-paused"); 332 | if (getIframe().parent().is('.ans-job-finished')) { 333 | console.log("播放完毕"); 334 | GM_setValue("video_url", 0); 335 | clearInterval(interval); 336 | } else if (suspend && suspend.textContent == "播放" && video_url == GM_getValue("video_url")) { 337 | video.play(); 338 | } else if (document.querySelector("#video > button") && GM_getValue("video_url") == 0) { 339 | video.play(); 340 | GM_setValue("video_url", video_url); 341 | } 342 | if (document.querySelector('#video > div > div > button[title="静音"]') && setting.vol == "0") { 343 | video.muted = "0"; 344 | } 345 | 346 | } 347 | }, Math.floor(Math.random() * 3000) + 500); 348 | } 349 | 350 | function hookVideo() { 351 | } 352 | 353 | function relieveLimit() { 354 | if (setting.scale) _self.UEDITOR_CONFIG.scaleEnabled = false; 355 | $.each(UE.instants, function () { 356 | var key = this.key; 357 | this.ready(function () { 358 | this.destroy(); 359 | UE.getEditor(key); 360 | }); 361 | }); 362 | } 363 | 364 | function beforeFind() { 365 | setting.regl = parent.greenligth || $.noop; 366 | if ($.type(parent._data) == 'array') return setting.regl(); 367 | var maximize = $('
 ▣ 
').appendTo('body').click(function () { 368 | $(setting.div).css("display", "block"); 369 | GM_setValue("minimize", "0"); 370 | $(maximize).css("display", "none"); 371 | }); 372 | 373 | setting.div = $('
' + '' + '
正在搜索答案...
' + '
' + '
MukeTool 超星网课助手 官网:http://muketool.com
' + '
' + setting.notice + '
' + '' + '' + '' + '
' + '自动提交(慎重)' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
题号题目(点击可复制)答案(点击可复制)
答案提示框 已折叠
' + '
' + '
').appendTo('body').on('click', 'button, td, input', function () { 374 | var len = $(this).prevAll('button').length; 375 | if (this.nodeName == 'TD') { 376 | $(this).prev().length && GM_setClipboard($(this).text()); 377 | } else if (!$(this).siblings().length) { 378 | $(this).parent().text('正在搜索答案...'); 379 | setting.num++; 380 | } else if (len === 0) { 381 | if (setting.loop) { 382 | clearInterval(setting.loop); 383 | delete setting.loop; 384 | len = ['已暂停搜索', '继续答题']; 385 | } else { 386 | setting.loop = setInterval(findAnswer, setting.time); 387 | len = ['正在搜索答案...', '暂停答题']; 388 | } 389 | setting.div.children('div:eq(0)').html(function () { 390 | return $(this).data('html') || len[0]; 391 | }).removeData('html'); 392 | $(this).html(len[1]); 393 | } else if (len == 1) { 394 | setting.auto = !setting.auto; 395 | $(this).html(setting.auto ? '取消本次自动提交' : '开启本次自动提交'); 396 | } else if (len == 2) { 397 | parent.location.reload(); 398 | } else if (len == 3) { 399 | setting.div.find('tbody, tfoot').toggle(); 400 | } else if (this.id == "autosubmit") { 401 | // 题目自动提交配置 402 | console.log(this.checked); 403 | GM_setValue("autosubmit", this.checked); 404 | } 405 | }).on('click', 'minimize', function () { 406 | $(this).parent().parent().css("display", "none"); 407 | GM_setValue("minimize", "1"); 408 | $(maximize).css("display", "block"); 409 | }).find('table, td, th').css('border', '1px solid').end(); 410 | 411 | if (GM_getValue("minimize") == "1") { 412 | $(setting.div).css("display", "none"); 413 | $(maximize).css("display", "block"); 414 | } 415 | 416 | setting.lose = setting.num = 0; 417 | setting.data = parent._data = []; 418 | setting.over = ''; 419 | setting.curs = $('script:contains(courseName)', top.document).text().match(/courseName:\'(.+?)\'|$/)[1] || $('h1').text().trim() || '无'; 420 | setting.loop = setInterval(findAnswer, setting.time); 421 | var tip = ({ 422 | undefined: '任务点排队中', null: '等待切换中' 423 | })[setting.tip]; 424 | tip && setting.div.children('div:eq(0)').data('html', tip).siblings('button:eq(0)').click(); 425 | 426 | // 消息通知及版本更新检测 427 | GM_xmlhttpRequest({ 428 | method: 'GET', 429 | url: setting.tiku + '/notice?script=' + setting.script + '&version=' + setting.version, 430 | timeout: setting.time, 431 | onload: function (xhr) { 432 | if (xhr.status == 200) { 433 | var obj = $.parseJSON(xhr.responseText) || {}; 434 | setting.notice = obj.injection; 435 | document.querySelector('#cx-notice').innerHTML = setting.notice; 436 | } 437 | }, 438 | ontimeout: function () { 439 | setting.loop && setting.div.children('div:eq(0)').html(setting.over + '服务器超时,正在重试...'); 440 | } 441 | }); 442 | } 443 | 444 | function findAnswer() { 445 | if (setting.num >= $('.TiMu').length) { 446 | var arr = setting.lose ? ['有 ' + setting.lose + ' 道题目匹配到的答案可能不准确(已红色高亮提示)', saveThis] : ['答题已完成', submitThis]; 447 | setting.div.children('div:eq(0)').data('html', arr[0]).siblings('button:eq(0)').hide().click(); 448 | return setTimeout(arr[1], setting.time); 449 | } 450 | var $TiMu = $('.TiMu').eq(setting.num), 451 | question = filterImg($TiMu.find('.Zy_TItle:eq(0) .clearfix')).replace(/^【.*?】\s*/, '').replace(/\s*(\d+\.\d+分)$/, '').replace(/[(]\s*[)]。$/, '').replace(/(\s*)。$/, '').replace(/[(]\s*[)]$/, '').replace(/(\s*)$/, '').replace(/。$/, ''), 452 | type = $TiMu.find('input[name^=answertype]:eq(0)').val() || '-1'; 453 | 454 | console.log($TiMu); 455 | 456 | if (question == "") { 457 | question = filterImg($TiMu.find('.mark_name:eq(0) .colorDeep')); 458 | } 459 | console.log($TiMu.find('.mark_name:eq(0) .colorDeep')); 460 | 461 | // 通过接口获取试题答案。如果需要使用第三方接口请视情况修改 462 | GM_xmlhttpRequest({ 463 | method: 'POST', 464 | url: setting.tiku + '/v1/cx', 465 | headers: { 466 | 'Content-type': 'application/x-www-form-urlencoded', 467 | }, 468 | data: 'question=' + encodeURIComponent(question) + '&script=' + setting.script + '&id=' + ($('#workLibraryId').val() || $('#oldWorkId').val()), 469 | timeout: setting.time, 470 | onload: function (xhr) { 471 | if (!setting.loop) { 472 | } else if (xhr.status == 200) { 473 | var obj = $.parseJSON(xhr.responseText) || {}; 474 | obj.answer = obj.data; 475 | if (obj.code) { 476 | setting.div.children('div:eq(0)').text('正在搜索答案...'); 477 | var td = '' : obj.answer; 480 | $('' + td + ' text-align: center;">' + $TiMu.find('.Zy_TItle:eq(0) i').text().trim() + '' + td + '" title="点击可复制">' + (question.match('' + td + '" title="点击可复制">' + (/^http/.test(answer) ? obj.answer : '') + answer + '' + '').appendTo(setting.div.find('tbody')).css('background-color', fillAnswer($TiMu.find('ul:eq(0)').find('li'), obj, type) ? '' : '#ED4C78'); 481 | setting.data[setting.num++] = { 482 | code: obj.code > 0 ? 1 : 0, question: question, option: obj.answer, type: Number(type) 483 | }; 484 | } else { 485 | setting.div.children('div:eq(0)').html(obj.answer || setting.over + '服务器繁忙,正在重试......'); 486 | } 487 | setting.div.children('span').html(obj.msg || ''); 488 | } else if (xhr.status == 403) { 489 | var html = xhr.responseText.indexOf('{') ? '请求过于频繁,请稍后再试......' : $.parseJSON(xhr.responseText).data; 490 | setting.div.children('div:eq(0)').data('html', html).siblings('button:eq(0)').click(); 491 | } else if (xhr.status == 500) { 492 | setting.div.children('div:eq(0)').html('题库接口状态异常,请稍后重新搜索......'); 493 | } else { 494 | setting.div.children('div:eq(0)').html('题库请求异常,可能被恶意攻击了,请等待恢复......'); 495 | } 496 | }, 497 | ontimeout: function () { 498 | setting.loop && setting.div.children('div:eq(0)').html(setting.over + '服务器超时,正在重试...'); 499 | } 500 | }); 501 | } 502 | 503 | function fillAnswer($li, obj, type) { 504 | var $input = $li.find(':radio, :checkbox'), str = String(obj.answer).toCDB() || new Date().toString(), 505 | data = str.split(/#|\x01|\|/), opt = obj.opt || str, state = setting.lose; 506 | // $li.find(':radio:checked').prop('checked', false); 507 | obj.code > 0 && $input.each(function (index) { 508 | if (this.value == 'true') { 509 | data.join().match(/(^|,)(正确|是|对|√|T|true|ri)(,|$)/) && this.click(); 510 | } else if (this.value == 'false') { 511 | data.join().match(/(^|,)(错误|否|错|×|F|false|wr)(,|$)/) && this.click(); 512 | } else { 513 | var tip = filterImg($li.eq(index).find('.after')).toCDB() || new Date().toString(); 514 | Boolean($.inArray(tip, data) + 1 || (type == '1' && str.indexOf(tip) + 1)) == this.checked || this.click(); 515 | } 516 | }).each(function () { 517 | if (!/^A?B?C?D?E?F?G?$/.test(opt)) return false; 518 | Boolean(opt.match(this.value)) == this.checked || this.click(); 519 | }); 520 | if (type.match(/^[013]$/)) { 521 | $input.is(':checked') || (setting.none ? ($input[Math.floor(Math.random() * $input.length)] || $()).click() : setting.lose++); 522 | } else if (type.match(/^(2|[4-9]|1[08])$/)) { 523 | data = String(obj.answer).split(/#|\x01|\|/); 524 | str = $li.end().find('textarea').each(function (index) { 525 | index = (obj.code > 0 && data[index]) || ''; 526 | if (obj.code > 0) { 527 | UE.getEditor(this.name).setContent(index.trim()); 528 | } 529 | }).length; 530 | (obj.code > 0 && data.length == str) || setting.none || setting.lose++; 531 | } else { 532 | setting.none || setting.lose++; 533 | } 534 | return state == setting.lose; 535 | } 536 | 537 | function saveThis() { 538 | if (!setting.auto) return setTimeout(saveThis, setting.time); 539 | setting.div.children('button:lt(3)').hide().eq(1).click(); 540 | _self.alert = console.log; 541 | $('#tempsave').click(); 542 | setting.regl(); 543 | } 544 | 545 | function submitThis() { 546 | if (!setting.auto) { 547 | } else if (!$('.Btn_blue_1:visible').length) { 548 | setting.div.children('button:lt(3)').hide().eq(1).click(); 549 | return setting.regl(); 550 | } else if ($('#confirmSubWin:visible').length) { 551 | var btn = $('#tipContent + * > a').offset() || { 552 | top: 0, left: 0 553 | }, mouse = document.createEvent('MouseEvents'); 554 | btn = [btn.left + Math.ceil(Math.random() * 46), btn.top + Math.ceil(Math.random() * 26)]; 555 | mouse.initMouseEvent('click', true, true, document.defaultView, 0, 0, 0, btn[0], btn[1], false, false, false, false, 0, null); 556 | _self.event = $.extend(true, {}, mouse); 557 | delete _self.event.isTrusted; 558 | _self.form1submit(); 559 | } else { 560 | $('.Btn_blue_1')[0].click(); 561 | } 562 | setTimeout(submitThis, Math.ceil(setting.time * Math.random()) * 2); 563 | } 564 | 565 | function checkToNext() { 566 | var $tip = $(setting.job.join(', '), document).prevAll('.ans-job-icon' + setting.normal); 567 | console.log($tip); 568 | setInterval(function () { 569 | console.log($tip.parent(':not(.ans-job-finished)').length); 570 | 571 | if (parent.location.search.match(/mooc2=(\d+)/i) != null) { 572 | $tip.parent(':not(.ans-job-finished)').length || setting.jump && toNext1(); 573 | } else { 574 | $tip.parent(':not(.ans-job-finished)').length || setting.jump && toNext(); 575 | } 576 | }, setting.time); 577 | } 578 | 579 | function toNext() { 580 | var $cur = $('#cur' + $('#chapterIdid').val()), $tip = $('span.currents ~ span'), 581 | sel = setting.review ? 'html' : '.blue'; 582 | if (!$cur.has(sel).length && $tip.length) return $tip.eq(0).click(); 583 | $tip = $('.roundpointStudent, .roundpoint').parent(); 584 | $tip = $tip.slice($tip.index($cur) + 1).not(':has(' + sel + ')'); 585 | $tip.not(setting.lock ? ':has(.lock)' : 'html').find('span').eq(0).click(); 586 | $tip.length || setting.course && switchCourse(); 587 | } 588 | 589 | function toNext1() { 590 | if ($(".prev_ul").find("li.active").next().length) { 591 | $(".prev_ul").find("li.active").next().click(); 592 | } else { 593 | var pnex = $(".posCatalog_select").slice($(".posCatalog_select").index($(".posCatalog_active")) + 1).find(".jobUnfinishCount").parent().eq(0); 594 | pnex.length || setting.course && switchCourse(); 595 | pnex.find("span").click(); 596 | } 597 | } 598 | 599 | 600 | function switchCourse() { 601 | console.log("课程切换"); 602 | GM_xmlhttpRequest({ 603 | method: 'POST', 604 | url: '/visit/courselistdata', 605 | data: "courseType=1&courseFolderId=0&courseFolderSize=0", 606 | headers: { 607 | 'X-Requested-With': 'XMLHttpRequest', 608 | "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", 609 | "Host": "mooc1-1.chaoxing.com", 610 | "Origin": "https://mooc1-1.chaoxing.com" 611 | }, 612 | onload: function (xhr) { 613 | 614 | var list = $('h3 a[target]', xhr.responseText).map(function () { 615 | return $(this).attr('href'); 616 | }); 617 | var index = list.map(function (index) { 618 | return this.match(top.courseId) && index; 619 | }).filter(function () { 620 | return $.isNumeric(this); 621 | })[0] + 1 || 0; 622 | setting.course = list[index] ? goCourse(list, index) : 0; 623 | } 624 | }); 625 | } 626 | 627 | function goCourse(list, index) { 628 | url = list[index]; 629 | url = "/visit" + url.split("/visit")[1]; 630 | GM_xmlhttpRequest({ 631 | method: 'GET', url: url, onload: function (xhr) { 632 | var knowurl = $('h3 a[href]', xhr.responseText).attr('href'); 633 | knowurl == undefined ? goCourse(list, index + 1) : $.globalEval('location.href = "' + $('h3 a[href]', xhr.responseText).attr('href') + '";'); 634 | } 635 | }); 636 | } 637 | 638 | function autoRead() { 639 | $('html, body').animate({ 640 | scrollTop: $(document).height() - $(window).height() 641 | }, Math.round(setting.read) * 1E3, function () { 642 | $('.nodeItem.r i').click(); 643 | }).one('click', '#top', function (event) { 644 | $(event.delegateTarget).stop(); 645 | }); 646 | } 647 | 648 | function DisplayURL() { 649 | _self.WAY.box.hide(); 650 | var $li = $(this).closest('li'); 651 | $.get('/visit/goToCourseByFace', { 652 | courseId: $li.find('input[name=courseId]').val(), clazzId: $li.find('input[name=classId]').val() 653 | }, function (data) { 654 | $li.find('[onclick^=openFaceTip]').removeAttr('onclick').attr({ 655 | target: '_blank', href: $(data).filter('script:last').text().match(/n\("(.+?)"/)[1] 656 | }); 657 | alert('本课程已临时解除面部识别'); 658 | }, 'html'); 659 | } 660 | 661 | function getSchoolId() { 662 | var school = /^1\d{10}$/.test(setting.username) ? '' : setting.school; 663 | if (!isNaN(school)) return setTimeout(toLogin, setting.time, school); 664 | if (school == '账号为手机号可以不修改此参数') return alert('请修改school参数'); 665 | $.getJSON('/org/searchUnis?filter=' + encodeURI(school) + '&product=44', function (data) { 666 | if (!data.result) return alert('学校查询错误'); 667 | var msg = $.grep(data.froms, function (value) { 668 | return value.name == school; 669 | })[0]; 670 | msg ? setTimeout(toLogin, setting.time, msg.schoolid) : alert('学校名称不完整'); 671 | }); 672 | } 673 | 674 | function toLogin(fid) { 675 | GM_xmlhttpRequest({ 676 | method: 'GET', 677 | url: '/api/login?name=' + setting.username + '&pwd=' + setting.password + '&schoolid=' + fid + '&verify=0', 678 | onload: function (xhr) { 679 | var obj = $.parseJSON(xhr.responseText) || {}; 680 | obj.result ? location.href = decodeURIComponent($('#ref, #refer_0x001').val()) : alert(obj.errorMsg || 'Error'); 681 | } 682 | }); 683 | } 684 | 685 | function submitAnswer($job, data) { 686 | $job.removeClass('ans-job-finished'); 687 | data = data.length ? $(data) : $('.TiMu').map(function () { 688 | var title = filterImg($('.Zy_TItle .clearfix', this)); 689 | return { 690 | question: title.replace(/^【.*?】\s*/, ''), type: ({ 691 | 单选题: 0, 多选题: 1, 填空题: 2, 判断题: 3 692 | })[title.match(/^【(.*?)】|$/)[1]] 693 | }; 694 | }); 695 | data = $.grep(data.map(function (index) { 696 | var $TiMu = $('.TiMu').eq(index); 697 | if (!($.isPlainObject(this) && this.type < 4 && $TiMu.find('.fr').length)) { 698 | return false; 699 | } else if (this.type == 2) { 700 | var $ans = $TiMu.find('.Py_tk, .Py_answer').eq(0); 701 | if (!$TiMu.find('.cuo').length && this.code) { 702 | return false; 703 | } else if (!$ans.find('.cuo').length) { 704 | this.option = $ans.find('.clearfix').map(function () { 705 | return $(this).text().trim(); 706 | }).get().join('#') || '无'; 707 | } else if (this.code) { 708 | this.code = -1; 709 | } else { 710 | return false; 711 | } 712 | } else if (this.type == 3) { 713 | var ans = $TiMu.find('.font20:last').text(); 714 | if ($TiMu.find('.cuo').length) { 715 | this.option = ({ 716 | '√': '错误', '×': '正确' 717 | })[ans] || '无'; 718 | } else if (!this.code) { 719 | this.option = ({ 720 | '√': '正确', '×': '错误' 721 | })[ans] || '无'; 722 | } else { 723 | return false; 724 | } 725 | } else { 726 | var text = $TiMu.find('.Py_answer > span:eq(0)').text(); 727 | if ($TiMu.find('.dui').length && this.code && !/^A?B?C?D?E?F?G?$/.test(this.option)) { 728 | return false; 729 | } else if ($TiMu.find('.dui').length || text.match('正确答案')) { 730 | text = text.match(/[A-G]/gi) || []; 731 | this.option = $.map(text, function (value) { 732 | return filterImg($TiMu.find('.fl:contains(' + value + ') + a')); 733 | }).join('#') || '无'; 734 | this.key = text.join(''); 735 | } else if (this.code) { 736 | this.code = -1; 737 | } else { 738 | return false; 739 | } 740 | } 741 | return this; 742 | }), function (value) { 743 | return value && value.option != '无'; 744 | }); 745 | setting.curs = $('script:contains(courseName)', top.document).text().match(/courseName:\'(.+?)\'|$/)[1] || $('h1').text().trim() || '无'; 746 | data.length && GM_xmlhttpRequest({ 747 | method: 'POST', 748 | url: setting.tiku + '/upload?workRelationId=' + $('#workId').val(), 749 | headers: { 750 | 'Content-type': 'application/x-www-form-urlencoded', 751 | }, 752 | data: 'course=' + encodeURIComponent(setting.curs) + '&data=' + encodeURIComponent((Ext.encode || JSON.stringify)(data)) + '&id=' + $('#jobid').val().slice(5) 753 | }); 754 | $job.addClass('ans-job-finished'); 755 | } 756 | 757 | function filterImg(dom) { 758 | return $(dom).clone().find('img[src]').replaceWith(function () { 759 | return $('

').text(''); 760 | }).end().find('iframe[src]').replaceWith(function () { 761 | return $('

').text('