Greasy Fork is available in English.

(新)贵州省党员干部网络学院秒看视频、自动提交等。

贵州省党员干部网络学院秒看视频

  1. // ==UserScript==
  2. // @name (新)贵州省党员干部网络学院秒看视频、自动提交等。
  3. // @namespace zzy
  4. // @version 1.8
  5. // @description 贵州省党员干部网络学院秒看视频
  6. // @author zzy
  7. // @match *https://gzwy.gov.cn/dsfa/nc/pc/course/views/course*
  8. // @match *://gzwy.gov.cn/*
  9. // @icon https://gzwy.gov.cn/dsfa/gzgb.ico
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. //'use strict';
  16.  
  17.  
  18. window.onload = function () {
  19. var stop = false;
  20. var $div = $(`
  21. <div style="z-index:10022;position:fixed;top:50px;right:20px;padding:10px;background:aliceblue">
  22. <div class="jsdiv" id="jsdiv1" style="padding:5px;">
  23. <span>开始</span>
  24. </div>
  25. <div class="jsdiv" id="jsdiv2" style="margin-top:10px;padding:5px;">
  26. <span>停止</span>
  27. </div>
  28. </div>
  29. <div style="z-index:10022;position:fixed;top:150px;right:0px;padding:0px;">
  30. <span>有问题请反馈</span>
  31. </div>
  32. `);
  33.  
  34. var $style = `
  35. <style type="text/css">
  36. .jsdiv:{
  37. background: aqua;
  38. }
  39. .jsdiv:hover{
  40. background:#fff;
  41. cursor: pointer;
  42. }
  43. </style>
  44. `
  45. $('body').append($div);
  46. $('head').append($style);
  47. var jsdiv1 = document.getElementById("jsdiv1");
  48. var jsdiv2 = document.getElementById("jsdiv2");
  49. jsdiv1.addEventListener("click", function () {
  50. $("div[data-title='点击静音']")[0].click();
  51. $("div[data-title=点击播放]")[0].click();
  52. window.onblur = function () {
  53.  
  54. }
  55. stop = false;
  56. subJd();
  57. })
  58. jsdiv2.addEventListener("click", function () {
  59. stop = true;
  60. })
  61. function getSec(t) {
  62. if (!t) {
  63. t = "00:00:00";
  64. }
  65. t = t.split(":");
  66. var s = t[0] * 60 * 60 + t[1] * 60 + t[2] * 1;
  67. return s;
  68. }
  69. function subJd() {
  70. if (stop) {
  71. return;
  72. }
  73. var info = JSON.parse($(".selConListItem")[0].getAttribute("data-item"));
  74. var sourceUrl = dsf.url.getWebPath("nc/xxgl/xxjl/addXxjlByKczj");
  75. var params = {
  76. // nc_students_id: userId,
  77. relid: info.kjid,
  78. bigtimespan: info.kjsc,
  79. timespan: info.kjsc,
  80. dwid:info.kcid,
  81. //当前课程已经播放的时间,
  82. pass: "1",
  83. sumtime: getSec(info.kjsc),
  84. everytime: 10,
  85. playRate: 1,
  86. };
  87. if (dsf.url.queryString("ztbid")) {
  88. params.zybId = dsf.url.queryString("ztbid");
  89. }
  90. dsf.http
  91. .request(sourceUrl, params, "POST")
  92. .done(function (res) {
  93. if (res.success) {
  94. console.log(res.kjjd);
  95. if (JSON.stringify(res.data) !== "{}") {
  96. dsf.layer.message(res.message, true);
  97. }
  98. if (true) {
  99. var name = $(".selConListItem canvas")[0].getAttribute("id");
  100. var p = res.kjjd ? Number(res.kjjd) : 0;
  101. if (p > 100) {
  102. p = 100;
  103. }
  104. $("#" + name).attr("data-percent", p);
  105. $("#" + name).circleProgress({
  106. obj: name,
  107. innerColor: "#D40000",
  108. size: 40,
  109. radius: 16,
  110. textY: 24,
  111. textX: 12,
  112. });
  113. dsf.layer.message("提交成功,进度" + p + "%!");
  114. if (p < 100) {
  115. subJd();
  116. } else {
  117. if (window.ctime) {
  118. if ((new Date().getTime() - window.ctime.getTime()) < 30000) {
  119.  
  120. console.log("时间未到");
  121. subJd();
  122. } else {
  123. window.ctime = new Date();
  124. if ($(".com-canvas[data-percent!='100']").length) {
  125.  
  126. $(".com-canvas[data-percent!='100']")[0].click();
  127. subJd();
  128. } else {
  129. dsf.layer.alert("脚本提交全部课程!", function () {
  130. var index = layer.alert();
  131. layer.close(index);
  132. });
  133. }
  134. }
  135. } else {
  136. window.ctime = new Date();
  137. if ($(".com-canvas[data-percent!='100']").length) {
  138.  
  139. $(".com-canvas[data-percent!='100']")[0].click();
  140. subJd();
  141. } else {
  142. dsf.layer.alert("脚本提交全部课程!", function () {
  143. var index = layer.alert();
  144. layer.close(index);
  145. });
  146. }
  147.  
  148. }
  149. }
  150. }
  151. } else if (res.state == "61000") {
  152. dsf.layer.alert(res.message, function () {
  153. var path = dsf.url.getWebPath("/nc/pc/main/views/main.html");
  154. window.location.href = path;
  155. });
  156. } else {
  157. dsf.layer.message(res.message, false);
  158. }
  159. })
  160. .error(function (err) {
  161. dsf.layer.message("学时记录异常,请联系管理员", false);
  162. })
  163. .always(function () { })
  164. .exec();
  165. }
  166.  
  167. }
  168. })();