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

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2025/12/28 07:13:00
🔄 下次更新时间:2025/12/28 08:13:00
手动刷新缓存

YouTube - Add "Stop Video" Button

Adds a 'Stop Video' button below the video

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

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

公众号二维码

扫码关注【爱吃馍】

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

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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

公众号二维码

扫码关注【爱吃馍】

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

// ==UserScript==
// @name            YouTube - Add "Stop Video" Button
// @namespace       https://greasyfork.org/en/users/321-joesimmons
// @description     Adds a 'Stop Video' button below the video
// @include         http://*.youtube.com/watch*v=*
// @include         https://*.youtube.com/watch*v=*
// @include         http://youtube.com/watch*v=*
// @include         https://youtube.com/watch*v=*
// @include         http://youtube.com/user/*
// @include         https://youtube.com/user/*
// @include         http://youtube.com/channel/*
// @include         https://youtube.com/channel/*
// @include         http://*.youtube.com/user/*
// @include         https://*.youtube.com/user/*
// @include         http://*.youtube.com/channel/*
// @include         https://*.youtube.com/channel/*
// @copyright       JoeSimmons
// @version         1.1.0
// @license         GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @require         https://greasyfork.org/scripts/2104-youtube-button-container-require/code/YouTube%20-%20Button%20Container%20(@require).js?version=5493
// @grant           GM_addStyle
// ==/UserScript==

/* CHANGELOG

    1.1.0 (12/13/2013)
        - changed license to GPLv3

    1.0.9 (12/13/2013)
        - started using my new @require for adding buttons to the page

    1.0.8 (12/11/2013)
        - started adding the stop button to a div under the movie player
            so other scripts can use that space to add buttons to also

    1.0.7 (11/23/2013)
        - fixed something I missed in 1.0.6

    1.0.6 (11/23/2013)
        - adapted to site change

    1.0.5 (9/6/2013)
        - made it work on user/channel pages

    1.0.4 (9/1/2013)
        - made it support the YouTube 'red bar' feature

    1.0.3 (8/31/2013)
        - included https pages

    1.0.2 (8/30/2013)
        - now supports native Chrome & Opera

    1.0.1
        - made it more cross-browser compatible

    1.0.0
        - created

*/

(function () {
    'use strict';

    var verif = /youtube\.com\/((watch\?[a-zA-Z]+=)|(user|channel))/,
        button_id = 'movie_stop_button';

    function run(t) {
        var s = document.createElement('script');
            s.innerHTML = t;
        document.body.appendChild(s);
        document.body.removeChild(s);
    }

    function stopVideo() {
        run('' +
            '(function () {' +
                'var player = document.querySelector("#c4-player, #movie_player");' +
                'if (player.stopVideo) {' +
                    'player.stopVideo();' +
                '} else if (player.pauseVideo) {' +
                    'player.pauseVideo();' +
                '} else if (player.pause) {' +
                    'player.pause();' +
                '}' +
            '}());' +
        '');
    }

    function addButton() {
        var button = document.getElementById(button_id);

        if (button == null) {
            addButtonToContainer('Stop Video', stopVideo, button_id);
        }
    }

    // make sure the page is not in a frame
    if (window !== window.top) { return; }

    window.setInterval(addButton, 1000);

}());