YouTube Videos Tab Auto-Loader

A script that automatically loads the "Videos" tab on a YouTube channel page as the default tab, after the webpage has loaded.

  1. // ==UserScript==
  2. // @name YouTube Videos Tab Auto-Loader
  3. // @description A script that automatically loads the "Videos" tab on a YouTube channel page as the default tab, after the webpage has loaded.
  4. // @version 1.0
  5. // @author Midnight
  6. // @match https://www.youtube.com/*/channel/*
  7. // @run-at document-ready
  8. // @grant none
  9. // @license MIT
  10. // @namespace https://greasyfork.org/users/1082643
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. "use strict";
  15.  
  16. // Get the current document
  17. const doc = document;
  18.  
  19. // Get the channel id from the URL
  20. const channelId = doc.location.pathname.split("/")[3];
  21.  
  22. // Get the "Videos" tab
  23. const videosTab = doc.getElementById("videos-tab");
  24.  
  25. // Set the "Videos" tab as the default tab
  26. videosTab.setAttribute("selected", true);
  27.  
  28. })();