Sniffies Ultimate Ad & Layout Fixer

Completely removes the left ad sidebar and stretches the interactive map to 100% width.

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!)

Advertisement:

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!)

Advertisement:

// ==UserScript==
// @name         Sniffies Ultimate Ad & Layout Fixer
// @namespace    http://tampermonkey.net
// @version      1.3
// @license MIT 
// @description  Completely removes the left ad sidebar and stretches the interactive map to 100% width.
// @author       dadoodler
// @match        https://*://*
// @match        https://sniffies.com*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // Inject global CSS overrides to force layout expansion and hide ads
    const style = document.createElement('style');
    style.innerHTML = `
        /* 1. Eliminate the left ad container and its wrapper completely */
        div[class*="Promo"],
        div[class*="Card"] a[href*="plus"],
        aside:has(a[href*="plus"]),
        div:has(> a[href*="plus"]) {
            display: none !important;
            width: 0px !important;
            max-width: 0px !important;
        }

        /* 2. Fix the main layout wrapper (often a flex container or grid pushing the map) */
        main,
        div[id="root"] > div,
        div[class*="Layout"],
        div[class*="AppContainer"] {
            display: block !important;
            padding-left: 0 !important;
            margin-left: 0 !important;
        }

        /* 3. Force the Mapbox/Leaflet canvas container to span from the exact left edge */
        #map,
        .map-container,
        div[class*="MapWrapper"],
        div[class*="MapContainer"],
        .mapboxgl-map,
        .mapboxgl-canvas {
            position: absolute !important;
            left: 0px !important;
            top: 0px !important;
            width: 100vw !important;
            height: 100vh !important;
            margin: 0 !important;
            padding: 0 !important;
        }
    `;
    document.head.appendChild(style);

    // Continuous element cleaner and map window resizing trigger
    const cleanAndResize = () => {
        let itemsRemoved = false;

        // Find elements containing the "plus" promo text or link destination
        const elements = document.querySelectorAll('a[href*="/plus"], div[class*="Promo"]');
        elements.forEach(el => {
            // Find the highest independent parent box that isn't the whole page
            const container = el.closest('aside') || el.closest('div[class*="Container"]') || el;
            if (container && container.getBoundingClientRect().left < 150) {
                container.remove();
                itemsRemoved = true;
            }
        });

        // Trigger a simulated window resize so the map script expands its tile boundaries
        if (itemsRemoved || document.querySelector('.mapboxgl-map')) {
            window.dispatchEvent(new Event('resize'));
        }
    };

    // Run heavily during initial page construction
    const observer = new MutationObserver(cleanAndResize);
    observer.observe(document.documentElement, { childList: true, subtree: true });

    // Periodic insurance backup loop to handle late map tile loading cycles
    setInterval(cleanAndResize, 1000);
})();