th3an0maly / Fifa 18 Punters' Board

// ==UserScript==
// @name         Fifa 18 Punters' Board
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Fifa scoreboard for Ade
// @author       You
// @match        https://www.google.ie/search?q=fifa+world+cut+2018+scoreboard*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    let PUNTERS = {
        france: ['Ade'],
        portugal: ['Lorenzo'],
        iran: ['Kannan', 'God'],
    }

    GM_addStyle(`
        .str-tnwl.punter
        {
            color: #5a46ff;
            font-style: italic;
            padding-right: 30%;
            float: right;
        }`);

    let waitTillLoad = setInterval(function() {
    if (document.querySelectorAll('.str-tnwl').length) {
        clearInterval(waitTillLoad);

        // The actual stuff
        document.querySelectorAll('.str-tnwl').forEach(country => {
            let punters = (PUNTERS[country.innerText.toLowerCase()] || []).join(', ')
            country.parentElement.innerHTML += `<span class="str-tnwl punter">${punters}</span>`
        })
    }
    }, 100); // check every 100ms
})();