Skip to content

Commit

Permalink
Adjust code to changes of the SA website
Browse files Browse the repository at this point in the history
  • Loading branch information
krisztianb committed Oct 1, 2024
1 parent 84f85d1 commit 4ced98a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Seeking Alpha Paywall Remover",
"version": "1.8",
"version": "1.9",
"description": "Removes the paywall from news and article pages on the seekingalpha.com website",
"icons": {
"48": "icons/48x48.png",
Expand Down
19 changes: 13 additions & 6 deletions paywall-remover.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let fullArticleLoadedCheck = setInterval(() => {
const hasFullArticleLoaded = document.querySelector("p.paywall-full-content") != null;

if (hasFullArticleLoaded) {
removePayWallFlags();
removePayWallMarkersFromPage();
storeContent();
preparePayWallRemover();
clearInterval(fullArticleLoadedCheck);
Expand Down Expand Up @@ -50,7 +50,7 @@ function preparePayWallRemover() {
// Code that keeps removing interactivity locks from the page
setInterval(() => {
removeInteractivityLock();
}, 1000);
}, 2500);

function hidePayWall() {
const payWallDialog = document.querySelector(matchingPayWallSelector);
Expand All @@ -66,7 +66,11 @@ function hidePayWall() {

function removeBodyScrollLock() {
const body = document.body;
body.classList.remove("lockScroll");

["lockScroll", "scrollLock"].forEach((className) => {
body.classList.remove(className);
});

body.removeAttribute("style"); // there is an additional "overflow:hidden" to remove
}

Expand All @@ -77,9 +81,12 @@ function removeInteractivityLock() {
});
}

function removePayWallFlags() {
document.querySelectorAll(".paywall-full-content").forEach((item) => {
item.classList.remove("paywall-full-content");
function removePayWallMarkersFromPage() {
// This is necessary because otherwise a script on the page will keep removing the marked content once we restore it
["paywall-full-content", "invisible"].forEach((className) => {
document.querySelectorAll("." + className).forEach((item) => {
item.classList.remove(className);
});
});
}

Expand Down

0 comments on commit 4ced98a

Please sign in to comment.