Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 1ce0785

Browse files
committed
Make extension remove ads from the page
1 parent b73d7e3 commit 1ce0785

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,11 @@ The extension only operates on pages similar to the following:
1212
### Installation
1313

1414
Currently only available for Firefox: https://addons.mozilla.org/en-US/firefox/addon/seeking-alpha-paywall-remover/
15+
16+
### Troubleshooting
17+
18+
If the extension doesn't seem to work for you please try the following before opening an [issue ticket](https://github.com/krisztianb/seekingalpha-paywall-remover/issues):
19+
20+
* Make sure you have the latest version of the extension installed (you can use the URL `about:addons` in Firefox)
21+
* Delete all seekingalpha.com cookies in your browser (key combination Ctrl + Alt + Del)
22+
* Reload the page while holding down the SHIFT button (= reload ignoring cached content)

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Seeking Alpha Paywall Remover",
4-
"version": "1.5",
4+
"version": "1.6",
55
"description": "Removes the paywall from news and article pages on the seekingalpha.com website",
66
"icons": {
77
"48": "icons/48x48.png",

paywall-remover.js

+10
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ const payWallSelectors = [
1313
const overlaySelector = "div.bg-black\\/30"; // this is the element creating the gray semi-transparent overlay effect
1414
const contentWrapperSelector = ".contents";
1515
const articleSelector = "main article section";
16+
const adSelector = "main + div"; // might contain "special offer" ads
1617

1718
// Store the original non-pay-walled content
1819
const content = document.querySelector(articleSelector).innerHTML;
1920

21+
removeAds();
22+
2023
// Code executed once the paywall is shown
2124
new window.MutationObserver(function (mutations) {
2225
for (const mutation of mutations) {
@@ -73,3 +76,10 @@ function removeInteractivityLock() {
7376
function restoreContent() {
7477
document.querySelector(articleSelector).innerHTML = content;
7578
}
79+
80+
function removeAds() {
81+
const ad = document.querySelector(adSelector);
82+
if (ad) {
83+
ad.remove();
84+
}
85+
}

0 commit comments

Comments
 (0)