Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/intercept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import * as Github from './sites/github';
import * as LinkedIn from './sites/linkedin';
import * as Instagram from './sites/instagram';
import * as YouTube from './sites/youtube';
import * as Substack from './sites/substack';
import { createStore, Store } from './store';

const store = createStore();
Expand All @@ -31,6 +32,8 @@ export function eradicate(store: Store) {
Github.eradicate(store);
} else if (LinkedIn.checkSite()) {
LinkedIn.eradicate(store);
} else if (Substack.checkSite()) {
Substack.eradicate(store)
} else if (YouTube.checkSite()) {
YouTube.eradicate(store);
} else if (Instagram.checkSite()) {
Expand Down
10 changes: 7 additions & 3 deletions src/manifest-chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
"name": "News Feed Eradicator",
"version": "2.3.1",
"description": "Eradicate social media noise by replacing your entire news feed with an inspiring quote",
"manifest_version": 3,
"permissions": ["storage", "scripting"],
"manifest_version": 4,
"permissions": [
"storage",
"scripting"
],
"optional_host_permissions": [
"http://www.facebook.com/*",
"https://www.facebook.com/*",
Expand All @@ -24,7 +27,8 @@
"https://www.github.com/*",
"https://github.com/*",
"http://www.instagram.com/*",
"https://www.instagram.com/*"
"https://www.instagram.com/*",
"https://substack.com/*"
],
"action": {
"default_icon": {
Expand Down
7 changes: 5 additions & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"version": "2.2.7",
"description": "Eradicate social media noise by replacing your entire news feed with an inspiring quote",
"manifest_version": 2,
"permissions": ["storage"],
"permissions": [
"storage"
],
"optional_permissions": [
"http://www.facebook.com/*",
"https://www.facebook.com/*",
Expand All @@ -24,7 +26,8 @@
"https://www.github.com/*",
"https://github.com/*",
"http://www.instagram.com/*",
"https://www.instagram.com/*"
"https://www.instagram.com/*",
"https://substack.com/*"
],
"browser_action": {
"default_icon": {
Expand Down
9 changes: 8 additions & 1 deletion src/sites/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export type SiteId =
| 'linkedin'
| 'youtube'
| 'instagram'
| 'github';
| 'github'
| 'substack';

export const Sites: Record<SiteId, Site> = {
facebook: {
Expand Down Expand Up @@ -97,6 +98,12 @@ export const Sites: Record<SiteId, Site> = {
origins: ['https://github.com/*'],
css: githubCss,
},
substack: {
label: 'Substack',
domain: ['substack.com'],
paths: ['/', '/home'],
origins: ['https://substack.com/*'],
},
};

export type Site = {
Expand Down
2 changes: 1 addition & 1 deletion src/sites/instagram.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import injectUI, { isAlreadyInjected } from '../lib/inject-ui';
import { isEnabled } from '../lib/is-enabled';
import { Store } from '../store';
import {injectCSS} from "./shared";
import { injectCSS } from "./shared";

export function checkSite(): boolean {
return window.location.host.includes('instagram.com');
Expand Down
5 changes: 5 additions & 0 deletions src/sites/substack.str.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* Substack */
html:not([data-nfe-enabled='false']) div[aria-label='Notes feed'] div[class*="feedItem"] {
opacity: 0 !important;
pointer-events: none !important;
}
33 changes: 33 additions & 0 deletions src/sites/substack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import injectUI, { isAlreadyInjected } from '../lib/inject-ui';
import { isEnabled } from '../lib/is-enabled';
import { Store } from '../store';
import { injectCSS } from "./shared";

export function checkSite(): boolean {
return window.location.host.includes('substack.com');
}

export function eradicate(store: Store) {
function eradicateRetry() {
injectCSS('substack');

const settings = store.getState().settings;
if (settings == null || !isEnabled(settings)) {
return;
}

const container = document.querySelector('div[aria-label="Notes feed"]');
if (container == null) {
return;
}

// Add News Feed Eradicator quote/info panel
if (container && !isAlreadyInjected()) {
injectUI(container, store, { asFirstChild: true });
}
}

// This delay ensures that the elements have been created by Linkedin's
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stale comment

// scripts before we attempt to replace them
setInterval(eradicateRetry, 1000);
}