No Grok Button

Removes the Grok button on Twitter (or X for weirdos)

  1. // ==UserScript==
  2. // @name No Grok Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 2023-12-09
  5. // @description Removes the Grok button on Twitter (or X for weirdos)
  6. // @author You
  7. // @match https://twitter.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
  9. // @grant none
  10. // @run-at document-start
  11. // @require https://code.jquery.com/jquery-3.6.0.min.js
  12. // @license MIT
  13. // ==/UserScript==
  14. function ifElementExistsThen(selector, callback) {
  15. var checker = setInterval(function() {
  16. if ($(selector).length) {
  17. clearInterval(checker);
  18. callback();
  19. }
  20. }, 50);
  21. }
  22. (function() {
  23. 'use strict';
  24. const iconSelector = '[aria-label="Grok"]';
  25. ifElementExistsThen(iconSelector, () => {
  26. document.querySelectorAll(iconSelector)[0].parentElement.removeChild(document.querySelectorAll(iconSelector)[0]);
  27. });
  28. })();