diff --git a/src/eradicate.css b/src/eradicate.css index af6537a..bed7d73 100644 --- a/src/eradicate.css +++ b/src/eradicate.css @@ -206,6 +206,21 @@ html:not([data-nfe-enabled='false']) { --notification-badge: var(--base-blue); } +/* Facebook Mobile */ +html:not([data-nfe-enabled='false']) #rootcontainer #root { + position: absolute !important; + opacity: 0 !important; + pointer-events: none !important; + width: 0 !important; + height: 0 !important; +} +html:not([data-nfe-enabled='false']) #rootcontainer #nfe-container { + margin: 15px; +} +[data-sigil='messenger_icon'] > span[data-sigil='count'] { + background-color: #3b5998 !important; /* Use blue instead of red for notification badges */ +} + /* Twitter */ html:not([data-nfe-enabled='false']) div[data-testid="primaryColumn"] > div:last-child > div:nth-child(4) > #nfe-container { padding: 16px; diff --git a/src/intercept.ts b/src/intercept.ts index 628093f..a1f148a 100644 --- a/src/intercept.ts +++ b/src/intercept.ts @@ -7,6 +7,7 @@ import './eradicate.css'; import { setupRouteChange } from './lib/route-change'; import * as FbClassic from './sites/fb-classic'; +import * as FbMobile from './sites/fb-mobile'; import * as Fb2020 from './sites/fb-2020'; import * as Twitter from './sites/twitter'; import * as Reddit from './sites/reddit'; @@ -37,9 +38,11 @@ export function eradicate(store: Store) { Instagram.eradicate(store); } else if (FbClassic.checkSite()) { FbClassic.eradicate(store); - } else { + } else if (FbMobile.checkSite()) { + FbMobile.eradicate(store); + } else { Fb2020.eradicate(store); - } + } } setupRouteChange(store); diff --git a/src/manifest.json b/src/manifest.json index 97f1926..19de58d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -11,6 +11,8 @@ "https://www.facebook.com/*", "http://web.facebook.com/*", "https://web.facebook.com/*", + "http://m.facebook.com/*", + "https://m.facebook.com/*", "http://twitter.com/*", "https://twitter.com/*", "https://www.reddit.com/", diff --git a/src/sites/fb-mobile.ts b/src/sites/fb-mobile.ts new file mode 100644 index 0000000..e248bb1 --- /dev/null +++ b/src/sites/fb-mobile.ts @@ -0,0 +1,32 @@ +import injectUI, { isAlreadyInjected } from '../lib/inject-ui'; +import { isEnabled } from '../lib/is-enabled'; +import { Store } from '../store'; + +export function checkSite(): boolean { + return window.location.host.includes('m.facebook.com'); +} + +export function eradicate(store: Store) { + function eradicateRetry() { + const settings = store.getState().settings; + if (settings == null || !isEnabled(settings)) { + return; + } + + // Don't do anything if the FB UI hasn't loaded yet + const container = document.querySelector('#rootcontainer'); + + if (container == null) { + return; + } + + // Add News Feed Eradicator quote/info panel + if (container && !isAlreadyInjected()) { + injectUI(container, store); + } + } + + // This delay ensures that the elements have been created by Facebook's + // scripts before we attempt to replace them + setInterval(eradicateRetry, 1000); +} diff --git a/src/sites/index.ts b/src/sites/index.ts index 9405b9d..672f3bd 100644 --- a/src/sites/index.ts +++ b/src/sites/index.ts @@ -8,6 +8,7 @@ export const Sites: Record = { '/', '/home.php', '/watch', + '/watch/', '/marketplace/', '/groups/feed/', '/gaming/feed/', @@ -17,6 +18,8 @@ export const Sites: Record = { 'https://www.facebook.com/*', 'http://web.facebook.com/*', 'https://web.facebook.com/*', + 'http://m.facebook.com/*', + 'https://m.facebook.com/*', ], }, instagram: {