Sniffies Ultimate Ad & Layout Fixer

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

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, Greasemonkey alebo Violentmonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey, % alebo Violentmonkey.

Na nainštalovanie skriptu si budete musieť nainštalovať rozšírenie, ako napríklad Tampermonkey alebo Userscripts.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie, ako napríklad Tampermonkey.

Na inštaláciu tohto skriptu je potrebné nainštalovať rozšírenie správcu používateľských skriptov.

(Už mám správcu používateľských skriptov, nechajte ma ho nainštalovať!)

Advertisement:

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie, ako napríklad Stylus.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

Na inštaláciu tohto štýlu je potrebné nainštalovať rozšírenie správcu používateľských štýlov.

(Už mám správcu používateľských štýlov, nechajte ma ho nainštalovať!)

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);
})();