YouTube: disable rolling numbers count up animation

Remove the annoying count up animation for likes and video views on YouTube

  1. // ==UserScript==
  2. // @name YouTube: disable rolling numbers count up animation
  3. // @description Remove the annoying count up animation for likes and video views on YouTube
  4. // @author Konf
  5. // @namespace https://greasyfork.org/users/424058
  6. // @icon https://www.google.com/s2/favicons?sz=64&domain=www.youtube.com
  7. // @version 2.0.0
  8. // @match https://www.youtube.com/*
  9. // @compatible Chrome
  10. // @compatible Opera
  11. // @compatible Firefox
  12. // @run-at document-idle
  13. // @grant unsafeWindow
  14. // @noframes
  15. // ==/UserScript==
  16.  
  17. /**
  18. * Hi! Don't change (or even resave) anything here because
  19. * by doing this in Tampermonkey you will turn off updates
  20. * of the script (idk about other script managers).
  21. * This could be restored in settings but it might be hard to find,
  22. * so better to reinstall the script if you're not sure
  23. */
  24.  
  25. /* jshint esversion: 8 */
  26.  
  27. (function() {
  28. 'use strict';
  29.  
  30. setTimeout(() => {
  31. const AnimationCopy = unsafeWindow.Animation;
  32.  
  33. unsafeWindow.Animation = function(effect, timeline, ...otherArgs) {
  34. if (effect.target.localName === 'animated-rolling-character') {
  35. effect.activeDuration = 0;
  36. effect.timing._duration = 0;
  37. effect._timingInput.duration = 0;
  38. }
  39.  
  40. return new AnimationCopy(effect, timeline, ...otherArgs);
  41. };
  42. }, 3000);
  43. })();