Remove Share Buttons

Remove useless "trainer wheels" tracking buttons.

  1. // ==UserScript==
  2. // @name Remove Share Buttons
  3. // @namespace i2p.schimon.remove-share-buttons
  4. // @description Remove useless "trainer wheels" tracking buttons.
  5. // @homepageURL https://openuserjs.org/scripts/sjehuda/Remove_Share_Buttons
  6. // @supportURL https://openuserjs.org/scripts/sjehuda/Remove_Share_Buttons/issues
  7. // @copyright 2024, Schimon Jehudah (http://schimon.i2p)
  8. // @license MIT; https://opensource.org/licenses/MIT
  9. // @grant none
  10. // @run-at document-end
  11. // @match file:///*
  12. // @match *://*/*
  13. // @version 24.01.23
  14. // @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48dGV4dCB5PSIuOWVtIiBmb250LXNpemU9IjkwIj7wn6qk77iPPC90ZXh0Pjwvc3ZnPgo=
  15. // ==/UserScript==
  16.  
  17. var cssSelectors;
  18.  
  19. cssSelectors = [
  20. '/submit?url=',
  21. '/sharer.php?u=',
  22. '/intent/tweet?text=',
  23. '/pin/create/button/?url=',
  24. '://send?text=',
  25. '/pin/create/button?url=',
  26. '/sharing/share-offsite/?url=',
  27. '/mail/?view=',
  28. '/sharer/sharer.php?u=',
  29. '/share?url=',
  30. 'app.com/send?text=',
  31. 'gab.com/compose?url=',
  32. 'n.com/shareArticle?',
  33. 'r.com/share',
  34. 'x.com/share',
  35. 'wp.me/',
  36. ];
  37.  
  38. for (const cssSelector of cssSelectors) {
  39. let links = document.querySelectorAll('a[href*="' + cssSelector + '"]');
  40. for (const link of links) {
  41. link.remove();
  42. }
  43. }
  44.  
  45. cssSelectors = [
  46. '/plugins/like.php?href=',
  47. ];
  48.  
  49. for (const cssSelector of cssSelectors) {
  50. let links = document.querySelectorAll('iframe[src*="' + cssSelector + '"]');
  51. for (const link of links) {
  52. link.remove();
  53. }
  54. }
  55.  
  56. switch (location.hostname) {
  57. case "creation.com":
  58. cssSelectors = ".share-bar";
  59. break;
  60. case "notthebee.com":
  61. cssSelectors = ".article-shareables";
  62. break;
  63. }
  64.  
  65. document.querySelector(cssSelectors).remove();