Shorts auto scroll

Sit back and relax. YT Shorts will automaticaly scroll when finished

  1. // ==UserScript==
  2. // @name Shorts auto scroll
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-06-14
  5. // @description Sit back and relax. YT Shorts will automaticaly scroll when finished
  6. // @author vincent bruneau
  7. // @match https://www.youtube.com/*
  8. // @match http://youtube.com/*
  9. // @match http*://*.youtube.com/*
  10. // @match *://*youtu.be/*
  11. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  12. // @grant none
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18. var t,conf,cs;
  19.  
  20.  
  21. const mo = new MutationObserver((mo)=>{
  22.  
  23. mo.forEach((m)=>{
  24. if(m.type === "attributes" && m.attributeName === "aria-valuenow") {
  25. let I = parseInt(m.oldValue);
  26. if(I === 99) {
  27. document.querySelector('#navigation-button-down button').click();
  28. window.setTimeout( ()=> _u(), 2200 );
  29. }
  30. }
  31. });
  32.  
  33. });
  34.  
  35. const mo2 = new MutationObserver((mo)=>{
  36. mo.forEach((m)=>{
  37. if(m.type === "attributes" && m.attributeName === "is-active") {
  38. mo.disconnect();
  39. window.setTimeout( ()=> _u(), 2200 );
  40. }
  41. });
  42. });
  43.  
  44. function _a() {
  45. cs = document.getElementById("#shorts-inner-container");
  46.  
  47. if(cs != null) {
  48. mo2.observe(cs, {
  49. childList: true,
  50. subtree: true,
  51. });
  52. }
  53. else {
  54. window.setTimeout( ()=> _u(), 2200 );
  55. }
  56. }
  57.  
  58. function _u() {
  59. t = document.querySelector("#short-video-container .PlayerControlsProgressBarHost");
  60. console.log(t);
  61.  
  62. if(t != null) {
  63. mo.observe(t, {
  64. attributeOldValue: true,
  65. subtree: true,
  66. });
  67. }
  68. else {
  69. window.setTimeout( ()=> _u(), 2200 );
  70. }
  71. }
  72.  
  73. _u();
  74. })();