whkjdxjxjy

storehouse

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

  1. // ==UserScript==
  2. // @name whkjdxjxjy
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.0.1
  5. // @description storehouse
  6. // @author Xiguayaodade
  7. // @license MIT
  8. // @match *://wustedu.ls365.net/*
  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_notification
  19. // @grant GM_xmlhttpRequest
  20. // @grant GM_getResourceText
  21. // @grant GM_registerMenuCommand
  22. // @grant GM_unregisterMenuCommand
  23. // @grant GM_addValueChangeListener
  24. // @grant GM_removeValueChangeListener
  25. // @namespace http://tampermonkey.net/
  26. // @homepage http://8.130.116.135/?article/
  27. // @source http://8.130.116.135/?article/
  28. // @icon https://picx.zhimg.com/v2-ce62b58ab2c7dc67d6cabc3508db5795_l.jpg?source=32738c0c
  29. // @connect icodef.com
  30. // @connect localhost
  31. // @antifeature free 限时免费
  32. // @require https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js
  33. // ==/UserScript==
  34.  
  35. (function() {
  36. 'use strict';
  37. /* globals jQuery, $, waitForKeyElements */
  38.  
  39. // 检查当前窗口是否为顶层窗口
  40. if (window.self != window.top) {
  41. return; // 如果不是顶层窗口,则不执行脚本
  42. }
  43.  
  44. var ddds3 = null;
  45. var addMessage = null;
  46.  
  47. let btn1=GM_registerMenuCommand ("\u4f5c\u8005\uff1a\ud83c\udf49\u897f\u74dc\u8981\u5927\u7684\ud83c\udf49", function(){
  48. confirm("Hello,\u611f\u8c22\u4f7f\u7528\ud83c\udf49\u897f\u74dc\u5237\u8bfe\u52a9\u624b\ud83c\udf49\uff01\u591a\u591a\u53cd\u9988\u54e6");
  49. GM_unregisterMenuCommand(btn1);
  50. }, "");
  51. let btn2=GM_registerMenuCommand ("\u4ed8\u8d39\u5185\u5bb9", function(){
  52. alert("\u9650\u65f6\u514d\u8d39\uff0c\u5168\u529b\u5f00\u53d1\u4e2d...");
  53. }, "p");
  54.  
  55. var chapterCount = 0;
  56. var chapterId = 1;
  57. var sectionCount = 0;
  58. var sectionId = 1;
  59. var search = null;
  60. var searchVD = null;
  61. var searchFC = null;
  62.  
  63.  
  64. search = function(){
  65. if(chapterId <= chapterCount){
  66. if(sectionId <= sectionCount){
  67. addMessage("\u5171"+chapterCount+"\u7ae0\uff0c\u5f53\u524d\u7b2c"+chapterId+"\u7ae0\u7b2c"+sectionId+"\u8282\uff0c\u5171"+sectionCount+"\u8282\u3002");
  68. var xxjd = document.getElementsByClassName("subject-catalog subject-catalog-new")[0].getElementsByTagName("li")[chapterId-1].getElementsByClassName("item current-hover")[sectionId-1].getElementsByClassName("iconfont m-right")[1].innerText;
  69. if(xxjd === '重新学习'){
  70. addMessage("\u7b2c"+chapterId+"\u7ae0\u7b2c"+sectionId+"\u8282\u5df2\u5b8c\u6210\uff0c\u68c0\u7d22\u4e0b\u4e00\u8282\u3002");
  71. sectionId++;
  72. search();
  73. }else{
  74. addMessage("\u7b2c"+chapterId+"\u7ae0\u7b2c"+sectionId+"\u8282\u672a\u5b8c\u6210\uff0c\u5373\u5c06\u8fdb\u5165\u5b66\u4e60\u3002");
  75. setTimeout(function(){
  76. document.getElementsByClassName("subject-catalog subject-catalog-new")[0].getElementsByTagName("li")[chapterId-1].getElementsByClassName("item current-hover")[sectionId-1].getElementsByClassName("iconfont m-right")[1].click();
  77. },1000);
  78. }
  79. }else{
  80. addMessage("\u5f53\u524d\u7ae0\u8282\u5df2\u5b8c\u6210\uff0c\u68c0\u7d22\u4e0b\u4e00\u7ae0\u3002");
  81. sectionId = 1;
  82. chapterId++;
  83. if(chapterId <= chapterCount){
  84. sectionCount = document.getElementsByClassName("subject-catalog subject-catalog-new")[0].getElementsByTagName("li")[chapterId-1].getElementsByClassName("item current-hover").length;
  85. }
  86. search();
  87. }
  88. }else{
  89. addMessage("\u5b66\u4e60\u5b8c\u6210\uff0c\u9000\u51fa\uff01");
  90. }
  91. }
  92.  
  93. searchVD = function(){
  94. // let xxzt = document.getElementsByClassName("section-item section-item11")[0].getElementsByTagName("span")[1].innerText;
  95.  
  96. if(document.getElementsByTagName('video')[0].paused){
  97. let btnCloseNext = null;
  98. if(document.querySelector("#content > div.app-content > div.content.drizzle-content > div > div.top.new-course-top > div > div.player-wrapper.new-play-wrapper.play-area-padding.player-section-video > div > div.player-content.relative.new-play-content.new-play-content-warp > div:nth-child(5) > div") != null){
  99. btnCloseNext = document.querySelector("#content > div.app-content > div.content.drizzle-content > div > div.top.new-course-top > div > div.player-wrapper.new-play-wrapper.play-area-padding.player-section-video > div > div.player-content.relative.new-play-content.new-play-content-warp > div:nth-child(5) > div");
  100.  
  101. if(btnCloseNext != null && btnCloseNext.children[1].children[1].innerText === '关闭'){
  102. addMessage("本章结束,5S后自动返回首页");
  103. setTimeout(function(){
  104. window.open('https://e-learning.spicti.com/#/study/course/index','_self');
  105. setTimeout(function(){
  106. window.location.reload();
  107. clearInterval(searchFC);
  108. },3000);
  109. },5000);
  110. }
  111. else if(btnCloseNext != null && btnCloseNext.children[1].children[1].innerText.slice(-3) === '下一节'){
  112. addMessage("小节结束");
  113. }
  114. else{
  115. addMessage("暂停了,我帮你自动播放咯");
  116. document.getElementsByTagName('video')[0].play();
  117. }
  118. }else{
  119. addMessage("本章结束,5S后自动返回首页");
  120. setTimeout(function(){
  121. window.open('https://e-learning.spicti.com/#/study/course/index','_self');
  122. setTimeout(function(){
  123. window.location.reload();
  124. clearInterval(searchFC);
  125. },3000);
  126. },5000);
  127. }
  128.  
  129. }else{
  130. addMessage("\u5f53\u524d\u89c6\u9891\u6b63\u5728\u5b66\u4e60\u4e2d\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85\u002e\u002e\u002e");
  131. }
  132. }
  133.  
  134. const panel = function(){
  135. var container = $('<div id="gm-interface"></div>');
  136. var titleBar = $('<div id="gm-title-bar">\ud83c\udf49\u897f\u74dc\u7f51\u8bfe\u52a9\u624b\ud83c\udf49</div>');
  137. 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>');
  138. 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>');
  139. var content = $('<div id="gm-content"></div>');
  140. var tips = $('<div class="tip" style="display:none;">\u957f\u6309\u62d6\u62fd</div>');
  141. 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({
  142. 'position': 'absolute',
  143. 'top': '15%',
  144. 'left': '50%',
  145. 'transform': 'translate(-50%, -50%)',
  146. 'width': '90%',
  147. 'height': '25px',
  148. 'font-size': '16px',
  149. 'line-height': '1.5',
  150. 'white-space': 'nowrap'
  151. }).appendTo(content);
  152. //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>');
  153. //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>');
  154. //var ddds2 = $('<div style="position: absolute;top: 50%;width:90%;height:10%;padding: 3px;background: #ffedf0;border-radius: 5px;">\u89c6\u9891\u500d\u901f\uff1a<button id="speedxg" style="position: absolute;width:48px;right: 10px;background-color: #ffe5e5;border-radius: 4px;border-color: #ffc0c0;color: grey;">X16</button></div>');
  155. ddds3 = $('<div id="message-container" style="position: absolute;display: grid;align-content: center;justify-content: center;top: 20%;width:94%;height:62%;max-height:62%;overflow-y:auto;padding: 3px;background: #ffffff;border-radius: 5px;"></div>');
  156. 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>');
  157.  
  158. container.append(titleBar);
  159. //content.append(ddds1);
  160. //content.append(ddds5);
  161. //content.append(ddds2);
  162. content.append(ddds3);
  163. content.append(ddds4);
  164. container.append(content);
  165. container.append(maxButton);
  166. container.append(minimizeButton);
  167. $('body').append(container);
  168. $('body').append(tips);
  169.  
  170. GM_addStyle(`
  171. #gm-interface {
  172. position: fixed;
  173. top: 50%;
  174. left: 50%;
  175. border-radius: 5px;
  176. background-color: white;
  177. z-index: 9999;
  178. }
  179.  
  180. #gm-title-bar {
  181. padding: 5px;
  182. background-color: #ffc0c0;
  183. border: 1px solid black;
  184. border-radius: 5px;
  185. cursor: grab;
  186. }
  187.  
  188. #gm-minimize-button {
  189. position: absolute;
  190. top: 2px;
  191. right: 2px;
  192. width: 30px;
  193. height: 30px;
  194. border-radius: 5px;
  195. padding: 0;
  196. font-weight: bold;
  197. background-color: #ffc0c0;
  198. cursor: pointer;
  199. }
  200.  
  201. #gm-content {
  202. padding: 10px;
  203. border: 1px solid black;
  204. border-radius: 2px 2px 5px 5px;
  205. background-color: #ffe5e5;
  206. width: 400px;
  207. height: 300px;
  208. }
  209. .tip{
  210. font-family: "黑体";
  211. color: black;
  212. -webkit-transform: scale(0.8);
  213. position:absolute;
  214. padding: 6px 5px;
  215. background-color:#ffe8f0;
  216. border-radius: 4px;
  217. z-index: 9999;
  218. }
  219. `);
  220.  
  221. titleBar.on('mousemove',function(e){
  222. tips.attr("style", "display:black;");
  223. var top = e.pageY+5;
  224. var left = e.pageX+5;
  225. tips.css({
  226. 'top' : top + 'px',
  227. 'left': left+ 'px'
  228. });
  229. });
  230.  
  231. titleBar.on('mouseout',function(){
  232. tips.hide();
  233. });
  234.  
  235. titleBar.on('mousedown', function(e) {
  236. var startX = e.pageX - container.offset().left + window.scrollX;
  237. var startY = e.pageY - container.offset().top + window.scrollY;
  238.  
  239. $(document).on('mousemove', function(e) {
  240. e.preventDefault();
  241. var newX = e.pageX - startX;
  242. var newY = e.pageY - startY;
  243. container.css({ left: newX, top: newY });
  244. });
  245.  
  246. $(document).on('mouseup', function() {
  247. $(document).off('mousemove');
  248. $(document).off('mouseup');
  249. });
  250. });
  251.  
  252.  
  253. minimizeButton.on('click', function() {
  254. minimizeButton.attr("style", "display:none;");
  255. maxButton.attr("style", "display:black;");
  256. content.slideToggle(0);
  257. container.css({ width: 200 });
  258. });
  259.  
  260. maxButton.on('click', function() {
  261. minimizeButton.attr("style", "display:black;");
  262. maxButton.attr("style", "display:none;");
  263. content.slideToggle(0);
  264. container.css({ width: 400 });
  265. });
  266.  
  267. ddds3.on('mousewheel', function(event) {
  268. event.preventDefault();
  269. var scrollTop = ddds3.scrollTop();
  270. ddds3.scrollTop(scrollTop + event.originalEvent.deltaY);
  271. });
  272.  
  273. addMessage = function(message){
  274. if (ddds3.children().length >= 288) {
  275. ddds3.children().first().remove();
  276. }
  277. var messageElement = $('<div class="message"></div>').text(message).css({
  278. 'margin-bottom': '10px'
  279. }).appendTo(ddds3);
  280. }
  281.  
  282. }
  283.  
  284. panel();
  285. addMessage("\u002d\u002d\u002d\u002d\u6b63\u5728\u542f\u52a8\uff0c\u8bf7\u7a0d\u540e\u002e\u002e\u002e\u002d\u002d\u002d\u002d");
  286.  
  287. var wait = setInterval(function (){
  288. ddds3.children().remove();
  289. if(window.location.href.substring(0,52) === 'https://wustedu.ls365.net/University/course/play.asp' || window.location.href.substring(0,52) === 'https://wustedu.ls365.net/University/course/play.htm'){
  290.  
  291. addMessage("当前处于课程视频页无需操作,将自动播放");
  292.  
  293. setInterval(function(){
  294. if(document.querySelector("#learnNextSection").href != ''){
  295. addMessage("当前小节结束,即将进入下一节");
  296. setTimeout(function(){
  297. document.querySelector("#learnNextSection").click();
  298. },2500);
  299. }
  300. },1000);
  301.  
  302. clearInterval(wait);
  303. }
  304. }, 2000);
  305.  
  306. var uL = null;
  307. var courseCount = 0;
  308. var courseIndex = 0;
  309. function selectStudying(){
  310. if(courseIndex < courseCount){
  311. let a = uL.children[courseIndex].children[0].children[0].children[0].childElementCount;
  312. let title = uL.children[courseIndex].children[0].children[1].getElementsByClassName('text-overflow title')[0].innerText;
  313. if(a != 1){
  314. let status = uL.children[courseIndex].children[0].children[0].innerText;
  315. addMessage(status+"status");
  316. if(status === '已完成'){
  317. addMessage(title+"|已完成");
  318. courseIndex++;
  319. setTimeout(function(){
  320. selectStudying();
  321. },1000);
  322. }
  323. if(status === '学习中'){
  324. addMessage(title+"|未完成");
  325. uL.children[courseIndex].children[0].children[1].children[0].children[0].click();
  326. setTimeout(function(){
  327. window.close();
  328. },3000);
  329. }
  330. if(status === ''){
  331. addMessage(title+"|无需学习");
  332. courseIndex++;
  333. setTimeout(function(){
  334. selectStudying();
  335. },1000);
  336. }
  337. }else{
  338. addMessage(title+"|开始学习");
  339. uL.children[courseIndex].children[0].children[1].children[0].children[0].click();
  340. setTimeout(function(){
  341. window.close();
  342. },3000);
  343. }
  344. }else{
  345. addMessage("|一页结束")
  346. }
  347. }
  348.  
  349. })();