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 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name YouTube Progressbar Updater
  3. // @version 0.1
  4. // @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
  5. // @author Workgroups
  6. // @match *://www.youtube.com/watch/*
  7. // @match *://www.youtube.com/embed/*
  8. // @grant none
  9. // @namespace https://greasyfork.org/users/14014
  10. // ==/UserScript==
  11.  
  12. var findVideoInterval = setInterval(function() {
  13. var video = document.querySelector("video");
  14. var progressbar = document.querySelector(".ytp-play-progress");
  15. var loadbar = document.querySelector(".ytp-load-progress");
  16. if (!video || !progressbar || !loadbar) {
  17. return;
  18. }
  19. video.addEventListener("timeupdate",function() {
  20. progressbar.style.transform = "scaleX("+(video.currentTime/video.duration)+")";
  21. });
  22. video.addEventListener("progress",function() {
  23. loadbar.style.transform = "scaleX("+(video.buffered.end(video.buffered.length-1)/video.duration)+")";
  24. });
  25. clearInterval(findVideoInterval);
  26. },500);