BreezyWiki Home Button

Add a home button to the header of a BreezeWiki page that redirects back to the home of the wiki

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         BreezyWiki Home Button
// @namespace    https://www.breezewiki.com
// @version      1.0
// @description  Add a home button to the header of a BreezeWiki page that redirects back to the home of the wiki
// @author       networkMe
// @match        https://*.breezewiki.com/*
// @icon         https://breezewiki.com/static/breezewiki-favicon.svg
// @license      MIT
// @run-at       document-start
// ==/UserScript==

const observer = new MutationObserver((mutations, me) => {
    const target = document.querySelector('h1.page-title');

    if (target) {
        // Get homepage url
        const url = window.location.href;
        const homeUrl = url.replace(/(\/wiki\/).*$/, "$1") + "Main_Page";

        // Create House SVG for link
        const newDiv = document.createElement('a');
        newDiv.className = 'my-injected-header';
        newDiv.href = homeUrl;
        newDiv.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="30" height="30">' +
            '<!--!Font Awesome Free v7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.-->' +
            '<path fill="var(--theme-page-text-color, #000)" d="M277.8 8.6c-12.3-11.4-31.3-11.4-43.5 0l-224 208c-9.6 9-12.8 22.9-8 35.1S18.8 272 32 272l16 0 0 176c0' +
            ' 35.3 28.7 64 64 64l288 0c35.3 0 64-28.7 64-64l0-176 16 0c13.2 0 25-8.1 29.8-20.3s1.6-26.2-8-35.1l-224-208zM240 320l32 0c26.5 0 48 21.5 48 48l0 96-128 0 0-96c0-26.5 21.5-48 48-48z"/></svg>';
        newDiv.style.padding = '10px';

        // Insert it into the header
        target.prepend(newDiv);

        me.disconnect();
        console.log("Injected header into BreezeWiki.");
    }
});

// We start observing the documentElement because the body doesn't exist yet
observer.observe(document.documentElement, {
    childList: true,
    subtree: true
});