Remove_Live

去除B站多余的直播播放器(滑稽)

  1. // ==UserScript==
  2. // @name Remove_Live
  3. // @namespace https://blog.chrxw.com
  4. // @version 1.0
  5. // @description 去除B站多余的直播播放器(滑稽)
  6. // @author Chr_
  7. // @include https://live.bilibili.com/*
  8. // @license AGPL-3.0
  9. // @icon https://blog.chrxw.com/favicon.ico
  10. // @grant GM_setValue
  11. // @grant GM_getValue
  12. // ==/UserScript==
  13.  
  14. (() => {
  15. 'use strict';
  16. //去除播放器的开关
  17. let VEnable = false;
  18. VEnable = GM_getValue('VE') == true;
  19. if (VEnable) {
  20. setTimeout(() => {
  21. document.getElementById('live-player').remove();
  22. }, 3000);
  23. }
  24. let btnArea = document.querySelector('.upper-right-ctnr');
  25. let btn = document.createElement('button');
  26. btn.id = 'removeLive';
  27. btn.textContent = bool2txt(VEnable) + '移除播放器';
  28. btn.addEventListener('click', removeLive);
  29. btnArea.insertBefore(btn, btnArea.children[0]);
  30. function removeLive() {
  31. VEnable = !VEnable;
  32. GM_setValue('VE', VEnable);
  33. btn.textContent = bool2txt(VEnable) + '移除播放器';
  34. if (VEnable) {
  35. document.getElementById('live-player').remove();
  36. } else {
  37. window.location.reload();
  38. }
  39. }
  40. // 显示布尔
  41. function bool2txt(bool) {
  42. return bool ? '【√】' : '【×】';
  43. }
  44. })();
  45.