Bangumi 首页改造计划

修改 Bangumi 首页

  1. // ==UserScript==
  2. // @name Bangumi 首页改造计划
  3. // @namespace https://github.com/LearnDifferent
  4. // @version 0.3
  5. // @description 修改 Bangumi 首页
  6. // @author Zhou
  7. // @match *://bgm.tv/
  8. // @match *://bangumi.tv/
  9. // @grant none
  10. // @icon http://bgm.tv/img/favicon.ico
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function () {
  15. 'use strict';
  16.  
  17. // 将首页右上方的内容放置到最后
  18. document.getElementById('columnHomeB').id = '';
  19.  
  20. // 触发切换首页样式到按钮
  21. const btnList = document.getElementById('prgManagerMode');
  22. const styleChangeBtn = btnList.getElementsByTagName('a')[1];
  23. styleChangeBtn.click();
  24.  
  25. // 移除切换首页样式按钮
  26. document.getElementById('switchNormalManager').remove();
  27.  
  28. // 将首页展示条目的部分拓宽到 100%
  29. const columnHomeA = document.getElementById('columnHomeA');
  30. columnHomeA.setAttribute('style', 'width: 100%');
  31.  
  32. // 将每个条目的字体调大
  33. const allSubjects = document.getElementsByClassName('tinyMode');
  34. for (let sub of allSubjects) {
  35. sub.setAttribute('style', 'font-size: medium; width: 45%; height: 15%');
  36. }
  37.  
  38. // 将所有集数的按钮放大
  39. const eps = document.getElementsByClassName('epGird');
  40. for (let ep of eps) {
  41. // 每个集数的按钮
  42. let epBtns = ep.getElementsByTagName('li');
  43. for (let epBtn of epBtns) {
  44. epBtn.setAttribute('style', 'transform: scale(1.1);');
  45. }
  46. }
  47.  
  48. // 将所有图片放大
  49. const allAvatar = document.getElementsByClassName('avatarSize48');
  50. for (let ava of allAvatar) {
  51. let originStyle = ava.getAttribute('style');
  52. ava.setAttribute('style', 'width: 55px; height: 55px; ' + originStyle);
  53. }
  54.  
  55. // 将每个条目标题后面的进度放大
  56. const tinyHeaders = document.getElementsByClassName('tinyHeader');
  57. for (let tHeader of tinyHeaders) {
  58. // 替换 small 标签为 medium 标签
  59. // 获取进度的元素(index 为 0 是进度的元素,index 为 1 是 edit 按钮的元素)
  60. let progressPercentText = tHeader.getElementsByClassName('progress_percent_text')[0];
  61.  
  62. let medium = document.createElement('medium');
  63. medium.innerHTML = progressPercentText.innerHTML;
  64. medium.className = progressPercentText.className;
  65. medium.id = progressPercentText.id;
  66. progressPercentText.parentNode.replaceChild(medium, progressPercentText);
  67. medium.setAttribute('style', 'color: #2774FF');
  68. }
  69.  
  70. // 将在看按钮的文字放大
  71. const watchBtns = document.getElementsByClassName('prgCheckIn textTip');
  72. for (let watchBtn of watchBtns) {
  73. let originTitle = watchBtn.getAttribute('data-original-title');
  74. let newTitle = originTitle.replace('<small>', '');
  75. newTitle = newTitle.replace('</small>', '');
  76. watchBtn.setAttribute('data-original-title', newTitle);
  77. }
  78.  
  79. // 将条目倒叙(初始的条目顺序是将最近看完的放在前面,而每周看完动画后,我想标记的应该是最久没看的才对)
  80. let subjectsParent = document.querySelector("div[class='infoWrapper_tv hidden clearit']");
  81. reverseChildren(subjectsParent);
  82.  
  83. /**
  84. * 将 parent 的子节点倒序
  85. * @param parent 父元素
  86. */
  87. function reverseChildren(parent) {
  88. for (let i = 1; i < parent.childNodes.length; i++) {
  89. parent.insertBefore(parent.childNodes[i], parent.firstChild);
  90. }
  91. }
  92.  
  93. })();

QingJ © 2025

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