Sniffies Ultimate Ad & Layout Fixer

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

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