Youtube Card Annotations Disable

Assign an extra option to the default annotations button to toggle the new youtube cards

  1. // ==UserScript==
  2. // @name Youtube Card Annotations Disable
  3. // @description Assign an extra option to the default annotations button to toggle the new youtube cards
  4. // @namespace q1k
  5. // @version 1.0
  6. // @match *://www.youtube.com/*
  7. // @exclude *://www.youtube.com/live_chat*
  8. // @exclude *://www.youtube.com/tv*
  9. // @grant none
  10. // @require https://code.jquery.com/jquery-3.1.0.slim.js
  11. // ==/UserScript==
  12.  
  13. var checkExist = setInterval(function() {
  14. if ( $('.playing-mode').length ) {
  15. $('.ytp-settings-button').click();
  16. $('.ytp-settings-button').click();
  17. $('<style> .ytp-ce-element { display: none; } </style>').appendTo(document.head);
  18. $('.ytp-menuitem').click(function() {
  19. if ($(this).text().trim() === "Annotations") {
  20. if ($(this).attr('aria-checked') == 'true') {
  21. $('.ytp-ce-element').css('display', 'block');
  22. } else {
  23. $('.ytp-ce-element').css('display', 'none');
  24. }
  25. }
  26. });
  27. clearInterval(checkExist);
  28. }
  29. }, 1000);