YouTube - automatically expand subscription list

Automatically click the "Show More" subscriptions button in the side bar

当前为 2018-05-10 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name YouTube - automatically expand subscription list
  3. // @description Automatically click the "Show More" subscriptions button in the side bar
  4. // @namespace http://tampermonkey.net/
  5. // @version 0.1.1
  6. // @author Valacar
  7. // @include https://www.youtube.com/*
  8. // @noframes
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function expandSubscriptions() {
  16. const drawerSections = document.querySelectorAll("app-drawer ytd-guide-section-renderer");
  17. for (let section of drawerSections) {
  18. const subscriptionHeader = section.querySelector('h3 a[href="/feed/channels"]');
  19. if (subscriptionHeader) {
  20. const expander = section.querySelector('#expander-item');
  21. if (expander && window.getComputedStyle(expander).getPropertyValue("display") === "block") {
  22. expander.click();
  23. }
  24. }
  25. }
  26. }
  27.  
  28. window.addEventListener("loadstart", expandSubscriptions, true );
  29. })();