🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Show Autoplay Button on YouTube

Forces YouTube autoplay toggle to be visible

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

Author
TechnicalGlitch
Daily installs
0
Total installs
6
Ratings
0 0 0
Version
1.0
Created
2025-05-06
Updated
2025-05-06
Size
917 Bytes
License
MIT
Applies to

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.