ayjsryzxxx

storehouse

目前为 2023-11-20 提交的版本。查看 最新版本

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/480381/1283380/ayjsryzxxx.js

  1. // ==UserScript==
  2. // @name ayjsryzxxx
  3. // @version 0.0.1
  4. // @description storehouse
  5. // @author Xiguayaodade
  6. // @license MIT
  7. // @match *://gp.chinahrt.com/*
  8. // @match *://videoadmin.chinahrt.com/*
  9. // @grant GM_info
  10. // @grant GM_getTab
  11. // @grant GM_saveTab
  12. // @grant GM_setValue
  13. // @grant GM_getValue
  14. // @grant GM_addStyle
  15. // @grant unsafeWindow
  16. // @grant GM_listValues
  17. // @grant GM_deleteValue
  18. // @grant GM_setClipboard
  19. // @grant GM_notification
  20. // @grant GM_xmlhttpRequest
  21. // @grant GM_getResourceText
  22. // @grant GM_registerMenuCommand
  23. // @grant GM_unregisterMenuCommand
  24. // @grant GM_addValueChangeListener
  25. // @grant GM_removeValueChangeListener
  26. // @namespace http://tampermonkey.net/
  27. // @homepage http://8.130.116.135/?article/
  28. // @source http://8.130.116.135/?article/
  29. // @icon https://picx.zhimg.com/v2-ce62b58ab2c7dc67d6cabc3508db5795_l.jpg?source=32738c0c
  30. // @connect icodef.com
  31. // @connect localhost
  32. // @connect 8.130.116.135
  33. // @require https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js
  34. // ==/UserScript==
  35.  
  36. (function() {
  37. 'use strict';
  38. /* globals jQuery, $, waitForKeyElements */
  39. unsafeWindow.GM_xmlhttpRequest = GM_xmlhttpRequest
  40.  
  41.  
  42. var speedonoff = false;
  43. var speedIn = null;
  44. var ddds3 = null;
  45. var addMessage = null;
  46. var login = null;
  47.  
  48. let btn1=GM_registerMenuCommand ("\u4f5c\u8005\uff1a\ud83c\udf49\u897f\u74dc\u8981\u5927\u7684\ud83c\udf49", function(){
  49. confirm("Hello,\u611f\u8c22\u4f7f\u7528\ud83c\udf49\u897f\u74dc\u5237\u8bfe\u52a9\u624b\ud83c\udf49\uff01\u591a\u591a\u53cd\u9988\u54e6");
  50. GM_unregisterMenuCommand(btn1);
  51. }, "");
  52. let btn2=GM_registerMenuCommand ("\u4ed8\u8d39\u5185\u5bb9", function(){
  53. alert("\u9650\u65f6\u514d\u8d39\uff0c\u5168\u529b\u5f00\u53d1\u4e2d...");
  54. }, "p");
  55.  
  56. // 检查当前窗口是否为顶层窗口
  57. if (window.self !== window.top) {
  58. return; // 如果不是顶层窗口,则不执行脚本
  59. }
  60.  
  61. //存储当前课程数量
  62. var courseCount = 0;
  63. //存储当前课程索引
  64. var courseId = 1;
  65. //存储当前课程章节数量
  66. var chapterCount = 0;
  67. //存储当前课程章节索引
  68. var chapterId = 1;
  69. //存储课后练习/考试小题数量
  70. var questionCount = 0;
  71. //存放播放器组件
  72. var elevideo;
  73. //课后练习选择框索引
  74. var rediosIndex = 0;
  75. var COURSES = "courses";
  76. var nowUrl = null;
  77.  
  78.  
  79. //----解决重复监听start----
  80. //视频开始的公共方法
  81. var vdplay = null;
  82. //视频正在播放的公共方法
  83. var vdplaying = null;
  84. //视频暂停的公共方法
  85. var vdpause = null;
  86. //视频结束的公共方法
  87. var vdended = null;
  88. //监听音量的公共方法
  89. var vdvolume = null;
  90. //----解决重复监听end----
  91.  
  92.  
  93. //-----添加监听start------
  94. var addLisenner = function(){
  95.  
  96. //获取播放器组件
  97. elevideo = document.getElementsByTagName("video")[0];
  98.  
  99. vdplay = function(){
  100. let tm = 5 * 60 * 1000;
  101. console.log("xigua:\u5f00\u59cb\u64ad\u653e");
  102. addMessage("xigua:\u5f00\u59cb\u64ad\u653e");
  103. speedIn = setInterval(function(){
  104. speedff();
  105. },tm);
  106. };
  107. vdplaying = function(){
  108. console.log("xigua:\u6b63\u5728\u64ad\u653e");
  109. addMessage("xigua:\u6b63\u5728\u64ad\u653e");
  110. };
  111. vdpause = function(){
  112. clearInterval(speedIn);
  113. console.log("xigua:\u6682\u505c\u64ad\u653e");
  114. addMessage("xigua:\u6682\u505c\u64ad\u653e");
  115. setTimeout(function(){
  116. if(document.getElementsByClassName("layui-layer layui-layer-dialog")[0] != null){
  117. document.getElementsByClassName("layui-layer layui-layer-dialog")[0].getElementsByClassName("layui-layer-btn layui-layer-btn-")[0].getElementsByClassName("layui-layer-btn0")[0].click();
  118. }
  119. },1500);
  120. };
  121. vdended = function(){
  122. clearInterval(speedIn);
  123. console.log("xigua:结束播放,开始下一章");
  124. addMessage("xigua:结束播放,开始下一章");
  125. removeCourse(0);
  126. setTimeout(function(){
  127. readOldData();
  128. },1500);
  129. };
  130. vdvolume = function(){
  131. if(elevideo.volume < 1 && elevideo.volume > 0){
  132. let vlum = elevideo.volume.toString();
  133. console.log("xigua:当前音量("+vlum.substring(2,4)+"%)");
  134. addMessage("xigua:当前音量("+vlum.substring(2,4)+"%)");
  135. }else if(elevideo.volume == 0){
  136. console.log("xigua:当前音量(0%)");
  137. addMessage("xigua:当前音量(0%)");
  138. }else{
  139. console.log("xigua:当前音量(100%)");
  140. addMessage("xigua:当前音量(100%)");
  141. }
  142. }
  143.  
  144. elevideo.addEventListener('play',vdplay);
  145. elevideo.addEventListener('playing',vdplaying);
  146. elevideo.addEventListener('pause',vdpause);
  147. elevideo.addEventListener('ended',vdended);
  148. elevideo.addEventListener('volumechange',vdvolume);
  149.  
  150. setTimeout(function(){
  151. addMessage("执行:play()!!!");
  152. elevideo.play();
  153. },2000);
  154. }
  155. //-----添加监听end------
  156.  
  157. //-----移除监听start---
  158. var removeLisenner = function(){
  159. if(vdplay != null){
  160. elevideo.removeEventListener("play", vdplay);
  161. }
  162. if(vdplaying != null){
  163. elevideo.removeEventListener("playing", vdplaying);
  164. }
  165. if(vdpause != null){
  166. elevideo.removeEventListener("pause", vdpause);
  167. }
  168. if(vdended != null){
  169. elevideo.removeEventListener("ended", vdended);
  170. }
  171. if(vdended != null){
  172. elevideo.removeEventListener("ended", vdended);
  173. }
  174. if(vdvolume != null){
  175. elevideo.removeEventListener("volumechange",vdvolume);
  176. }
  177. }
  178. //-----移除监听end---
  179.  
  180. //-----倍速start-----
  181. var speedff = function(){
  182. if(speedonoff){
  183. let vdText = document.getElementsByClassName("video-progress clearfix not-start")[0].getElementsByClassName("text")[0].getElementsByTagName("span")[1].innerText;
  184. if(parseFloat(vdText) <= 70){
  185. setTimeout(function(){
  186. document.querySelector("video").playbackRate=16;
  187. console.log("X16");
  188. setTimeout(function(){
  189. document.querySelector("video").playbackRate=1;
  190. console.log("X1");
  191. },800);
  192. },1000);
  193. }
  194. }else{
  195. addMessage("断点倍速状态:关闭");
  196. }
  197. }
  198. //-----倍速end-----
  199.  
  200.  
  201. function getCourses() {
  202. var value = GM_getValue(COURSES);
  203. if (Array.isArray(value)) {
  204. return value;
  205. }
  206. return [];
  207. }
  208.  
  209. function getCoursesOk() {
  210. var value = GM_getValue("courseOk");
  211. if (Array.isArray(value)) {
  212. return value;
  213. }
  214. return [];
  215. }
  216.  
  217. function addCourse(duc) {
  218. if (!duc.title || !duc.url) {
  219. console.error(duc);
  220. console.log("失败");
  221. return false;
  222. }
  223.  
  224. var oldData = getCourses();
  225.  
  226. if (oldData.findIndex(value => value.url == duc.url) > -1) {
  227. console.log("该章节已存在历史数据");
  228. return false;
  229. }
  230.  
  231. oldData.push({title: duc.title, url: duc.url});
  232.  
  233. GM_setValue(COURSES, oldData);
  234.  
  235. return true;
  236. }
  237.  
  238. function removeCourse(index) {
  239. var courses = getCourses();
  240.  
  241. if (Number.isNaN(index)) {
  242. for (let i = courses.length; i >= 0; i--) {
  243. const element = courses[i];
  244. var jsonHref = element.url;
  245. var jsonSectionId = jsonHref.match(/sectionId=([^&]*)/)[1];
  246. var jsonCourseId = jsonHref.match(/courseId=([^&]*)/)[1];
  247. var jsonTrainplanId = jsonHref.match(/trainplanId=([^&]*)/)[1];
  248.  
  249. var href = window.location.href;
  250. var sectionId = href.match(/sectionId=([^&]*)/)[1];
  251. var courseId = href.match(/courseId=([^&]*)/)[1];
  252. var trainplanId = href.match(/trainplanId=([^&]*)/)[1];
  253.  
  254. if (jsonCourseId == courseId && jsonSectionId == sectionId && jsonTrainplanId == trainplanId) {
  255. courses.splice(i, 1);
  256. }
  257. }
  258. } else {
  259. courses.splice(index, 1);
  260. }
  261.  
  262. GM_setValue(COURSES, courses);
  263. }
  264.  
  265. //------读取历史数据并跳转start------
  266. function readOldData(){
  267. addMessage("读取历史数据并跳转");
  268. console.log("读取历史数据并跳转");
  269. let oldData = getCourses();
  270. if(oldData.length > 0){
  271. addMessage("============================");
  272. console.log(oldData);
  273. addMessage("即将学习:"+oldData[0].title);
  274. setTimeout(function(){
  275. window.open(oldData[0].url);
  276. setTimeout(function(){
  277. window.close();
  278. },1000);
  279. },1000);
  280. }else{
  281. addMessage("当前课程无未完成章节,即将前往课程列表");
  282. console.log("当前课程无未完成章节,即将前往课程列表");
  283. setTimeout(function(){
  284. if(nowUrl.substring(0,52) === 'https://gp.chinahrt.com//index.html#/v_courseDetails'){
  285. let courseInformation = document.querySelector("article")?.__vue__?._data?.pageData?.course;
  286. GM_setValue("courseOk",courseInformation.id);
  287. window.open(GM_getValue("courseListHref"));
  288. setTimeout(function(){
  289. window.close();
  290. },2500);
  291. }else{
  292. window.open(GM_getValue("courseListHref"), "_self");
  293. }
  294. },2500);
  295. }
  296. }
  297. //------读取历史数据并跳转end------
  298.  
  299. //------检索未完成章节start------
  300. var search = function(){
  301. var totalData = document.querySelector("article")?.__vue__?._data;
  302. if (!totalData) {
  303. return;
  304. }
  305. var pageTotalData = totalData?.pageData;
  306. if (!pageTotalData) {
  307. return;
  308. }
  309.  
  310. var chapters = pageTotalData?.course?.chapter_list;
  311.  
  312. if (chapters && chapters.length > 0) {
  313. for (let i = 0; i < chapters.length; i++) {
  314. const chapter = chapters[i];
  315. var sections = chapter?.section_list;
  316. if (sections && sections.length > 0) {
  317. for (let j = 0; j < sections.length; j++) {
  318. const section = sections[j];
  319. var url = window.location.protocol + "//" + window.location.host + window.location.pathname + "#/v_video?platformId=" + totalData.platformId + "&trainplanId=" + totalData.trainplanId + "&courseId=" + totalData.courseId + "&sectionId=" + section.id;
  320. let se = {
  321. title: section.name,
  322. url: url,
  323. status: section.study_status +"("+ section.studyTimeStr +")"
  324. }
  325. console.log("章节信息:{名称:"+se.title+"}{地址:"+se.url+"}{状态:"+se.status+"}");
  326. if(se.status.substring(0,3) !== '已学完'){
  327. addCourse(se);
  328. addMessage(se.title.substring(0,15)+"--"+se.status+"}");
  329. }
  330. }
  331. }
  332. }
  333. }
  334. setTimeout(function(){
  335. readOldData();
  336. },1000);
  337. }
  338. //------检索未完成章节end------
  339.  
  340. //------检索未完成课程start------
  341. var searchUnEnd = function(){
  342. chapterCount = document.querySelectorAll("section")[1]?.__vue__?._data?.listData;
  343. if(chapterCount.length > 0 && chapterId <= chapterCount.length){
  344. let allCourseOk = getCoursesOk();
  345. if (allCourseOk.findIndex(value => value == chapterCount[chapterId-1].courseId) > -1) {
  346. addMessage(chapterCount[chapterId-1].courseName+"==已学习完毕,检索下一科");
  347. console.log(chapterCount[chapterId-1].courseName+"==已学习完毕,检索下一科");
  348. chapterId++;
  349. searchUnEnd();
  350. }else{
  351. addMessage(chapterCount[chapterId-1].courseName+"==学习中,即将进入");
  352. console.log(chapterCount[chapterId-1].courseName+"==学习中,即将进入");
  353. setTimeout(function(){
  354. document.getElementsByClassName("course-list cb")[0].getElementsByTagName("li")[chapterId-1].getElementsByTagName("div")[0].getElementsByClassName("pr")[0].getElementsByTagName("span")[0].click();
  355. setTimeout(function(){
  356. window.close();
  357. },1000);
  358. },2000);
  359. }
  360. }else{
  361. addMessage("所有课程学习完毕!");
  362. console.log("所有课程学习完毕!");
  363. GM_setValue("loginStatu",false);
  364. }
  365. }
  366. //------检索未完成课程end------
  367.  
  368.  
  369. const panel = function(){
  370. var container = $('<div id="gm-interface"></div>');
  371. var titleBar = $('<div id="gm-title-bar">\ud83c\udf49\u897f\u74dc\u7f51\u8bfe\u52a9\u624b\ud83c\udf49</div>');
  372. var minimizeButton = $('<div title="\u6536\u8d77" style="display:black"><svg id="gm-minimize-button" class="bi bi-dash-square" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M14 1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/><path fill-rule="evenodd" d="M3.5 8a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 0 1H4a.5.5 0 0 1-.5-.5z"/></svg></div>');
  373. var maxButton = $('<div title="\u5c55\u5f00" style="display:none"><svg id="gm-minimize-button" class="bi bi-plus-square" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M8 3.5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-.5.5H4a.5.5 0 0 1 0-1h3.5V4a.5.5 0 0 1 .5-.5z"/><path fill-rule="evenodd" d="M7.5 8a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1H8.5V12a.5.5 0 0 1-1 0V8z"/><path fill-rule="evenodd" d="M14 1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/></svg></div>');
  374. var content = $('<div id="gm-content"></div>');
  375. var tips = $('<div class="tip" style="display:none;">\u957f\u6309\u62d6\u62fd</div>');
  376. var scrollText = $('<marquee>').text('\u4e7e\u5764\u672a\u5b9a\uff0c\u4f60\u6211\u7686\u662f\u9ed1\u9a6c----\u4f5c\u8005\uff1a\u897f\u74dc\u8981\u5927\u7684\uff08\u611f\u8c22\u652f\u6301\uff01\uff09').css({
  377. 'position': 'absolute',
  378. 'top': '15%',
  379. 'left': '50%',
  380. 'transform': 'translate(-50%, -50%)',
  381. 'width': '90%',
  382. 'height': '25px',
  383. 'font-size': '16px',
  384. 'line-height': '1.5',
  385. 'white-space': 'nowrap'
  386. }).appendTo(content);
  387. //var ddds1 = $('<div style="position: absolute;top: 20%;width:90%;height:10%;padding: 3px;background: #ffedf0;border-radius: 5px;">\u70b9\u51fb\u542f\u52a8\uff1a<button id="startxg" style="position: absolute;width:48px;right: 10px;background-color: #ffe5e5;border-radius: 4px;border-color: #ffc0c0;color: grey;">\u542f\u52a8</button></div>');
  388. //var ddds5 = $('<div style="position: absolute;top: 35%;width:90%;height:10%;padding: 3px;background: #ffedf0;border-radius: 5px;">\u70b9\u51fb\u542f\u52a8\uff1a<button id="stopxg" style="position: absolute;width:48px;right: 10px;background-color: #ffe5e5;border-radius: 4px;border-color: #ffc0c0;color: grey;">暂停</button></div>');
  389. var ddds2 = $('<div style="position: absolute;top: 73%;width:94%;height:10%;padding: 3px;background: #ffedf0;border-radius: 5px;">\u65ad\u70b9\u500d\u901f\uff1a<button id="switchButton" style="position: absolute;width:98px;right: 200px;background-color: #ffe5e5;border-radius: 4px;border-color: #ffc0c0;color: grey;">当前:关闭</button><button id="speedxgone" style="position: absolute;width:88px;right: 58px;background-color: #ffe5e5;border-radius: 4px;border-color: #ffc0c0;color: grey;">清空缓存</button></div>');
  390. ddds3 = $('<div id="message-container" style="position: absolute;display: grid;align-content: center;justify-content: center;top: 20%;width:94%;height:52%;max-height:62%;overflow-y:auto;padding: 3px;background: #ffffff;border-radius: 5px;"></div>');
  391. var ddds4 = $('<div style="position: absolute;top: 85%;width:94%;height:10%;padding: 3px;background: #ffedf0;border-radius: 5px;"><a href="http://8.130.116.135/?article/" style="position: absolute;right: 10px;text-decoration: none;color: pink;">\u003e\u003e\u003e\u8054\u7cfb\u003a\u0031\u0039\u0030\u0038\u0032\u0034\u0035\u0033\u0030\u0032\u0040\u0071\u0071\u002e\u0063\u006f\u006d</a></div>');
  392.  
  393. container.append(titleBar);
  394. //content.append(ddds1);
  395. //content.append(ddds5);
  396. content.append(ddds2);
  397. content.append(ddds3);
  398. content.append(ddds4);
  399. container.append(content);
  400. container.append(maxButton);
  401. container.append(minimizeButton);
  402. $('body').append(container);
  403. $('body').append(tips);
  404.  
  405. GM_addStyle(`
  406. #gm-interface {
  407. position: fixed;
  408. top: 50%;
  409. left: 50%;
  410. width: 422px;
  411. border-radius: 5px;
  412. background-color: white;
  413. z-index: 9999;
  414. }
  415.  
  416. #gm-title-bar {
  417. padding: 5px;
  418. background-color: #ffc0c0;
  419. border: 1px solid black;
  420. border-radius: 5px;
  421. cursor: grab;
  422. }
  423.  
  424. #gm-minimize-button {
  425. position: absolute;
  426. top: 2px;
  427. right: 2px;
  428. width: 30px;
  429. height: 30px;
  430. border-radius: 5px;
  431. padding: 0;
  432. font-weight: bold;
  433. background-color: #ffc0c0;
  434. cursor: pointer;
  435. }
  436.  
  437. #gm-content {
  438. padding: 10px;
  439. border: 1px solid black;
  440. border-radius: 2px 2px 5px 5px;
  441. background-color: #ffe5e5;
  442. width: 400px;
  443. height: 300px;
  444. }
  445. .tip{
  446. font-family: "黑体";
  447. color: black;
  448. -webkit-transform: scale(0.8);
  449. position:absolute;
  450. padding: 6px 5px;
  451. background-color:#ffe8f0;
  452. border-radius: 4px;
  453. z-index: 9999;
  454. }
  455. `);
  456.  
  457. titleBar.on('mousemove',function(e){
  458. tips.attr("style", "display:black;");
  459. var top = e.pageY+5;
  460. var left = e.pageX+5;
  461. tips.css({
  462. 'top' : top + 'px',
  463. 'left': left+ 'px'
  464. });
  465. });
  466.  
  467. titleBar.on('mouseout',function(){
  468. tips.hide();
  469. });
  470.  
  471. titleBar.on('mousedown', function(e) {
  472. var startX = e.pageX - container.offset().left + window.scrollX;
  473. var startY = e.pageY - container.offset().top + window.scrollY;
  474.  
  475. $(document).on('mousemove', function(e) {
  476. e.preventDefault();
  477. var newX = e.pageX - startX;
  478. var newY = e.pageY - startY;
  479. container.css({ left: newX, top: newY });
  480. });
  481.  
  482. $(document).on('mouseup', function() {
  483. $(document).off('mousemove');
  484. $(document).off('mouseup');
  485. });
  486. });
  487.  
  488.  
  489. minimizeButton.on('click', function() {
  490. minimizeButton.attr("style", "display:none;");
  491. maxButton.attr("style", "display:black;");
  492. content.slideToggle(0);
  493. container.css({ width: 200 });
  494. });
  495.  
  496. maxButton.on('click', function() {
  497. minimizeButton.attr("style", "display:black;");
  498. maxButton.attr("style", "display:none;");
  499. content.slideToggle(0);
  500. container.css({ width: 422 });
  501. });
  502.  
  503. // $("#speedxgsex").on('click',function(){
  504. // document.querySelector("video").playbackRate=16;
  505. // addMessage("\u500d\u901f\uff1a\u0058\u0031\u0036");
  506. // });
  507.  
  508. $("#speedxgone").on('click',function(){
  509. GM_deleteValue("courseId");
  510. GM_deleteValue(COURSES);
  511. GM_deleteValue("loginStatu");
  512. ddds3.children().remove();
  513. addMessage("已清空缓存");
  514. });
  515.  
  516. $("#switchButton").on('click',function(){
  517. if (speedonoff) {
  518. speedonoff = false;
  519. addMessage("\u500d\u901f\uff1a\u5173\u95ed");
  520. $("#switchButton").text("当前:关闭");
  521. } else {
  522. speedonoff = true;
  523. addMessage("\u500d\u901f\uff1a\u5f00\u542f");
  524. $("#switchButton").text("当前:开启");
  525. }
  526. });
  527.  
  528. // 监听鼠标滚轮事件,实现消息框滚动
  529. ddds3.on('mousewheel', function(event) {
  530. event.preventDefault();
  531. var scrollTop = ddds3.scrollTop();
  532. ddds3.scrollTop(scrollTop + event.originalEvent.deltaY);
  533. });
  534.  
  535. // 添加新消息
  536. addMessage = function(message){
  537. // 检查消息数量,移除最早的一条消息
  538. if (ddds3.children().length >= 288) {
  539. ddds3.children().first().remove();
  540. }
  541. // 创建消息元素并添加到消息框容器
  542. var messageElement = $('<div class="message"></div>').text(message).css({
  543. 'margin-bottom': '10px'
  544. }).appendTo(ddds3);
  545. }
  546.  
  547. // login控件
  548. login = function(){
  549. ddds3.children().remove();
  550. let loginForm = $('<div id="loginForm"><div><input type="text" id="xgusername" placeholder="账号"></div><div><input type="password" id="xgpassword" placeholder="密码"></div><button id="xgsubmit" style="width:88px;background-color: #ffe5e5;border-radius: 4px;border-color: #ffc0c0;color: grey;">登录(不可用)</button></div>');
  551. loginForm.appendTo(ddds3);
  552. $("#xgsubmit").on('click',function(){
  553. let username = $("#xgusername").val();
  554. let password = $("#xgpassword").val();
  555. if(username === '' || username === null || password === '' || password === null){
  556. alert("用户名或密码不能为空!");
  557. }
  558. else{
  559. console.log(username,password);
  560. toLogin(username,password);
  561. }
  562. });
  563. }
  564.  
  565. }
  566.  
  567. function toLogin(use,pwd){
  568. var formData = "username="+use+"&password="+pwd;
  569. GM_xmlhttpRequest({
  570. url: "http://8.130.116.135/?member/login/",
  571. method: "POST",
  572. headers:{
  573. "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
  574. },
  575. data: formData,
  576. onload: function(response) {
  577. try{
  578. var str = response.responseText;
  579. var match = str.match(/\(([^)]+)\)/);
  580. var content = match[1].substring(1,6);
  581. if(content === "登录(不可用)成功!"){
  582. console.log(content);
  583. ddds3.children().remove();
  584. GM_setValue("loginStatu",true);
  585. wait();
  586. }
  587. else if(match[1] === "/static/upload/image/20180412/1523501459462835.jpg"){
  588. alert("获取到指纹,无需登录(不可用)");
  589. GM_setValue("loginStatu",true);
  590. ddds3.children().remove();
  591. wait();
  592. }
  593. else{
  594. console.log("error:",match[1]);
  595. alert("error:"+match[1]);
  596. }
  597. }catch(e){
  598. alert("xigua:服务器维护中!");
  599. }
  600. }
  601. })
  602. }
  603.  
  604. panel();
  605. addMessage("\u002d\u002d\u002d\u002d\u6b63\u5728\u542f\u52a8\uff0c\u8bf7\u7a0d\u540e\u002e\u002e\u002e\u002d\u002d\u002d\u002d");
  606. setTimeout(function(){
  607. let loginStatu = GM_getValue("loginStatu");
  608. if(loginStatu){
  609. wait();
  610. }
  611. else{
  612. alert("xigua:请登录(不可用)");
  613. login();
  614. }
  615. },2000);
  616. //------等待网页加载完成start-----
  617. var wait = function (){
  618. // setInterval(
  619. nowUrl = window.location.href;
  620. if(nowUrl.substring(0,54) === 'https://gp.chinahrt.com//index.html#/v_selected_course'){
  621. ddds3.children().first().remove();
  622. addMessage("课程列表");
  623. console.log("课程列表");
  624. GM_setValue("courseListHref",window.location.href);
  625. document.getElementsByClassName("taxonomic-rank cb mt10")[0].getElementsByClassName("right fr mr10")[0].getElementsByTagName("li")[1].getElementsByTagName("label")[0].click();
  626. setTimeout(function(){
  627. searchUnEnd();
  628. },2000);
  629. }else if(nowUrl.substring(0,44) === 'https://gp.chinahrt.com//index.html#/v_video'){
  630. ddds3.children().first().remove();
  631. addMessage("视频播放页(外框架),请稍后...");
  632. console.log("视频播放页(外框架),请稍后...");
  633. setTimeout(function(){
  634. window.open(document.getElementById('iframe').src, "_self");
  635. },3000);
  636. }else if(nowUrl.substring(0,52) === 'https://gp.chinahrt.com//index.html#/v_courseDetails'){
  637. ddds3.children().first().remove();
  638. addMessage("章节列表");
  639. console.log("章节列表");
  640. search();
  641. }else if(nowUrl.substring(0,46) === 'https://videoadmin.chinahrt.com/videoPlay/play'){
  642. ddds3.children().first().remove();
  643. addMessage("视频播放页(内框架)");
  644. console.log("视频播放页(内框架)");
  645.  
  646. let nowCourse = getCourses();
  647. if(nowCourse.length > 0){
  648. addMessage("当前课程:"+nowCourse[0].title);
  649. console.log("当前课程:"+nowCourse[0].title);
  650.  
  651. removeLisenner();
  652. setTimeout(function(){
  653. addMessage("即将开始播放");
  654. console.log("即将开始播放");
  655. addLisenner();
  656. },1500);
  657. }else{
  658. addMessage("所有章节已完成,前往下一科目");
  659. console.log("所有章节已完成,前往下一科目");
  660. setTimeout(function(){
  661. window.open(GM_getValue("courseListHref"), "_self");
  662. },2500);
  663. }
  664. }else{
  665. ddds3.children().first().remove();
  666. addMessage("请前往课程列表");
  667. console.log("请前往课程列表");
  668. setInterval(function(){
  669. window.location.reload();
  670. },3000);
  671. }
  672. // clearInterval(wait);
  673. }
  674. // , 5000);
  675. //------等待网页加载完成end-----
  676.  
  677. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址