Remove 'Open app' bar

7/11/2025, 11:02:20 AM

当前为 2025-07-26 提交的版本,查看 最新版本

// ==UserScript==
// @name        Remove 'Open app' bar
// @namespace   Violentmonkey Scripts
// @match       *://*.facebook.com/*
// @grant       none
// @version     1.1
// @author      -
// @description 7/11/2025, 11:02:20 AM
// @license MIT
// ==/UserScript==

(function () {
    "use strict";

    function removeRobotoV2() {
        const elements = document.querySelectorAll('.native-text');
        elements.forEach(el => {
            el.style.fontFamily = el.style.fontFamily
                .split(',')
                .filter(f => f.trim() !== 'Roboto-V2')
                .join(', ');
        });
    }
    function zap() {
        document.querySelector('#screen-root > div > div.m.fixed-container.bottom')?.remove();
    }

    function fixAll() {
        removeRobotoV2();
        zap();
    }
    fixAll();

    const observer = new MutationObserver(() => fixAll());
    observer.observe(document.documentElement, {
        childList: true,
        subtree: true,
    });

    ['pushState', 'replaceState'].forEach(fn => {
        const orig = history[fn];
        history[fn] = function (...args) {
            const ret = orig.apply(this, args);
            Promise.resolve().then(fixAll);
            return ret;
        };
    });

})();