Youtube disable lightsaber sound

Removes the annoying youtube lightsaber sound

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Youtube disable lightsaber sound
// @namespace    https://github.com/AnonymousMeerkat/youtube-no-lightsaber
// @version      1.0.3
// @description  Removes the annoying youtube lightsaber sound
// @author       Anonymous Meerkat
// @include      https://www.youtube.com/*
// @grant        none
// @run-at       document-end
// ==/UserScript==
/* jshint -W097 */
if (window.location.href.match(".youtube.com") !== null)
{
    light_main();
}

function light_main() {
    light_load_els();
    var loadinter = window.setInterval(function() {
        light_load_els();
    }, 10);

    var volume;
    var vchildren;
    var removeinter;
    function light_load_els() {
        volume = document.getElementsByClassName("ytp-volume-panel")[0];
        if (!volume)
            return;
        window.clearInterval(loadinter);
        vchildren = volume.children;
        light_remove_els();
        removeinter = window.setInterval(function() {
            light_remove_els();
        }, 100);
    }

    function light_remove_els() {
        if (vchildren.length < 2)
            return;
        for (var i = 1; i < vchildren.length; i++)
        {
            vchildren[i].pause();
            vchildren[i].src = "";
            vchildren[i].load();
            vchildren[i].remove();
        }
    }
}