Greasy Fork is available in English.

YouTube Sidebar Playlists Loader

Load and show YouTube playlists in the sidebar on hover

作者
ahmad2d
今日安裝
0
安裝總數
16
評價
0 0 0
版本
1.1.2
建立日期
2024-11-04
更新日期
2024-11-05
尺寸
6.7 KB
授權條款
MIT
腳本執行於

Additional Info

Description:

The YouTube Sidebar Playlists Loader script adds a custom "My Playlists" link to the YouTube sidebar. When hovered over, a submenu is displayed, showing all playlists from the user's account. The playlists are fetched automatically upon page load, and users can navigate directly to any playlist by clicking on its name.

How It Works:

  • Playlist Link Creation: The script waits for the YouTube page to load, then inserts a new "My Playlists" link into the sidebar. This link acts as a trigger to show a submenu with all the playlists.
  • Playlist Fetching: The script makes an HTTP request to YouTube's internal API to retrieve the list of playlists associated with the user. It then parses the response, extracts the playlist titles and URLs, and dynamically creates menu items.
  • Submenu Behavior: When users hover over the "My Playlists" link, the submenu is displayed. The submenu is positioned to the right of the link and remains visible while the mouse hovers over it. The submenu hides once the user moves the mouse away.

Features:

  • Hover Effects: Both the playlist link and the individual playlist items have hover effects. The playlist link changes its background color and adds rounded corners when hovered. Playlist items change color to yellow when hovered over.
  • Customizable Styles: The script includes basic styles for the link and submenu, such as font size, color, and padding, which can be easily modified to suit user preferences. Currently, dark mode styles only.
  • Cross-Domain Requests: The script utilizes the GM_xmlhttpRequest API to make cross-domain requests, allowing it to fetch playlist data directly from YouTube's feed.

Usage:

  1. Install this userscript using Tampermonkey or any other compatible userscript manager.
  2. Navigate to YouTube. Once the page fully loads, you will see a new "My Playlists" item in the sidebar.
  3. Hover over the "My Playlists" link to display the submenu with your playlists.
  4. Click any playlist in the submenu to open it in a new tab.

Notes:

  • The script is compatible with ECMAScript 2020+ (ES11+) and uses modern JavaScript features like const, let, arrow functions, optional chaining, and template literals.
  • It may require adjustments for use on non-English YouTube pages or if YouTube significantly changes its page structure.

Potential Issues:

  • If the "My Playlists" link doesn't appear, ensure that your YouTube sidebar is visible and accessible by the script.
  • The script may not work on YouTube pages that hidden or collapsed sidebar.
  • Styles works only for YouTube in dark mode.