Greasy Fork is available in English.

YouTube Shorts Auto-Advance

Automatically advances to the next video short when the current one ends (optional fullscreen mode)

  1. // ==UserScript==
  2. // @name YouTube Shorts Auto-Advance
  3. // @namespace https://greasyfork.org/en/users/10118-drhouse
  4. // @version 2.1
  5. // @description Automatically advances to the next video short when the current one ends (optional fullscreen mode)
  6. // @include https://www.youtube.com/shorts/*
  7. // @require http://code.jquery.com/jquery-3.4.1.min.js
  8. // @require https://greasyfork.org/scripts/439099-monkeyconfig-modern-reloaded/code/MonkeyConfig%20Modern%20Reloaded.js?version=1012538
  9. // @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
  10. // @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
  11. // @author drhouse
  12. // @grant GM_getValue
  13. // @grant GM_setValue
  14. // @grant GM_deleteValue
  15. // @grant GM_addStyle
  16. // @grant GM_registerMenuCommand
  17. // @grant GM_notification
  18. // @license CC-BY-NC-SA-4.0
  19. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  20. // ==/UserScript==
  21. this.$ = this.jQuery = jQuery.noConflict(true);
  22.  
  23. (function($){
  24.  
  25. (window.addEventListener("yt-navigate-finish", function(event) {
  26.  
  27. var cfg = new MonkeyConfig({
  28. title: 'Configure',
  29. menuCommand: true,
  30. params: {
  31. 'Automatic Fullscreen': {
  32. type: 'checkbox',
  33. default: false
  34. },
  35. },
  36. })
  37.  
  38. function openFullscreen(elem) {
  39. if (elem.requestFullscreen) {
  40. elem.requestFullscreen();
  41. } else if (elem.mozRequestFullScreen) { /* Firefox */
  42. elem.mozRequestFullScreen();
  43. } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
  44. elem.webkitRequestFullscreen();
  45. } else if (elem.msRequestFullscreen) { /* IE / Edge */
  46. elem.msRequestFullscreen();
  47. }
  48. }
  49.  
  50. setTimeout(function(){
  51. if (cfg.get('Automatic Fullscreen')) {
  52. // var elem = $('.html5-main-video').get(0);
  53. var elem = $('.html5-main-video').parent().parent().parent().parent().parent().parent().parent().parent().get(0);
  54. openFullscreen(elem);
  55. }
  56. $(".html5-main-video").removeAttr("loop");
  57. $(".html5-main-video").on('ended',function(){
  58. $('#navigation-button-down > ytd-button-renderer:nth-child(1)').get(0).click()
  59. });
  60. }, 1000);
  61.  
  62. }))
  63. })(jQuery);