BiliPlus

哔哩哔哩错误视频自动跳转

  1. // ==UserScript==
  2. // @name BiliPlus
  3. // @namespace https://www.biliplus.com/
  4. // @version 1.13
  5. // @description 哔哩哔哩错误视频自动跳转
  6. // @author SettingDust
  7.  
  8. // @include http*://*.bilibili.com/*
  9.  
  10. // @require https://code.jquery.com/jquery-latest.js
  11.  
  12. // @run_at document_idle
  13. // ==/UserScript==
  14. //视频跳转
  15. $(window).load(function () {
  16. let body = $('body');
  17.  
  18. if ($('.error-container').length > 0)
  19. location.replace(location.href.replace(/\:\/\/www\.bilibili\.com\/video/, '://www.biliplus.com/video'));
  20. if ($('.video-list-status-text').length > 0)
  21. location.replace(location.href.replace(/\:\/\/bangumi\.bilibili\.com\/anime/, '://www.biliplus.com/bangumi/i'));
  22. if ($('.player-limit-wrap').length > 0)
  23. location.replace(location.href.replace(/\:\/\/www\.bilibili\.com/, '://www.biliplus.com'));
  24.  
  25. //添加订阅链接
  26. $('ul.fr li').each(function () {
  27. let html = $(this).prop("outerHTML");
  28. if (html.indexOf('favlist') !== -1) {
  29. html = html.replace('favlist', 'bangumi');
  30. html = html.replace('收藏夹', '订阅');
  31. $('ul.fr').append(html);
  32. }
  33. });
  34. //收藏夹跳转
  35. body.mouseover(function () {
  36. $('.small-item.disabled').each(function () {
  37. $(this).removeClass('disabled');
  38. $(this).find('a').attr('href', 'https://www.biliplus.com/video/av' + $(this).attr('data-aid'));
  39. $(this).find('a').attr('target', '_blank');
  40. });
  41. $('.disabled-cover').remove();
  42. });
  43. //直播间历史聊天可到最顶部
  44. if ($('#rank-list-vm').length > 0) {
  45. $('#rank-list-vm').css('height', '152px');
  46. $('.chat-history-panel').css('height', 'calc(100% - 128px - 152px)');
  47. }
  48. /* -------------首页------------- */
  49. //首页推广删除
  50. $('#home_popularize>.l-con').remove();
  51. $('.gg-floor-module').remove();
  52. //首页顶部推荐
  53. $('#chief_recommend').remove();
  54. //直播
  55. $('#bili_live').hide();
  56. $('.nav-list>.item[sortindex="0"]').hide();
  57. //特别推荐
  58. $('#special_recommend').remove();
  59. //广告
  60. $('#bili_ad').hide();
  61. $('.nav-list>.item[sortindex="11"]').hide();
  62. //时尚
  63. $('#bili_fashion').hide();
  64. $('#bili_ent').hide();
  65. $('.nav-list>.item[sortindex="10"]').hide();
  66. $('.nav-list>.item[sortindex="12"]').hide();
  67. //主菜单修改
  68. addCss(`
  69. #home_popularize {
  70. height: 48px;
  71. display: flex;
  72. align-items: center;
  73. margin-right: 0;
  74. margin-left: 14px;
  75. }
  76. @media screen and (min-width: 1400px) {
  77. #home_popularize {
  78. margin-left: 32px;
  79. }
  80. }`, 'Popularize');
  81.  
  82. let orginPopularize = $('#home_popularize');
  83. if (orginPopularize.length > 0) {
  84. $('#primary_menu>.nav-menu>.side-nav').remove();
  85. let popularize = $('<li\>');
  86. popularize.append(orginPopularize.children());
  87. popularize.get(0).classList = orginPopularize.get(0).classList;
  88. orginPopularize.remove();
  89. popularize.attr('id', 'home_popularize');
  90. $('#primary_menu>.nav-menu').append(popularize);
  91. $('.gif-menu.nav-gif').remove();
  92. }
  93. $('.nav-item.mobile').remove();
  94. $('.nav-item.nav-worldcup').remove();
  95.  
  96. //顶部修改
  97. addCss(`
  98. .bili-wrapper {
  99. margin: 16px auto;
  100. }
  101. .nav-item.live .i-frame,
  102. .nav-item {
  103. display: none !important;
  104. pointer-events: none !important;
  105. }
  106. .nav-item.home,
  107. .nav-item.hbili,
  108. .nav-item.mbili,
  109. .nav-item.live,
  110. .nav-con.fr .nav-item {
  111. display: list-item !important;
  112. pointer-events: all !important;
  113. }
  114. .nav-con.fr .nav-item[report-id="playpage_VIP"] {
  115. display: none !important;
  116. pointer-events: none !important;
  117. }`, 'Top');
  118.  
  119. /*视频页面*/
  120. addCss(`
  121. .app-download,
  122. #playpage_mobileshow,
  123. #arc_toolbar_report .tb-line,
  124. #live_recommand_report{
  125. display: none !important;
  126. pointer-events: none !important;
  127. }`,'Video');
  128. $('#playpage_mobileshow').remove();
  129.  
  130. /**
  131. * 添加style到head
  132. * @param css css内容
  133. * @param name style标识
  134. */
  135. function addCss(css, name) {
  136. let style = body.find("style[data-meta='" + name + "']:first");
  137. if (style.length === 0) {
  138. style = $("<style\>");
  139. }
  140. style.text(style.text() + css);
  141. style.attr("data-meta", name);
  142. body.append(style);
  143. }
  144. });