Greasy Fork镜像 支持简体中文。

武汉大学教务系统看板娘

计算GPA以及自定义教务系统背景等等

目前為 2020-08-13 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 武汉大学教务系统看板娘
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.3
  5. // @description 计算GPA以及自定义教务系统背景等等
  6. // @author saayuuk1
  7. // @match http://bkjw.whu.edu.cn/stu/stu_index.jsp
  8. // @license MIT
  9. // @require https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js
  10. // ==/UserScript==
  11.  
  12. function analysePointfromScore(score) {
  13. if (score >= 90.0) {
  14. return 4.0;
  15. } else if (score >= 85.0) {
  16. return 3.7;
  17. } else if (score >= 82.0) {
  18. return 3.3;
  19. } else if (score >= 78.0) {
  20. return 3.0;
  21. } else if (score >= 75.0) {
  22. return 2.7;
  23. } else if (score >= 72.0) {
  24. return 2.3;
  25. } else if (score >= 68.0) {
  26. return 2.0;
  27. } else if (score >= 64.0) {
  28. return 1.5;
  29. } else if (score >= 60.0) {
  30. return 1.0;
  31. } else {
  32. return 0.0;
  33. }
  34. }
  35.  
  36. async function getGPA() {
  37. 'use strict';
  38.  
  39. // Your code here...
  40. var GPA = 4.0;
  41. await $.ajax('/servlet/Svlt_QueryStuScore?year=0&term=&learnType=&scoreFlag=0').done(function (data) {
  42. var
  43. i,
  44. re = /<tr null>([\s\S]*?)<\/tr>/g,
  45. str,
  46. re_score = /<!-- 成绩 -->([\s\S]*?)<td>([\s\S]*?)<\/td>/,
  47. re_credit = /<!-- 学分 -->([\s\S]*?)<td>([\s\S]*?)<\/td>/,
  48. str_s,
  49. point,
  50. credit,
  51. total_point = 0.0,
  52. total_credit = 0.0;
  53. while (true) {
  54. str = re.exec(data);
  55. if (!str) {
  56. break;
  57. } else {
  58. str_s = re_score.exec(str);
  59. if (!str_s || !str_s[2]) {
  60. continue;
  61. } else {
  62. point = analysePointfromScore(parseFloat(str_s[2]));
  63. }
  64. str_s = re_credit.exec(str);
  65. if (!str_s || !str_s[2]) {
  66. continue;
  67. } else {
  68. credit = parseFloat(str_s[2]);
  69. }
  70. total_point += point * credit;
  71. total_credit += credit;
  72. }
  73. }
  74. GPA = total_point / total_credit;
  75. }).fail(function (xhr, status) {
  76.  
  77. }).always(function () {
  78.  
  79. });
  80. return GPA;
  81. };
  82.  
  83. $(function beautifyIndex(url, opacity) {
  84. //背景图片URL
  85. url = 'url(' + url + ')';
  86. //关闭二维码页面
  87. var KF = $(".keifu");
  88. var kf_close = $(".keifu .keifu_close");
  89. $(kf_close).click(function(){
  90.  
  91. KF.animate({width:"0"},200,function(){
  92. wkbox.hide();
  93. icon_keifu.show();
  94. KF.animate({width:26},300);
  95. });
  96. });
  97. $(kf_close).click();
  98. //设置背景图片
  99. var
  100. width = $('#container').css('width'),
  101. height = $('#main_contaier').css('height');
  102. $('#footer').css('height', '0px');
  103. $('#main_contaier').css('width', width);
  104. $('#container').css('height', height);
  105. $('#main_contaier').css('height', '880px');
  106. $('#main_contaier').css('background-image', url);
  107. //设置框架透明度
  108. $('#page_iframe').css('opacity', opacity);
  109. $('#bar_iframe').css('opacity', opacity);
  110. //将选项置于框架前
  111. $('#btn1').css('z-index', '1');
  112. $('#btn2').css('z-index', '1');
  113. $('#btn3').css('z-index', '1');
  114. $('#btn5').css('z-index', '1');
  115. $('#btn9').css('z-index', '1');
  116. });
  117.  
  118. /*$(function beautifySubmit() {
  119. $('#background-submit').click(function () {
  120. var url = $('#background-url');
  121. var opacity = $('#background-opacity');
  122. beautifyIndex(url[0].value || 'https://pic4.zhimg.com/v2-d6a6db9d5db45618fb67536920c50c10_r.jpg', opacity[0].value || '0.8');
  123. $('#background-config').remove();
  124. });
  125. });*/
  126.  
  127. function beautifyConfig() {
  128. //自定义界面设置
  129. $('#top').append('<form id="background-config">\
  130. <input type="text" id="background-url" placeholder="请输入图片链接" style="position:absolute;left:600px;top:100px"/>\
  131. <input type="text" id="background-opacity" placeholder="请输入透明度(0~1)" style="position:absolute;left:800px;top:100px"/>\
  132. <input type="button" id="background-submit" value="确认" style="width:45px;position:absolute;left:1000px;top:102px;text-align:justify;"/>\
  133. <style>\
  134. input{\
  135. font-size:12px;\
  136. height:30px;\
  137. border-radius:4px;\
  138. border:1px solid #c8cccf;\
  139. color:#986655;\
  140. outline:0;\
  141. text-align:left;\
  142. padding-left: 10px;\
  143. display:block;\
  144. cursor: pointer;\
  145. box-shadow: 2px 2px 5px 1px #ccc;z-index: 1;\
  146. }\
  147. input::-webkit-input-placeholder{\
  148. color:#986655;\
  149. font-size: 12px;\
  150. }\
  151. </style>');
  152. $('#background-submit').click(function () {
  153. var url = $('#background-url');
  154. var opacity = $('#background-opacity');
  155. beautifyIndex(url[0].value || 'https://pic4.zhimg.com/v2-d6a6db9d5db45618fb67536920c50c10_r.jpg', opacity[0].value || '0.8');
  156. $('#background-config').remove();
  157. });
  158. }
  159.  
  160. function beautify() {
  161. //beautifyIndex();
  162. beautifyConfig();
  163. }
  164.  
  165. (function () {
  166. $('body').append('<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>\
  167. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome/css/font-awesome.min.css"/>\
  168. <script src="https://cdn.jsdelivr.net/gh/saayuuk1/live2d-widget@1.0.3/autoload.js"></script>');
  169. })();

QingJ © 2025

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