Show Autoplay Button on YouTube

Forces YouTube autoplay toggle to be visible

作者
TechnicalGlitch
日安装量
0
总安装量
1
评分
0 0 0
版本
1.0
创建于
2025-05-06
更新于
2025-05-06
大小
917 字节
许可证
MIT
适用于

Purpose

This userscript ensures that the Autoplay toggle button on YouTube remains visible at all times by forcing its display via a CSS rule.

YouTube sometimes hides the Autoplay toggle depending on screen size, playback context, or internal UI updates. This script ensures the element with aria-label~="Autoplay" is always displayed.


Features

  • Forces [aria-label~="Autoplay"] to use display: inline !important.
  • Injects CSS early (document-start) for maximum consistency.
  • Automatically re-injects style if YouTube dynamically changes the DOM (SPA behavior).
  • Lightweight and efficient.

How It Works

  • A <style> element containing the CSS rule is injected into the document <head>.
  • A MutationObserver monitors DOM changes and ensures the CSS persists through YouTube's single-page navigation system.
  • Uses a custom data-autoplay-fix attribute to prevent multiple injections.

Installation

  1. Install Tampermonkey or Violentmonkey.
  2. Click "Install" on this script page.
  3. Visit YouTube and the Autoplay toggle will now always be visible.

⚠ Notes

  • If YouTube changes its aria-label for the autoplay button (e.g., localizing it or renaming it), you may need to update the selector.
  • This script is designed for the default (English) YouTube UI.

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址