党旗飘飘~~~UESTC

(v1.4.0更新全自动)我爱中国共产党!党旗飘飘,只是不希望被无意义而且频繁的弹窗打断我的课程学习(欸嘿)全平台适用!

  1. // ==UserScript==
  2. // @name 党旗飘飘~~~UESTC
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.4.0
  5. // @description (v1.4.0更新全自动)我爱中国共产党!党旗飘飘,只是不希望被无意义而且频繁的弹窗打断我的课程学习(欸嘿)全平台适用!
  6. // @author Onion
  7. // @include *//*.*.edu.cn/*/play*
  8. // @include *//*.*.edu.cn/user/lesson
  9. // @require https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js
  10. // @require https://cdn.staticfile.org/jquery-cookie/1.4.1/jquery.cookie.min.js
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=uestc.edu.cn
  12. // @grant GM_notification
  13. // @license MIT
  14.  
  15. // ==/UserScript==
  16.  
  17. //1.0 demo版本,还没学会用cookies,因为不想默认开启,所以没办法在重新定向网页的时候,保留用户按下按钮事件的value,过几天修复这个问题(大饼
  18. //本站只匹配了UESTC的党旗飘飘网站,有需要的可以自行修改includ为自家网站
  19. //用法:点开始,就开刷
  20. //停止,就不执行脚本
  21.  
  22. //1.1更新,更新了cookies,增加连续播放功能
  23.  
  24. //1.2更新,更新了用户名,发现了因为增加了cookies功能所以导致的几个bug:
  25. //(1)进去太快了可能要按两次"开刷"按钮
  26. //(2)停止按钮有时候停不下来,(累了,今天不修了,刷新网页重定向一下就能解决大多问题
  27. // PS:如果想要改名的话请打开开发者选项(谷歌:ctrl+shift+I),在控制台(console)里面输入:$.removeCookie('username'),以此来清除一下cookies
  28.  
  29. //1.4更新,更新了全自动刷课功能(不会被抓吧(逃
  30. //目前已知bug,计时器在拦截时会一直计数,原因:暂时未知
  31.  
  32.  
  33.  
  34. (function() {
  35. 'use strict';
  36. if (window.location.href.match(/play/g)) {
  37.  
  38. function checkCookie(){
  39. var user=getCookie("username");
  40. if (user!=""){
  41. // alert("欢迎 " + user + " 再次访问");
  42. }
  43. else {
  44. GM_notification({
  45. text: '刷课系统已经就绪!',
  46. timeout: 3000,
  47. });
  48. user = prompt("请输入你的名字:","好巧啊彦祖");
  49. if (user!="" && user!=null){
  50. setCookie("username",user,30);
  51. }
  52. }
  53. }
  54.  
  55.  
  56. function alert_user(){
  57. document.getElementsByClassName("video_cont")[0].children[2].innerText='PS:自动刷课系统_已就绪!\n v1.4.0 by Onion';
  58. }
  59.  
  60. function random_Times(){
  61. var times= Math.floor((Math.random())+0.5) //随机1-2
  62. return times;
  63. }
  64.  
  65. var video = document.querySelector("video");
  66.  
  67.  
  68. var button_1 = document.createElement("button"); //创建一个按钮
  69. button_1.textContent = "开刷"; //按钮内容
  70. button_1.style.width = "109px"; //按钮宽度
  71. button_1.style.height = "22px"; //按钮高度
  72. button_1.style.align = "center"; //居中
  73. button_1.style.color = "black"; //按钮文字颜色
  74. // button_1.style.background = "E0E0E0"; //按钮底色
  75. button_1.addEventListener("click", clickButton_1)
  76.  
  77.  
  78. var button_2 = document.createElement("button"); //创建一个按钮
  79. button_2.textContent = "不刷了"; //按钮内容
  80. button_2.style.width = "109px"; //按钮宽度
  81. button_2.style.height = "22px"; //按钮高度
  82. button_2.style.align = "center"; //居中
  83. button_2.style.color = "black"; //按钮文字颜色
  84. // button_2.style.background = "E0E0E0"; //按钮底色
  85. button_2.addEventListener("click", clickbutton_2)//祖传按钮
  86.  
  87. var times= random_Times();
  88. function clickButton_1(){
  89. starting();
  90. console.log("开刷")
  91. var times= random_Times();
  92. $.cookie('do_it', 1);
  93. location.reload();
  94. }
  95.  
  96. function clickbutton_2(){
  97. clearInterval(window.start);
  98. console.log("不刷了不刷了,累了累了")
  99. video.pause();
  100. $.cookie('do_it', 0);
  101. location.reload();
  102. return;
  103. }
  104.  
  105.  
  106.  
  107. var i=0; // 拦截次数
  108. var toolbox = document.getElementsByClassName('video_tab')?document.getElementsByClassName('video_tab')[0]:false;
  109. if(toolbox){
  110. toolbox.appendChild(button_1);
  111. toolbox.appendChild(button_2);
  112. }
  113.  
  114. var para= document.createElement("p")
  115. document.getElementsByClassName("video_cont")[0].appendChild(para);
  116. checkCookie();
  117. alert_user();
  118.  
  119. setTimeout(function(){
  120. if($.cookie('do_it')==1){
  121. starting();
  122. }
  123. },1000)
  124. //主函数:
  125. /*
  126. function clickPlayBtn(){
  127. var temp = document.createEvent("MouseEvents"); //建立鼠标事件
  128. temp.initEvent("click", true, true);
  129. var list = document.getElementsByClassName("plyr__controls__item plyr__control");//播放按钮
  130. for (let i = 0; i < list.length; i++) {
  131. const btn = list[i];
  132. if(btn.getAttribute("aria-label") == "Play"){
  133. btn.dispatchEvent(temp)
  134. }
  135. }
  136. }//这几行没啥用
  137. */
  138.  
  139. function starting(){
  140. if($.cookie('do_it')==1){
  141. window.start=setInterval(function(){ //循环开始
  142.  
  143. if (document.getElementsByClassName("video_red1")[0].children[0].style.color==="red" && document.getElementsByClassName("video_red1")[0].nextSibling.nextSibling!==null){
  144.  
  145. document.getElementsByClassName("video_red1")[0].nextSibling.nextSibling.children[0].click();
  146. }
  147. else{
  148. if(document.getElementsByClassName("video_red1")[0].children[0].style.color==="red" && document.getElementsByClassName("video_red1")[0].nextSibling.nextSibling===null){
  149. GM_notification({
  150. text: '臭宝这章学完啦!',
  151. timeout: 3000,
  152. });
  153. console.log("宝儿去下一章吧")
  154. //window.clearInterval(start);
  155. clearInterval(window.start);
  156. window.location.href="https://"+window.document.domain+"/user/lesson"
  157.  
  158. }
  159. else{ //开刷!!!
  160. var video = document.querySelector("video");
  161. if(video.paused){
  162. video.play();
  163.  
  164.  
  165. }
  166.  
  167. if(document.getElementsByClassName("public_cancel")[0]===undefined){
  168. //console.log("我刷")
  169.  
  170.  
  171. }
  172.  
  173. else{
  174. document.getElementsByClassName("public_cancel")[0].click();
  175. i=i+1;
  176. console.log("拦截成功")
  177.  
  178. // setTimeout(function(){
  179. // console.log("inside_Fun")
  180. // document.getElementsByClassName("plyr__control")[0].click(); 谷歌浏览器禁止了这个操作,但我还是找到其他方法了QAQ
  181. // },4000);
  182.  
  183. }
  184. if (!document.getElementsByClassName("public_submit")[0]){
  185. //console.log("我刷")
  186. }
  187. else{
  188. document.getElementsByClassName("public_submit")[0].click();
  189. // document.getElementsByClassName("plyr__control")[0].click();
  190. console.log("拦截成功")
  191. i=i+1;
  192. }
  193. }
  194. }
  195.  
  196.  
  197. document.getElementsByClassName("video_cont")[0].children[2].innerText='欢迎 \''+$.cookie("username")+'\' \n欸嘿,我已经为你拦截了'+i+'次弹窗咯\nPS:火狐目前不支持,请换Chrome\n如果拦截数一直增加,也不用管他,能用就行';
  198. } ,times*1500)
  199. }
  200.  
  201. }
  202. }
  203.  
  204. if (window.location.href.match(/user\/lesson/g)){
  205. console.log("让我康康你看了多少")
  206. console.log("脚本已启用,将自动进行刷课")
  207. console.log("3秒后将自动开始刷课")
  208. GM_notification({
  209. text: '5秒后将自动开始刷课!',
  210. timeout: 5000,
  211. });
  212. /*
  213. let classAll = document.getElementsByClassName('study_plan2')
  214. classAll.forEach((e,index)=>{
  215. document.getElementsByClassName('study_plan2')[0].childNodes[5].children[2].style.color
  216. })
  217. */
  218. setTimeout(()=>{
  219. Array.from(document.querySelectorAll('.study_plan2')).forEach((e,index) =>{
  220. if(e.childNodes[5].children[2].style.color=="red"){
  221. e.childNodes[5].children[1].children[0].click()
  222. }
  223. });
  224. },5000)
  225.  
  226. }
  227.  
  228. function setCookie(cname,cvalue,exdays){
  229. var d = new Date();
  230. d.setTime(d.getTime()+(exdays*24*60*60*1000));
  231. var expires = "expires="+d.toGMTString();
  232. document.cookie = cname+"="+cvalue+"; "+expires;
  233. }
  234. function getCookie(cname){
  235. var name = cname + "=";
  236. var ca = document.cookie.split(';');
  237. for(var i=0; i<ca.length; i++) {
  238. var c = ca[i].trim();
  239. if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
  240. }
  241. return "";
  242. }
  243. })();

QingJ © 2025

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