turn volume in youtube to "1"

It makes your youtube video volume output at it's maximum as long as you have 100% on.

Fra 29.05.2021. Se den seneste versjonen.

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 or Violentmonkey 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!)

// ==UserScript==
// @name         turn volume in youtube to "1"
// @namespace    https://greasyfork.org/de/users/777213-tripzz-ѕкιηѕ-lpwsand
// @version      0.4
// @description  It makes your youtube video volume output at it's maximum as long as you have 100% on.
// @author       Genc
// @match        https://www.youtube.com/watch*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

        setTimeout(function() {
            document.getElementsByClassName("video-stream")[0].volume = 1;
        }, 550);


        function insertAfter(referenceNode, newNode) {
            referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
          };

        var volumeSign = document.getElementsByClassName("ytp-next-button ytp-button")[0];

        var setValue = document.createElement("span");
        setValue.textContent = 1;
        setValue.style.width = "23.354px";
        setValue.style.textAlign = "center";

        insertAfter(volumeSign, setValue);

        setValue.addEventListener("click", function() {
            var svgAnimationSpeaker = document.getElementsByClassName("ytp-svg-fill ytp-svg-volume-animation-speaker")[0];
            if(setValue.textContent == 1) {
                document.getElementsByClassName("video-stream")[0].volume = 0.49831044449650735;
                setValue.textContent = 0.49;
                document.getElementsByClassName("ytp-volume-slider-handle")[0].style.left = "40px";
                svgAnimationSpeaker.setAttribute("d","M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z")
            } else if (setValue.textContent == 0.49) {
                document.getElementsByClassName("video-stream")[0].volume = 1;
                setValue.textContent = 1;
                document.getElementsByClassName("ytp-volume-slider-handle")[0].style.left = "40px";
                svgAnimationSpeaker.setAttribute("d","M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z")
            } else {
                setValue.textContent = "Refresh your site.";
            };
        });
})();