Golang website without banner

Remove the banner of the golang website.

  1. // ==UserScript==
  2. // @name Golang website without banner
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Remove the banner of the golang website.
  6. // @author Unknown
  7. // @match *://*.golang.org/*
  8. // @match *://*.go.dev/*
  9. // @match *://*.godoc.org/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function removeWithClassName(className) {
  17. var elements = document.getElementsByClassName(className);
  18. while(elements.length > 0){
  19. elements[0].parentNode.removeChild(elements[0]);
  20. }
  21. return;
  22. }
  23.  
  24. if( /golang/.test(window.location.host) ){
  25. removeWithClassName("Header-banner");
  26. } else if(/go\.dev/.test(window.location.host)) {
  27. removeWithClassName("Banner");
  28. } else if(/godoc/.test(window.location.host)) {
  29. var elements = document.querySelectorAll('[class^=navbar-]');
  30. if (elements.length > 0){
  31. elements[0].parentNode.removeChild(elements[0]);
  32. }
  33. }
  34. })();