YouTube Progressbar Updater

Forces the YouTube progress bar to update even when it's supposed to be hidden. Useful if you have a userstyle like YouTube Controls Under Player or Youtube Progress Bar Fix

2015-08-05 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

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

// ==UserScript==
// @name         YouTube Progressbar Updater
// @version      0.1
// @description  Forces the YouTube progress bar to update even when it's supposed to be hidden. Useful if you have a userstyle like YouTube Controls Under Player or Youtube Progress Bar Fix
// @author       Workgroups
// @match        *://www.youtube.com/watch/*
// @match        *://www.youtube.com/embed/*
// @grant        none
// @namespace https://greasyfork.org/users/14014
// ==/UserScript==

var findVideoInterval = setInterval(function() {
    var video = document.querySelector("video");
    var progressbar = document.querySelector(".ytp-play-progress");
    var loadbar = document.querySelector(".ytp-load-progress");
    if (!video || !progressbar || !loadbar) {
        return;
    }
    video.addEventListener("timeupdate",function() {
        progressbar.style.transform = "scaleX("+(video.currentTime/video.duration)+")";
    });
    video.addEventListener("progress",function() {
        loadbar.style.transform = "scaleX("+(video.buffered.end(video.buffered.length-1)/video.duration)+")";
    });
    clearInterval(findVideoInterval);
},500);