thomper / Dismiss Github login ad

// ==UserScript==
// @name         Dismiss Github login ad
// @namespace    http://ontbee.com/gmscripts
// @description  Automatically dismiss the ad that shows when you're not signed in.
// @author       thomper
// @copyright    2020, thomper (https://openuserjs.org/users/thomper)
// @license      MIT
// @version      1.0
// @include      https://github.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const buttons = [...document.getElementsByTagName('button')];
    if (buttons) {
        const dismissButtons = buttons.filter(x => x.innerHTML.includes("Dismiss"));
        if (dismissButtons && dismissButtons.length >= 1) {
            const dismissButton = dismissButtons[0];
            console.log("Greasemonkey script will now attempt to dismiss the login ad.");
            dismissButton.click();
        }
    }
})();