🏠 Home 

#旗飘飘~~~UESTC

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


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

คุณอาจชื่นชอบ 究极美化必应搜索页面(毛玻璃)(原 Bing beautification)


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