51Talk优化:智能排序

智能排序选课页

  1. // ==UserScript==
  2. // @name 51Talk优化:智能排序
  3. // @version 0.0.1
  4. // @namespace 51talk_sort
  5. // @description 智能排序选课页
  6. // @author qingcaomc@gmail.com
  7. // @license GPLv3
  8. // @match https://www.51talk.com/ReserveNew/index*
  9. // @match http://www.51talk.com/ReserveNew/index*
  10. // @icon https://avatars3.githubusercontent.com/u/25388328
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. //删除数组中的空元素
  17. Array.prototype.clean = function(deleteValue="") {
  18. for (var i = 0; i < this.length; i++) {
  19. if (this[i] == deleteValue) {
  20. this.splice(i, 1);
  21. i--;
  22. }
  23. }
  24. return this;
  25. };
  26.  
  27. function teacher_sort(a, b){
  28. return b - a;
  29. }
  30.  
  31. let num = /[0-9]*/g;
  32. let i_len = $(".label").length;
  33. let value = [];
  34. for(let i = 0; i < i_len; i++) {
  35. let j_len = $(".label")[i].textContent.match(num).clean("").length;
  36. value[i] = 0;
  37. for(let j = 0; j < j_len; j++) {
  38. value[i] += Number($(".label")[i].textContent.match(num).clean("")[j]);
  39. }
  40. value[i] /= 5;
  41. $(".teacher-name")[i].innerText += "(" + value[i] + ")";
  42. }
  43. console.log(value.sort(teacher_sort));
  44. })();

QingJ © 2025

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