Elamigos - Open all games

Add a button at the right of the dates to open all games added for this day [IMPORTANT] In your browser, you must allow the website Elamigos to open pop-ups

// ==UserScript==
// @name         Elamigos - Open all games
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Add a button at the right of the dates to open all games added for this day [IMPORTANT] In your browser, you must allow the website Elamigos to open pop-ups
// @author       Drigtime
// @match        https://elamigos.site/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=elamigos.site
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // CSS for the button
    const buttonStyles = `
        .button {
            background-color: #333333;
            color: white;
            padding: 5px 10px;
            margin-left: 5px;
            border: none;
            border-radius: 5px;
            font-family: 'Roboto', sans-serif;
            font-size: 100%;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            cursor: pointer;
            transition: background-color 0.3s, color 0.3s;
        }

        .button:hover {
            background-color: orange;
            color: white;
        }
    `;

    // Create a style element and append it to the head
    const styleElement = document.createElement('style');
    styleElement.type = 'text/css';
    styleElement.appendChild(document.createTextNode(buttonStyles));
    document.head.appendChild(styleElement);

    // Rest of your script
    const h1s = document.querySelectorAll('h1');

    for (const h1 of h1s) {
        const h3s = [];
        let next = h1.nextSibling;

        while (next) {
            if (next.nodeName === 'H3') {
                h3s.push(next.querySelector('a').href);
            } else if (next.nodeName === 'HR' || next.nodeName === 'BR') {
                break;
            }
            next = next.nextSibling;
        }

        const openLinksButton = document.createElement('button');
        openLinksButton.innerText = 'Open all links';
        openLinksButton.className = 'button'; // Add the 'button' class to apply styles
        openLinksButton.addEventListener('click', () => {
            h3s.forEach(link => window.open(link, '_blank'));
        });
        h1.appendChild(openLinksButton);
    }
})();