🏠 Home 

超星便捷

视频解除鼠标限制,允许快进、拖动,PDF快速翻页、跳转,作业允许粘贴(请勿大量刷课,封号斗罗警告)


ติดตั้งสคริปต์นี้?
สคริปต์ที่แนะนำของผู้เขียน

คุณอาจชื่นชอบ 腾讯课堂、超星自动签到(新版)


ติดตั้งสคริปต์นี้
  1. // ==UserScript==
  2. // @name 超星便捷
  3. // @description 视频解除鼠标限制,允许快进、拖动,PDF快速翻页、跳转,作业允许粘贴(请勿大量刷课,封号斗罗警告)
  4. // @namespace ####ChaoxingScript
  5. // @author 涛之雨
  6. // @version 1.4.8
  7. // @grant GM_addStyle
  8. // @run-at document-start
  9. // @require https://greasyfork.org/scripts/18715-hooks/code/Hooks.js?version=661566
  10. // @require https://libs.baidu.com/jquery/2.1.4/jquery.min.js
  11. // @require https://greasyfork.org/scripts/29782-docsready/code/docsReady.js?version=603417
  12. // @require https://greasyfork.org/scripts/399356-dtoast/code/DToast.js?version=787349
  13. // @match *://*.fanya.chaoxing.com/*
  14. // @match *://i.mooc.chaoxing.com/*
  15. // @match *://*.chaoxing.com/space/*
  16. // @match *://*.chaoxing.com/mycourse/studentcourse*
  17. // @match *://*.chaoxing.com/mycourse/studentstudy*
  18. // @match *://*.chaoxing.com/ananas/modules/pdf/index.html*
  19. // @match *://*.chaoxing.com/ananas/modules/ppt/index.html*
  20. // @match *://*.chaoxing.com/ananas/modules/video/index.html*
  21. // @match *://*.chaoxing.com/ananas/modules/work/index.html*
  22. // @match *://*.chaoxing.com/work/doHomeWorkNew*
  23. // @match *://*.chaoxing.com/knowledge/cards*
  24. // @license BSD 2-Clause
  25. // @icon https://i.loli.net/2020/03/04/D3h1iWSFeyc8AKG.png
  26. // @home-url https://greasyfork.org/zh-CN/scripts/403935
  27. // ==/UserScript==
  28. //借鉴:https://greasyfork.org/zh-CN/scripts/20059-chaoxing
  29. // #### Chaoxing
  30. //新版本的是flash内的判断,上面的脚本已失效
  31. /**************************\
  32. * V1.4.8
  33. * 修复了对新版ppt/pdf按钮的适配问题
  34. * V1.4.7
  35. * 对新版视频播放器的适配(怎么又更新了。。。)
  36. * V1.4.6
  37. * 新增Ctrl+左右键快速跳转首末页
  38. * 修复按键绑定事异常
  39. * 修复对于图片加载的判定报错问题
  40. * V1.4.5
  41. * 修复页面旧数据无效导致的bug
  42. * V1.4.4
  43. * 修复部分历史问题,增加稳定性和纠正语法错误
  44. * 新增考试/作业见面Ctrl+s随手保存功能(防止手滑)
  45. * 新增对新版的PPT页面支持
  46. * V1.4.3
  47. * 删除超星和腾讯课堂的签到支持,单独抽取出新的脚本
  48. * 参见:https://greasyfork.org/zh-CN/scripts/401115
  49. * V1.4.2
  50. * 适配新版超星的PDF/PPT翻页(天天要重新适配(╬ ̄皿 ̄)=○)
  51. * 顺便精简了部分的代码
  52. * V1.4.1
  53. * 增加了一个右下角的HOME图标(其实没啥用。。。)
  54. * 精简代码,删除臃肿部分
  55. * 优化了流程,(大更改。。。新旧版本的比较可以查看我的git小站)
  56. * 删除了所有注释。。。。(其实是不小心删除的。。。。。)
  57. * 如果需要看注释请查看旧版本(链接:http://taozhiyu.rthe.net/####cx_52_v1.3.11_backup.js)
  58. *
  59. * V1.3.12
  60. * 修改了部分遮挡文本的布局
  61. * 增加PDF/PPT页面左右按键快速翻页
  62. * 增加视频上下(音量增减)左右(快退进)空格(暂停/播放)的按键操作
  63. * 增加了一些奇怪的文字
  64. * V1.3.11
  65. * 增加对于非任务点的视频页面切换的支持(互相切换按钮)
  66. * V1.3.10
  67. * 修复了对于非任务PDF/PPT界面
  68. * 对部分流程进行了优化
  69. * 增加对于不同版本的适配,之前咱不知道啊(╬ ̄皿 ̄)=○
  70. * 增加了视屏倍速的选择框和视频实际倍速同步的功能
  71. * V1.3.9
  72. * 修复了对于视屏倍速的重新适配
  73. * 精简了部分代码
  74. * V1.3.8
  75. * 修复了新版ppt/pdf页面动态加载导致无法快速跳转的bug
  76. * 修复了【作业】界面提示文字不显示的bug
  77. * V1.3.7
  78. * 修复了部分ppt/pdf页面只有一页时跳转功能显示和点击跳转后出错的bug
  79. * 修复了对于部分学校视频界面显示不全的bug
  80. * V1.3.6
  81. * 增加了对于ppt页面的适配(参见pdf的功能)
  82. * V1.3.5
  83. * 增加了快速跳转到某一页
  84. * 增加了对于【拓展】页面视频的支持
  85. * V1.3.4
  86. * 增加了PDF快速跳转到某一页
  87. * V1.3.3
  88. * 增加了取消作业界面禁止粘贴的限制
  89. * 增加了对于PDF页面2分钟后显示上下页时间的修改(改为1秒)和渐隐插件未生效提醒
  90. * 增加了对于学习所有网页的图标支持
  91. * 多视频时视频同时自动播放,混乱,去除。
  92. * V1.3.2
  93. * 增加了对于PDF的时长强制改为1秒钟(我们学校为2分钟一页)
  94. * 增加了5秒后视频自动播放
  95. * V1.3.1
  96. * 增加了对于新版json的支持
  97. \**************************/
  98. (function () {
  99. /* if (location.href.match(/studentstudy/) !== null||location.href.match(/mooc/) !== null||location.href.match(/studentcourse/) !== null||location.href.match(/fanya/) !== null||location.href.match(/space/) !== null) {
  100. if(top.location==self.location){
  101. $(document).ready(function () {
  102. var home_btn = document.createElement("div");
  103. home_btn.id = 'home_tao';
  104. home_btn.title = "涛之雨的小站";
  105. home_btn.style = "transform: rotate(0deg);background: url('https:\/\/s1.ax1x.com/2020/03/30/GnMT6U.png') no-repeat center center;width: 60px;height: 60px;position: fixed;right: 0px;bottom: 10px;z-index: 999999999;cursor: pointer;border: 4px solid #00bdff96;border-radius: 50%;background-size: 100% 100%;box-sizing: border-box;";
  106. $("body")[0].append(home_btn);
  107. var TaoW = $('#home_tao')[0].offsetWidth;
  108. var TaoH = $('#home_tao')[0].offsetHeight;
  109. var cuntW = 0;
  110. var cuntH = 0;
  111. var wait_out;
  112. $('#home_tao')[0].onmouseover = function () {
  113. this.style.transition = '0.5s';
  114. move(0, 0);
  115. rate(0);
  116. if (!!wait_out) {
  117. clearTimeout(wait_out);
  118. }
  119. };
  120. $('#home_tao')[0].onmouseout = function () {
  121. this.style.transition = '0.5s';
  122. if (!!wait_out) {
  123. clearTimeout(wait_out);
  124. }
  125. wait_out = setTimeout(function () {
  126. move(TaoW / 2, TaoH / 2);
  127. rate(-90);
  128. }, 700);
  129. };
  130. window.onresize = function () {
  131. var bodyH = document.body.offsetHeight;
  132. var TaoT = $('#home_tao')[0].offsetTop;
  133. var bodyW = document.body.offsetWidth;
  134. var TaoL = $('#home_tao')[0].offsetLeft;
  135. if (TaoT + TaoH > bodyH) {
  136. $('#home_tao')[0].style.top = bodyH - TaoH + 'px';
  137. cuntH++;
  138. }
  139. if (bodyH > TaoT && cuntH > 0) {
  140. $('#home_tao')[0].style.top = bodyH - TaoH + 'px';
  141. }
  142. if (TaoL + TaoW > bodyW) {
  143. $('#home_tao')[0].style.left = bodyW - TaoW + 'px';
  144. cuntW++;
  145. }
  146. if (bodyW > TaoL && cuntW > 0) {
  147. $('#home_tao')[0].style.left = bodyW - TaoW + 'px';
  148. }
  149. move(TaoW / 2, TaoH / 2);
  150. };
  151. function move(w, h) {
  152. $('#home_tao')[0].style.left = document.body.offsetWidth - TaoW + w + 'px';
  153. }
  154. function rate(a) {
  155. $('#home_tao')[0].style.transform = 'rotate(' + a + 'deg)';
  156. }
  157. setTimeout(function () {
  158. var wait_out;
  159. $('#home_tao')[0].style.transition = '0.5s';
  160. move(TaoW / 2, TaoH / 2);
  161. rate(-90);
  162. } , 5000);
  163. $("#home_tao").click(function () {
  164. alert("虽然啥都没有。。。但是既然把你骗来了,就看看吧\n");
  165. var window_tab = window.open('');
  166. window_tab.location = 'https://taozhiyu.gitee.io';
  167. });
  168. $(document).keydown(function (event) {
  169. var e = event || window.event;
  170. if (e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 37 || e.keyCode === 39 || e.keyCode === 32) {
  171. e.preventDefault();
  172. }
  173. });
  174. });
  175. }
  176. } */
  177. function set_icon() {
  178. var link = document.createElement('link');
  179. link.type = 'image/x-icon';
  180. link.rel = 'icon';
  181. link.href = 'https://i.loli.net/2020/03/04/D3h1iWSFeyc8AKG.png';
  182. document.getElementsByTagName('head')[0].appendChild(link);
  183. var link2 = document.createElement('link');
  184. link2.type = 'image/x-icon';
  185. link2.rel = 'shortcut icon';
  186. link2.href = 'https://i.loli.net/2020/03/04/D3h1iWSFeyc8AKG.png';
  187. document.getElementsByTagName('head')[0].appendChild(link2);
  188. }
  189. set_icon();
  190. if (location.href.match(/knowledge\/cards/) !== null) {
  191. window.onload = function () {
  192. $(document).keydown(function (event) {
  193. var e = event || window.event;
  194. if (e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 37 || e.keyCode === 39 || e.keyCode === 32) {
  195. e.preventDefault();
  196. }
  197. });
  198. if ($("iframe").length !== 0) {
  199. console.log("%c当前界面有%c" + $("iframe").length + "个%c学习子页面","color:black","color:red;font-size:20px","color:black");
  200. $("iframe").each(function () {
  201. var src_ = $(this)[0].src;
  202. if (src_.match(/video/) !== null) {
  203. var data_json = $.parseJSON($(this)[0].getAttribute('data').toString());
  204. data_json.danmaku=0;
  205. data_json.fastforward=false;
  206. data_json.switchwindow=false;
  207. $(this)[0].setAttribute('data', JSON.stringify(data_json));
  208. $(this)[0].style.height = "645px";
  209. $(this)[0].src=$(this)[0].src;
  210. }
  211. if (src_.match(/doHomeWorkNew/) !== null) {
  212. $(".ans-job-icon")[0].style.width = "100%";
  213. var homeWork_view = '<p style="color:blue;float:right;font-size: 13px;">允许粘贴&nbsp;:涛之雨&nbsp;&nbsp;如果失效,可以按【F5】键刷新(注意保存哦)</p>';
  214. $(".ans-job-icon").append(homeWork_view);
  215. }
  216. if (src_.match(/pdf/) !== null || src_.match(/ppt/) !== null) {
  217. top.window.scrollBy(0, 241);
  218. }
  219. });
  220. }
  221. };
  222. }
  223. if (location.href.match(/pdf/) !== null || location.href.match(/ppt/) !== null) {
  224. $(document).ready(function() {
  225. GM_addStyle(".imglook{height:unset!important;}");});
  226. window.onload = function () {
  227. var check_page=function (page) {
  228. Number(page) != Number(endpage) ? $("#btn_r")[0].style.display = "" : $("#btn_r")[0].style.display = "none";
  229. Number(page) != 1 ? $("#btn_l")[0].style.display = "" : $("#btn_l")[0].style.display = "none";
  230. };
  231. var PDF_div, myDiv, mychooseDiv, choose_div,isok=false;
  232. function kbd_page(event) {
  233. var e = event || window.event, ev;
  234. if (e && e.keyCode === 37&&e.ctrlKey) {
  235. $("#btn_l")[0].click();
  236. return false;
  237. }
  238. else if (e && e.keyCode === 39&&e.ctrlKey) {
  239. $("#btn_r")[0].click();
  240. return false;
  241. }
  242. else if (e && e.keyCode === 37) {
  243. if (Number($(".num")[0].innerHTML) > 1) {
  244. $(".preBtn")[0].click();
  245. }
  246. else {
  247. alert("这已经是第一页了。我怀疑你再搞事情但是我没有证据\n打洗你 (╬ ̄皿 ̄)=○#( ̄#)3 ̄) ");
  248. }
  249. return false;
  250. }
  251. else if (e && e.keyCode === 39) {
  252. if (Number($(".num")[0].innerHTML) < endpage) {
  253. $(".nextBtn")[0].click();
  254. }
  255. else {
  256. alert("已经到最后了。。。。。\n学习也不至于这么投入吧。。。。");
  257. }
  258. return false;
  259. }
  260. else if (e && e.keyCode === 38) {
  261. $(".imglook")[0].scrollTop -= 30;
  262. }
  263. else if (e && e.keyCode === 40) {
  264. $(".imglook")[0].scrollTop += 30;
  265. }
  266. }
  267. var data_json = $.parseJSON(window.frameElement.getAttribute('data').toString());
  268. if (data_json.jobid || data_json.btime) {
  269. var endpage=-1;
  270. try{
  271. endpage= window.data.pagenum;
  272. }catch(e){}
  273. if(endpage==-1){
  274. var get_endpage = setInterval(function () {
  275. //window.data.timing = 1;
  276. if ($(".documentImg").length!==0&&$(".documentImg")[0]!==undefined&&$(".documentImg")[0].complete&&isok) {
  277. clearInterval(get_endpage);
  278. endpage = Number($(".all")[0].innerHTML);
  279. check_page(Number($(".num")[0].innerHTML));
  280. }
  281. }, 10);
  282. }else{
  283. setTimeout(()=>{check_page(endpage);},1000);
  284. }
  285. try{
  286. window.data.timing = 0;
  287. }catch(w){}
  288. function newbutton(){
  289. var setButton = setTimeout(function () {
  290. if(document.querySelectorAll(".turnpage_Btn").length==0){
  291. clearTimeout(setButton);
  292. newbutton();
  293. }
  294. var pdf_i = 0, pdf_timeout = 0;
  295. var pi_times = 0;
  296. PDF_div = '<p style="color:red;position:fixed;top:0;left:0;width:100%;font-size: 10px;opacity:1">PDF上下页强制显示&第一页最后一页&页面跳转&nbsp;:涛之雨</br>第一次加载可能比较慢,如果页面加载完,“前后页”和“第一/最后一页”按钮5秒钟内没有出现,请按【F5】键刷新</p>';
  297. myDiv = document.createElement("div");
  298. myDiv.id = 'mysellectid';
  299. document.querySelectorAll(".turnpage_Btn")[0].insertBefore(myDiv, document.querySelectorAll(".turnpage_Btn")[0].children[0].firstChild);
  300. $("#mysellectid").append(PDF_div);
  301. var btnl = document.createElement("div");
  302. btnl.id = 'btn_l';
  303. btnl.title = "第一页";
  304. btnl.style = "display:none;background: url(https://s2.ax1x.com/2020/03/09/8pKLNQ.png) no-repeat;width: 60px;height: 60px;position: fixed;left: 20px;top: 50%;margin-top: -30px;z-index: 10;cursor: pointer;";
  305. $(".imglook")[0].insertBefore(btnl, $(".imglook")[0].firstChild);
  306. var btnr = document.createElement("div");
  307. btnr.id = 'btn_r';
  308. btnr.title = "最后一页";
  309. btnr.style = "display:none;background: url(https://s2.ax1x.com/2020/03/09/8pKOhj.png) no-repeat;width: 60px;height: 60px;position: fixed;right: 20px;top: 50%;margin-top: -30px;z-index: 10;cursor: pointer;";
  310. $(".imglook")[0].insertBefore(btnr, $(".imglook")[0].firstChild);
  311. //$(".mkeLbtn")[0].style.marginTop = "-120px";
  312. //$(".mkeRbtn")[0].style.marginTop = "-120px";
  313. var mygotopage = document.createElement("span");
  314. mygotopage.innerHTML = "跳转到第[<input id='goto_num' style='width:20px;BACKGROUND-COLOR:aliceblue;BORDER-RIGHT: 0px solid; BORDER-TOP: 0px solid; BORDER-LEFT: 0px solid; BORDER-BOTTOM: 0px solid;' type='editor'/>]页";
  315. //$(".mkeNum")[0].insertBefore(mygotopage, $(".mkeNum")[0].lastChild);
  316. var tip_keydown = document.createElement("span");
  317. tip_keydown.innerHTML = "<span style='font-size:2px;color:blue'> POWER BY:涛之雨</span>";//<font color='blue' style='font-size:2px;'>支持左右键翻页,Ctrl+左右键首/末页</font>";
  318. $(".fl.pageInfo").append(tip_keydown);
  319. isok=true;
  320. var show_pdf=function () {
  321. pi_times = 0;
  322. clearInterval(pdf_i);
  323. clearTimeout(pdf_timeout);
  324. $("#mysellectid")[0].style.opacity = 1;
  325. pdf_timeout = setTimeout(function () {
  326. pdf_i = setInterval(function () {
  327. if ($("#mysellectid")[0].style.opacity <= 0) {
  328. $("#mysellectid")[0].style.opacity = 0;
  329. $("#mysellectid")[0].innerHTML = '<p style="color:blue;position:fixed;top:0;left:0;width:100%;font-size: 10px;opacity:1">PDF上下页强制显示&第一页最后一页&页面跳转&nbsp;:涛之雨</p>';
  330. clearInterval(pdf_i);
  331. }else{
  332. $("#mysellectid")[0].style.opacity -= 0.07;
  333. }
  334. }, 100);
  335. }, 5000);
  336. };
  337. $(".preBtn")[0].onclick = function () {
  338. check_page(Number($(".num")[0].innerHTML));
  339. show_pdf();
  340. };
  341. $(".nextBtn")[0].onclick = function () {
  342. check_page(Number($(".num")[0].innerHTML));
  343. show_pdf();
  344. };
  345. show_pdf();
  346. var changePage=function (endnum = endpage) {
  347. var isNext = true, a = Number(endnum) - Number($(".num")[0].innerHTML);
  348. a === 0 ? alert("你自己看看你现在多少页?!\n有意思撒?") : (a > 0 ? isNext = true : (isNext = false, a = -a));
  349. for (; !!a; a--) {
  350. isNext ? $(".nextBtn")[0].click() : $(".preBtn")[0].click();
  351. }
  352. };
  353. $("#btn_r").click(function () {
  354. changePage();
  355. });
  356. $("#btn_l").click(function () {
  357. changePage(1);
  358. });
  359. $("#goto_num").keydown(function (event) {
  360. if (event.keyCode == 13) {
  361. var page_num;
  362. var pnum = $(this)[0].value;
  363. var isnum = new RegExp("[0-9]+");
  364. if (!isnum.test(pnum)) {
  365. shit(pnum, false);
  366. return false;
  367. }
  368. else {
  369. page_num = Number(pnum);
  370. }
  371. if (page_num <= 0 || page_num > endpage) {
  372. shit(page_num, true);
  373. return false;
  374. }
  375. else if (page_num == 1) {
  376. alert("你瞎啊,看不见左边有个“第一页”的图标啊!!!\n分不清哪一个?鼠标放上去等一会就有提醒了啊!\n虽然一行话就能解决跳转到第一页,但是我不愿意!");
  377. }
  378. else if (page_num == Number(endpage)) {
  379. alert("你瞎啊,看不见右边有个“最后一页”的图标啊!!!\n分不清哪一个?鼠标放上去等一会就有提醒了啊!\n虽然一行话就能解决跳转到第一页,但是我不愿意!");
  380. }
  381. else {
  382. changePage(page_num);
  383. }
  384. $(this)[0].value = "";
  385. return true;
  386. }
  387. function shit(page_num, isnum) {
  388. if (pi_times >= 3) {
  389. alert("皮皮皮!!!还皮!\n皮断腿了吧o(´^`)o");
  390. window.top.location.href = "https://taozhiyu.gitee.io/bd?q=.";
  391. return;
  392. }
  393. else if (!isnum) {
  394. alert("不要皮好不好ヾ(。`Д´。)ノ彡。。。\n你让我怎么跳到第" + page_num + "页 (╬ ̄皿 ̄)\n你告诉我那一页是第" + page_num + "页?!!\n你家页数不是数字啊!!!\n做脚本很累的好伐!!!");
  395. }
  396. else {
  397. alert("不要皮好不好ヾ(。`Д´。)ノ彡。。。\n一共只有" + endpage + "页,你让我怎么跳到第" + page_num + "页 (╬ ̄皿 ̄)\n做脚本很累的好伐!!!");
  398. }
  399. $(this)[0].value = "";
  400. pi_times++;
  401. return false;
  402. }
  403. });
  404. top.document.onkeydown=function(e){
  405. kbd_page(e);
  406. return 0;
  407. }
  408. parent.document.onkeydown=function(e){
  409. kbd_page(e);
  410. return 0;
  411. }
  412. document.onkeydown=function(e){
  413. kbd_page(e);
  414. return 0;
  415. }
  416. if (data_json.isTao == 1) {
  417. choose_div = '<p style="width: 25px;height: 25px;line-height: 25px;text-align: center; font-size: 3px; color: #ffffff;">On</p>';
  418. mychooseDiv = document.createElement("div");
  419. mychooseDiv.id = 'My_choose';
  420. mychooseDiv.style = 'border-radius: 50%;background-color:#d71345;width:25px;height:25px;position:fixed;right:2px;top:0%;z-index:10;cursor:pointer;-moz-background-size:100% 100%;-o-background-size:100% 100%;-webkit-background-size:100% 100%;background-size:100% 100%;';
  421. $(".imglook")[0].insertBefore(mychooseDiv, $(".imglook")[0].firstChild);
  422. $("#My_choose").append(choose_div);
  423. $("#My_choose").click(function () {
  424. data_json.isTao = 0;
  425. data_json.jobid = "";
  426. data_json.btime = "";
  427. window.frameElement.setAttribute('data', JSON.stringify(data_json));
  428. location.href = location.href + (location.href.indexOf("?") > -1 ? "&" : "?") + "wuai=" + (new Date()).getTime();
  429. });
  430. }
  431. },100);
  432. }
  433. newbutton();
  434. }
  435. else {
  436. PDF_div = '<p style="color:red;position:fixed;top:0;left:0;width:100%;font-size:15px;">没有作业任务的PDF就不需要我了吧。(那我隐退了,右边有开关。自己玩吧)</p>';
  437. myDiv = document.createElement("div");
  438. myDiv.id = 'mysellectid';
  439. document.querySelectorAll(".turnpage_Btn")[0].insertBefore(myDiv, document.querySelectorAll(".turnpage_Btn")[0].children[0].firstChild);
  440. $("#mysellectid").append(PDF_div);
  441. choose_div = '<p style="width: 25px;height: 25px;line-height: 25px;text-align: center; font-size: 3px; color: #ffffff;">Off</p>';
  442. mychooseDiv = document.createElement("div");
  443. mychooseDiv.id = 'My_choose';
  444. mychooseDiv.style = 'border-radius: 50%;background-color:#ffc20e;width:25px;height:25px;position:fixed;right:20px;top:0%;z-index:10;cursor:pointer;-moz-background-size:100% 100%;-o-background-size:100% 100%;-webkit-background-size:100% 100%;background-size:100% 100%;';
  445. $(".imglook")[0].insertBefore(mychooseDiv, $(".imglook")[0].firstChild);
  446. $("#My_choose").append(choose_div);
  447. $("#My_choose").click(function () {
  448. data_json.isTao = 1;
  449. if (data_json._jobid !== "") {
  450. data_json.jobid = data_json._jobid;
  451. }
  452. else {
  453. data_json.btime = 1;
  454. }
  455. window.frameElement.setAttribute('data', JSON.stringify(data_json));
  456. location.href = location.href + (location.href.indexOf("?") > -1 ? "&" : "?") + "time=" + (new Date()).getTime();
  457. });
  458. setTimeout(function () {
  459. $("#mysellectid")[0].style.opacity = 1;
  460. var pdf__ = setInterval(function () {
  461. $("#mysellectid")[0].style.opacity -= 0.01;
  462. if ($("#mysellectid")[0].style.opacity <= 0) {
  463. clearInterval(pdf__);
  464. $("#mysellectid")[0].style.opacity = 0;
  465. }
  466. }, 200);
  467. }, 1000);
  468. }
  469. };
  470. }
  471. if (location.href.match(/doHomeWorkNew/) !== null) {
  472. $(document).ready(function(){
  473. function keyDown(keydown){
  474. keydown.preventDefault();
  475. var currKey=0, e=keydown||event||window.event;
  476. currKey = e.keyCode||e.which||e.charCode;
  477. if(currKey == 83 && (e.ctrlKey||e.metaKey)){
  478. noSubmit();
  479. return false;
  480. }
  481. }
  482. document.onkeydown = keyDown;
  483. var cancel_paste = setInterval(function () {
  484. try {
  485. window.myEditor_paste = "";
  486. window.pasteText = "";
  487. }
  488. catch (e) { }
  489. }, 1);
  490. setTimeout(function () {
  491. clearInterval(cancel_paste);
  492. }, 5000);
  493. });
  494. }
  495. function ####_CX_flash() {
  496. var ####_CX = setInterval(function () {
  497. try {
  498. var str = window.frameElement.getAttribute('data').toString();
  499. if (str.indexOf("\"danmaku\":1")) {
  500. window.frameElement.setAttribute('data', str.replace(/"danmaku":1/g, '"danmaku":0'));
  501. console.log("danmaku拦截");
  502. }
  503. if (str.indexOf("\"fastforward\":false")) {
  504. window.frameElement.setAttribute('data', str.replace(/"fastforward":false/g, '"fastforward":true'));
  505. console.log("fastforward拦截");
  506. }
  507. if (str.indexOf("\"switchwindow\":1")) {
  508. window.frameElement.setAttribute('data', str.replace(/"switchwindow":false/g, '"switchwindow":true'));
  509. console.log("switchwindow拦截");
  510. }
  511. var mouse_times = 0;
  512. window.Ext.EventManager.mouseLeaveRe = {
  513. 'test': (e) => {
  514. if (/mouseout/.test(e)) {
  515. mouse_times++;
  516. console.log("已为您过滤" + mouse_times + "次鼠标移出暂停");
  517. }
  518. }
  519. };
  520. }
  521. catch (e) { }
  522. }, 1);
  523. setTimeout(function () {
  524. clearInterval(####_CX);
  525. }, 5000);
  526. window.onload = function () {
  527. var quick_ddiv = "<font color='#238E23' size=2>播放速度:</font><select style='text-align:center;text-align-last:center;padding-left:6px;margin:-0.6rem 0;' class='select_class_name'><option value='0.5'>0.5</option><option value='1' selected='selected'>1</option><option value='1.25'>1.25(慢快推荐)</option><option value='1.5'>1.5</option><option value='2'>2</option><option value='2.6'>2.6(快推荐)</option><option value='3'>3</option><option value='4'>4</option></select><font color='blue' size=2> POWER BY:涛之雨 </font><font style='background-color: rgb(255,165,0);color: white;position: fixed;right: 0px;' size=1>本页面上下左右空格已绑定视频,可以快进退、增减音量</font><br /><font color='red' size=2>如果未生效请刷新,多次刷新无效说明失效了,请认真学习,等我补吧(后面没有字了)</font><font color='azure' size=1>(那是不可能的)</font>";
  528. var btn_only_video = document.createElement("div");
  529. btn_only_video.id = 'mysellectid';
  530. $("body")[0].insertBefore(btn_only_video, $("body")[0].firstChild);
  531. $("#mysellectid").append(quick_ddiv);
  532. $(".select_class_name").change(function () {
  533. $("video")[0].playbackRate = $(this).val();
  534. });
  535. var rate_Interval = setInterval(function () {
  536. try {
  537. $("video")[0].onratechange = function () {
  538. $(".select_class_name").val($("video")[0].playbackRate);
  539. };
  540. clearInterval(rate_Interval);
  541. set_ctrl();
  542. }
  543. catch (e) { }
  544. }, 1);
  545. function set_ctrl() {
  546. var vol = 0.1;
  547. var time = 10;
  548. var videoElement = $("video")[0];
  549. $(document).keydown(function (event) {
  550. if (event.target.tagName.toLowerCase() == "input") {
  551. return 1;
  552. }
  553. var e = event || window.event;
  554. if (e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 37 || e.keyCode === 39 || e.keyCode === 32) {
  555. e.preventDefault();
  556. }
  557. });
  558. document.onkeyup = function (event) {
  559. if (event.target.tagName.toLowerCase() == "input") {
  560. return 1;
  561. }
  562. var e = event || window.event;
  563. if (e && e.keyCode === 38) {
  564. videoElement.volume !== 1 ? videoElement.volume += vol : 1;
  565. return false;
  566. }
  567. else if (e && e.keyCode === 40) {
  568. videoElement.volume !== 0 ? videoElement.volume -= vol : 1;
  569. return false;
  570. }
  571. else if (e && e.keyCode === 37) {
  572. videoElement.currentTime !== 0 ? videoElement.currentTime -= time : 1;
  573. return false;
  574. }
  575. else if (e && e.keyCode === 39) {
  576. videoElement.volume !== videoElement.duration ? videoElement.currentTime += time : 1;
  577. return false;
  578. }
  579. else if (e && e.keyCode === 32) {
  580. videoElement.paused === true ? videoElement.play() : videoElement.pause();
  581. return false;
  582. }
  583. };
  584. }
  585. };
  586. }
  587. function hookCXPlayer(onPlayerInit, contextWindow) {
  588. if (undefined === contextWindow) {
  589. contextWindow = window;
  590. }
  591. Hooks.set(contextWindow, "jQuery", function (target, propertyName, ignored, jQuery) {
  592. Hooks.method(jQuery.fn, "cxplayer", function (target, methodName, method, thisArg, args) {
  593. var replyArgs = arguments, $globalPlayer, $player,
  594. globalConfig = args[0];
  595. function createCXPlayer(config) {
  596. if (undefined !== config) {
  597. globalConfig = config;
  598. args[0] = config;
  599. }
  600. $globalPlayer = Hooks.Reply.method(replyArgs);
  601. return $globalPlayer;
  602. }
  603. $player = onPlayerInit(globalConfig, createCXPlayer);
  604. if (undefined !== $player) {
  605. $globalPlayer = $player;
  606. }
  607. return $globalPlayer;
  608. });
  609. return Hooks.Reply.set(arguments);
  610. });
  611. }
  612. var globalVideoJs;
  613. function videoJsStudyUncontrolAndTimelineNull(contextWindow) {
  614. if (undefined === contextWindow) {
  615. contextWindow = window;
  616. }
  617. Hooks.set(contextWindow, "videojs", function (target, propertyName, ignored, videojs) {
  618. globalVideoJs = videojs;
  619. Hooks.method(videojs, "registerPlugin", function (target, methodName, method, thisArg, args) {
  620. if ("studyControl" === args[0]) {
  621. method.call(thisArg, "studyControl", function () { });
  622. return args[1];
  623. }
  624. else if ("timelineObjects" === args[0]) {
  625. method.call(thisArg, "timelineObjects", function () { });
  626. return args[1];
  627. }
  628. else {
  629. return Hooks.Reply.method(arguments);
  630. }
  631. });
  632. return Hooks.Reply.set(arguments);
  633. });
  634. }
  635. function hookVideojs(onPlayerInit, contextWindow) {
  636. if (undefined === contextWindow) {
  637. contextWindow = window;
  638. }
  639. Hooks.set(contextWindow, "ans", function (target, propertyName, ignored, ans) {
  640. Hooks.method(ans, "VideoJs", function (target, methodName, method, thisArg, args) {
  641. var replyArgs = arguments, $globalPlayer, $player,
  642. globalConfig = args[0].params;
  643. function createPlayer(config) {
  644. var player;
  645. if (undefined !== config) {
  646. globalConfig = config;
  647. args[0].params = config;
  648. }
  649. Hooks.Reply.method(replyArgs);
  650. return globalVideoJs(args[0].videojs);
  651. }
  652. $player = onPlayerInit(globalConfig, createPlayer);
  653. if (undefined !== $player) {
  654. $globalPlayer = $player;
  655. }
  656. return $globalPlayer;
  657. });
  658. return Hooks.Reply.set(arguments);
  659. });
  660. }
  661. // if ("/ananas/modules/video/index.html" === window.location.pathname) {
  662. // debugger;
  663. // hookCXPlayer(function (config, createCXPlayer) {
  664. // var $player;
  665. // config.datas.enableFastForward = true;
  666. // config.datas.enableSwitchWindow = 1;
  667. // config.datas.errorBackTime = false;
  668. // config.datas.isAutoPlayNext = true;
  669. // config.datas.isDefaultPlay = true;
  670. // config.datas.switchwindow = false;
  671. // config.datas.fastforward = false;
  672. // config.datas.pauseAdvertList = [];
  673. // config.datas.preAdvertList = [];
  674. // $player = createCXPlayer();
  675. // $player.unbind("onPause");
  676. // $player.pauseMovie = function () { };
  677. // $player.bind("onError", function () {
  678. // if (4 === $player.getPlayState()) {
  679. // window.location.reload();
  680. // }
  681. // });
  682. // window.MoocPlayer.prototype.switchWindow = function () {
  683. // return this;
  684. // };
  685. // window.jQuery.fn.pauseMovie = function () { };
  686. // });
  687. // videoJsStudyUncontrolAndTimelineNull();
  688. // hookVideojs(function (config, createPlayer) {
  689. // var $player;
  690. // config.enableFastForward = 1;
  691. // config.enableSwitchWindow = 1;
  692. // $player = createPlayer();
  693. // });
  694. // }
  695. if (location.href.match(/video/) !== null) {
  696. ####_CX_flash();
  697. }
  698. })();