北理乐学美化

优化乐学的显示界面

  1. // ==UserScript==
  2. // @name 北理乐学美化
  3. // @namespace cn.edu.bit
  4. // @version 0.1
  5. // @description 优化乐学的显示界面
  6. /*
  7. 1. 通过判断是否有文件,来判断是否要隐藏
  8. 2. 统一修改各个项目的标题,为了让用户意识到某些项目是隐藏的,所以我们给不显示的周也打上周号以此来提醒用户
  9. 3. (准备增加一个还原按钮)
  10. */
  11. // @author SH
  12. // @match http://lexue.bit.edu.cn/course/view.php?id=*
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18. /*
  19. var btn=document.createElement("BUTTON");
  20. document.body.appendChild(btn);
  21. btn.clientHeight = 100;
  22. btn.clientWidth = 100;
  23. btn.innerHTML = "click me";
  24. */
  25.  
  26. function reBuild(){
  27. // 获取各个标题
  28. var items = document.getElementsByClassName("section main section-summary clearfix");
  29. // 用于记录第一个非空的周
  30. var order = 1;
  31. for(var i = 0;i < items.length; i++){
  32. // 修改标题
  33. items[i].getElementsByTagName("a")[0].innerHTML = "第" + (order++) + "周";
  34. // 判断是不是为空
  35. var isEmpty = items[i].getElementsByClassName("section-summary-activities pr-2 mdl-right").length == 0;
  36. // 设置为隐藏
  37. if(isEmpty) items[i].style.display = "none";
  38. }
  39. }
  40. window.setTimeout(reBuild(), 1500);
  41.  
  42. })();

QingJ © 2025

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