更好的直播体验(最高清晰度、禁弹幕、禁广告)

自动选择最高清晰度、禁止弹幕、禁止广告。

当前为 2020-06-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name 更好的直播体验(最高清晰度、禁弹幕、禁广告)
  3. // @namespace lhzbxx
  4. // @version 2020.06.01
  5. // @description 自动选择最高清晰度、禁止弹幕、禁止广告。
  6. // @author lhzbxx
  7. // @noframes
  8. // @require https://code.jquery.com/jquery-latest.js
  9. // @require https://greasyfork.org/scripts/2199-waitforkeyelements/code/waitForKeyElements.js?version=6349
  10. // @match *://live.bilibili.com/*
  11. // @match *://*.douyu.com/*
  12. // @match *://*.huya.com/*
  13. // @match *://*.yy.com/*
  14. // @match *://egame.qq.com/*
  15. // @grant none
  16. // ==/UserScript==
  17.  
  18. const config = {
  19. huya: {
  20. selectors: [
  21. '#player-danmu-btn',
  22. 'ul.player-videotype-list > li:nth-child(1)',
  23. 'div.ab-close-btn',
  24. ],
  25. timeout: 1500,
  26. },
  27. douyu: {
  28. selectors: [
  29. `div[class^='showdanmu-']`,
  30. `div[class^='tip-'] > ul > li:nth-child(1)`,
  31. ],
  32. },
  33. bilibili: {
  34. selectors: [
  35. 'i.live-icon-danmaku-on',
  36. ],
  37. },
  38. qq: {
  39. selectors: [
  40. 'div.vcp-extended-barrage',
  41. 'a.vcp-vertical-switcher-item-clarity:nth-child(1)',
  42. ],
  43. },
  44. }
  45.  
  46. const site = config[document.domain.split('.').reverse()[1]];
  47.  
  48. (function() {
  49. 'use strict';
  50.  
  51. if (!site) {
  52. return;
  53. }
  54.  
  55. site.selectors.forEach(selector => {
  56. setTimeout(() => {
  57. waitForKeyElements(selector, (node) => {
  58. node.click();
  59. });
  60. }, site.timeout || 0);
  61. });
  62. })();