Small Business -> Small Capitalists

Substitute the term 'small business' (and variants) for 'small capitalist' in each page you visit. You'll laugh, and then you'll cry.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name Small Business -> Small Capitalists
// @description Substitute the term 'small business' (and variants) for 'small capitalist' in each page you visit. You'll laugh, and then you'll cry.
// @author Alberta Advantage Podcast
// @version 4
// @namespace aapod_small_business
// @match http*://*/*
// @grant none
// ==/UserScript==

console.log("Running Business -> Capitalist Substitution")

function substitute () {
    let elements = document.querySelectorAll('*')
    for (let i = 0; i < elements.length; i++) {

        let element = elements[i]

        for (let j = 0; j < element.childNodes.length; j++) {

            let childNode = element.childNodes[j]
            if (childNode.nodeName !== '#text') {
                continue
            }

            // NB: Need to substitute the plural form first, or we'll replace the singular form inside plural forms
            childNode.textContent = childNode.textContent.replace(/Small[ -]Businesses/g, "Small Capitalists")
            childNode.textContent = childNode.textContent.replace(/small[ -]Businesses/g, "small Capitalists")
            childNode.textContent = childNode.textContent.replace(/Small[ -]businesses/g, "Small capitalists")
            childNode.textContent = childNode.textContent.replace(/small[ -]businesses/g, "small capitalists")
            childNode.textContent = childNode.textContent.replace(/Small[ -]Business/g, "Small Capitalist")
            childNode.textContent = childNode.textContent.replace(/small[ -]Business/g, "small Capitalist")
            childNode.textContent = childNode.textContent.replace(/Small[ -]business/g, "Small capitalist")
            childNode.textContent = childNode.textContent.replace(/small[ -]business/g, "small capitalist")

        }

    }

}

if (document.readyState === "complete" || document.readyState === "loaded" || document.readyState === "interactive") {
    substitute()
}
else {
    document.addEventListener('DOMContentLoaded', function () {
        // Substitute server-rendered small businesses on load
        substitute()
        // This is an imperfect attempt to catch dynamically loaded/rendered content. It won't work on every page!
        window.setTimeout(substitute, 500) // 500ms delay
    })
}