nharward / Remove Github Join Message

// ==UserScript==
// @name Remove Github Join Message
// @namespace https://openuserjs.org/meta/nharward/github
// @description Hides the real estate stealing "Join Github today" message when not logged into Github
// @author Nathaniel Harward
// @match https://github.com/*
// @match https://*.github.com/*
// @copyright 2019, Nathaniel Harward
// @license MIT; https://opensource.org/licenses/MIT
// @version 1.2.0
// ==/UserScript==
// ==OpenUserJS==
// @author nharward
// ==/OpenUserJS==

var handleNode = function (node) {
  if (node && node.classList && node.classList.contains('signup-prompt')) {
    node.style.display = 'none';
  }
  if (node && node.hasChildNodes()) {
    node.childNodes.forEach(handleNode);
  }
};

var mutationCallback = function (mutationsList, observer) {
  mutationsList.forEach((mutationRecord) => {
    if (mutationRecord.addedNodes) {
      mutationRecord.addedNodes.forEach(handleNode);
    }
  });
}

new MutationObserver(mutationCallback).observe(document.body, {
  childList: true,
  subtree: true
});

var containers = document.querySelectorAll("div.signup-prompt");
containers.forEach(handleNode);