Facebook Mobile Home Blocker (Dashboard)

Replaces m.facebook.com homepage feed with a clean custom dashboard (Search, Messages, Notifications, Settings)

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

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

// ==UserScript==
// @name         Facebook Mobile Home Blocker (Dashboard)
// @version      3.0
// @description  Replaces m.facebook.com homepage feed with a clean custom dashboard (Search, Messages, Notifications, Settings)
// @author       You
// @match        https://m.facebook.com/
// @match        https://mobile.facebook.com/
// @grant        none
// @run-at       document-idle
// @namespace https://greasyfork.org/users/1524991
// ==/UserScript==

(function () {
  'use strict';

  const DASHBOARD_HTML = `
    <style>
      body {
        background: #ffffff;
        color: #333;
        font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100vh;
        margin: 0;
      }
      .fb-dashboard {
        text-align: center;
        padding: 20px;
      }
      .fb-dashboard h1 {
        font-size: 1.5em;
        margin-bottom: 1em;
      }
      .fb-dashboard a {
        display: inline-block;
        text-decoration: none;
        background: #1877f2;
        color: white;
        padding: 10px 18px;
        margin: 6px;
        border-radius: 8px;
        font-weight: 500;
      }
      .fb-dashboard a:hover {
        background: #145dbf;
      }
      .fb-dashboard input {
        width: 80%;
        max-width: 300px;
        padding: 10px;
        border-radius: 6px;
        border: 1px solid #ccc;
        font-size: 1em;
        margin-top: 20px;
      }
    </style>

    <div class="fb-dashboard">
      <h1>🧭 Facebook Quick Access</h1>
      <div>
        <a href="/messages/">💬 Messages</a>
        <a href="/notifications/">🔔 Notifications</a>
        <a href="/friends/">👥 Friends</a>
        <a href="/settings/">⚙️ Settings</a>
      </div>
      <input type="text" id="fbSearchBox" placeholder="Search Facebook..." />
    </div>
  `;

  function replaceHomepage() {
    document.documentElement.innerHTML = DASHBOARD_HTML;

    const input = document.getElementById('fbSearchBox');
    input?.addEventListener('keydown', (e) => {
      if (e.key === 'Enter' && input.value.trim()) {
        window.location.href = `/search/?q=${encodeURIComponent(input.value.trim())}`;
      }
    });
  }

  // Run only on homepage root
  if (location.pathname === '/' || location.pathname === '') {
    replaceHomepage();
  }
})();