Sniffies Ultimate Ad & Layout Fixer

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

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

Advertisement:

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

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