Disable Youtube Annotations

Automatically disable annotations on youtube every second. Annotations may still be manually enabled, but that only lasts for that tab/ until page reload.

  1. // ==UserScript==
  2. // @name Disable Youtube Annotations
  3. // @version 1
  4. // @match https://www.youtube.com/*
  5. // @description Automatically disable annotations on youtube every second. Annotations may still be manually enabled, but that only lasts for that tab/ until page reload.
  6. // @namespace https://gf.qytechs.cn/users/396494
  7. // ==/UserScript==
  8.  
  9. var settingsButton
  10. var annotations
  11. var disableAnnotations
  12. var syntheticClick
  13.  
  14. setInterval(() => {
  15. if (settingsButton) {
  16. return
  17. }
  18. settingsButton = document.getElementsByClassName('ytp-settings-button')[0]
  19. if (!settingsButton) {
  20. return
  21. }
  22. settingsButton.click()
  23. settingsButton.click()
  24.  
  25. annotations = document.getElementsByClassName('ytp-menuitem')[1]
  26. disableAnnotations = true
  27. syntheticClick = false
  28.  
  29. annotations.onclick = () => {
  30. if (syntheticClick) {
  31. syntheticClick = false
  32. return
  33. }
  34. disableAnnotations ^= true
  35. }
  36. }, 1000)
  37.  
  38. setInterval(() => {
  39. if (disableAnnotations && annotations.getAttribute('aria-checked') === 'true') {
  40. syntheticClick = true
  41. annotations.click()
  42. }
  43. }, 1000)

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址