STU AIquestion

try to take over the world!

目前为 2019-12-18 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name STU AIquestion
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @include https://info.stu.edu.tw/aca/student/CoStuAns/*
  8. // @match https://info.stu.edu.tw/ACA/student/InstructionEffectSurvey/loginAction.asp
  9. // @match https://info.stu.edu.tw/ACA/student/InstructionEffectSurvey/stuSurvey.asp
  10. // @match https://info.stu.edu.tw/SAO/COC_Student/TeacherReview/teacher_comm.asp
  11. // @match https://info.stu.edu.tw/SAO/COC_Student/TeacherReview/prompt.asp
  12. // @match https://info.stu.edu.tw/ACA/student/CoStuAns/listQuestionView.asp
  13. // @grant none
  14. // @require http://code.jquery.com/jquery-3.4.1.min.js
  15. // ==/UserScript==
  16. (function(){
  17. function sleep(ms) {
  18. return new Promise(resolve => setTimeout(resolve, ms));
  19. }
  20. function submitInput(){
  21. var d = document;
  22. var a = d.getElementsByTagName('input');
  23. var b = d.getElementsByTagName('font');
  24. var i = 0;
  25. for (i = 0; i < b.length; i++) {
  26. if (b[i].innerHTML.indexOf('老師上課不依照進度進行') != -1) {
  27. b = b[i].id;
  28. b = b.replace('I', 'R');
  29. break;
  30. }
  31. }
  32. for (i = 0; i < a.length; i++){
  33. if (a[i].value == 5) a[i].checked = true;
  34. }
  35. var w = d.getElementsByName(b);
  36. for (i = 0; i < w.length; i++){
  37. if (w[i].value == 1) w[i].checked = true;
  38. }
  39.  
  40. }
  41.  
  42. if(location.href.endsWith("loginAction.asp")){
  43. console.log("loginAction.asp");
  44. document.getElementsByName("goQ")[0].click();
  45. }
  46.  
  47. if(location.href.endsWith("stuSurvey.asp")){
  48. console.log("stuSurvey.asp");
  49. submitInput();
  50.  
  51. document.getElementById("sendData").click();
  52. window.location.href = "https://info.stu.edu.tw/ACA/student/CoStuAns/StuOpinion.asp";
  53. }
  54.  
  55. if(location.href.endsWith("teacher_comm.asp")){
  56. submitInput();
  57. document.getElementById("InsDa").click();
  58. window.location.href = "https://info.stu.edu.tw/ACA/student/CoStuAns/StuOpinion.asp";
  59. }
  60.  
  61.  
  62. if(location.href.endsWith("prompt.asp")){
  63. window.close();
  64. }
  65.  
  66. if(location.href.startsWith("https://info.stu.edu.tw/aca/student/CoStuAns/listQuestionView.asp") || location.href.startsWith("https://info.stu.edu.tw/ACA/student/CoStuAns/listQuestionView.asp")){
  67. submitInput();
  68. var d = document;
  69. var a = d.getElementsByTagName('input');
  70. a[0].checked = true;
  71. a[6].checked = true;
  72. a[11].checked = true;
  73. a[16].checked = true;
  74. a[19].checked = true;
  75. a[24].checked = true;
  76.  
  77. document.getElementById("upset1").click();
  78. //window.location.href = "https://info.stu.edu.tw/ACA/student/CoStuAns/StuOpinion.asp?loginset=193";
  79. }
  80.  
  81. if(location.href.startsWith("https://info.stu.edu.tw/ACA/student/CoStuAns/StuOpinion.asp") || location.href.startsWith("https://info.stu.edu.tw/aca/student/CoStuAns/StuOpinion.asp")){
  82. var numberOfCourses = document.getElementsByTagName('tr').length;
  83. console.log(numberOfCourses);
  84.  
  85. try {
  86. (async function () {
  87. for (var count = 0; count < numberOfCourses; count++) {
  88. try{
  89. console.log(document.getElementsByTagName('tr')[count]);
  90. if(document.getElementsByTagName('tr')[6].children[4].children[0].innerHTML == "必填"){
  91. document.getElementsByTagName('tr')[count].click();
  92. }
  93.  
  94.  
  95. d.forms.Qform.submit();
  96. await sleep(1500);
  97. d = document.getElementById('contentFrame').contentWindow.document;
  98. await sleep(1500);
  99. document.querySelectorAll("p>a")[0].click();
  100. await sleep(3000);
  101. }catch(e){}
  102. //alert(count);
  103. }
  104. })();
  105. } catch (e) {
  106. console.log(e);
  107. } finally {
  108. d = document;
  109. sleep(1500);
  110. document.querySelectorAll("p>a")[0].click();
  111. sleep(1500);
  112. }
  113. }
  114. })();