Disable Youtube autoplay

Turns off Youtube's newer autoplay feature on load

目前为 2017-10-30 提交的版本。查看 最新版本

// To run, install Chrome Tampermonkey extension
// Copy this code into new user script, and enable

// ==UserScript==
// @name         Disable Youtube autoplay
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Turns off Youtube's newer autoplay feature on load
// @author       Jeff Bellucci
// @match        *://www.youtube.com/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function uncheck(toggle) {
        if (toggle.checked) {
            toggle.click();
        }
    }

    function disableAfterLoad() {
        var autoplayToggle = document.getElementById('toggle');
        if (!autoplayToggle) {
            setTimeout(disableAfterLoad, 500);
        } else {
            uncheck(autoplayToggle);
        }
    }

    disableAfterLoad();
})();