YouTube (New Design) | Expand All Video Comments

Automatically expand all YouTube video comments. No more clicking "View all replies" or "Read more".

目前为 2018-06-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name YouTube (New Design) | Expand All Video Comments
  3. // @namespace de.sidneys.userscripts
  4. // @homepage https://gist.githubusercontent.com/sidneys/6756166a781bd76b97eeeda9fb0bc0c1/raw/
  5. // @version 1.0.0
  6. // @description Automatically expand all YouTube video comments. No more clicking "View all replies" or "Read more".
  7. // @author sidneys
  8. // @icon https://www.youtube.com/favicon.ico
  9. // @include http*://www.youtube.com/*
  10. // @require https://greasyfork.org/scripts/38888-greasemonkey-color-log/code/Greasemonkey%20%7C%20Color%20Log.js
  11. // @require https://greasyfork.org/scripts/38889-greasemonkey-waitforkeyelements-2018/code/Greasemonkey%20%7C%20waitForKeyElements%202018.js
  12. // @run-at document-end
  13. // ==/UserScript==
  14.  
  15. /**
  16. * @default
  17. * @constant
  18. * @global
  19. */
  20. DEBUG = false;
  21.  
  22.  
  23. /**
  24. * @default
  25. * @constant
  26. */
  27. const urlPath = '/watch';
  28.  
  29. /**
  30. * Init
  31. */
  32. let init = () => {
  33. console.info('init');
  34.  
  35. // Check URL
  36. if (!location.pathname.startsWith(urlPath)) { return; }
  37.  
  38. // Wait for "View all reples"
  39. waitForKeyElements('.more-button.ytd-comment-replies-renderer', (element) => {
  40. element.click();
  41. console.info('Expanded:', '"View all replies"');
  42. });
  43.  
  44. // Wait for "Read More"
  45. waitForKeyElements('.more-button.ytd-comment-renderer', (element) => {
  46. element.click();
  47. console.info('Expanded:', '"Read More"');
  48. });
  49. };
  50.  
  51.  
  52. /**
  53. * @listens window:Event#load
  54. */
  55. window.addEventListener('load', () => {
  56. console.debug('window#load');
  57.  
  58. init();
  59. });
  60.  
  61. /**
  62. * @listens window:Event#spfdone
  63. */
  64. window.addEventListener('spfdone', () => {
  65. console.debug('window#spfdone');
  66.  
  67. init();
  68. });