Skip Ads by 10 Seconds

Skip video ads forward by 5 seconds using the right arrow key

  1. // ==UserScript==
  2. // @name Skip Ads by 10 Seconds
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.5
  5. // @description Skip video ads forward by 5 seconds using the right arrow key
  6. // @author Tommy Doan
  7. // @license MIT
  8. // @match *://*/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. document.addEventListener('keydown', function(e) {
  16. // Check if the pressed key is the right arrow key (keyCode 39)
  17. if (e.keyCode === 39) {
  18. // Get all video elements on the page
  19. let videos = document.querySelectorAll('video');
  20.  
  21. // Loop through all the videos
  22. videos.forEach(function(video) {
  23. // Skip forward by 10 seconds
  24. if (!video.paused && !video.ended) {
  25. video.currentTime += 10;
  26. }
  27. });
  28. }
  29. });
  30. })();