Youtube Mobile Seekable

Put a good description in here

  1. // ==UserScript==
  2. // @name Youtube Mobile Seekable
  3. // @author erogemaster225
  4. // @namespace http://www.example.url/to/your-web-site/
  5. // @description Put a good description in here
  6. // @license Creative Commons Attribution License
  7. // @version 0.2
  8. // @include http*://m.youtube.com/*
  9. // @grant none
  10. // @run-at document-start
  11. // @released 2006-04-17
  12. // @updated 2006-04-19
  13. // @compatible Greasemonkey
  14. // ==/UserScript==
  15.  
  16. setInterval(function() {
  17. if (location.href.indexOf('/watch') != -1) {
  18. let progressBar = document.querySelector('.ytm-progress-bar')
  19. let player = document.querySelector('video.html5-main-video')
  20. if (!progressBar.getAttribute('tagged') && player.getAttribute('src')) {
  21. progressBar.addEventListener('click', function(event) {
  22. let boundingRect = progressBar.getBoundingClientRect();
  23. let clickPosition = event.clientX - boundingRect.left;
  24. let progressBarWidth = boundingRect.width;
  25. let percentage = (clickPosition / progressBarWidth);
  26. player.currentTime = Math.floor(percentage * player.duration);
  27. });
  28. progressBar.setAttribute('tagged', 'true');
  29. console.log('tagged');
  30. }
  31. }
  32. }, 2000);