Skip to content

Commit

Permalink
This makes hiding the feed work again after Linkedin updated their site.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelbauer committed Jun 8, 2023
1 parent a5df6b1 commit 818a3aa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
Empty file removed background.js
Empty file.
23 changes: 4 additions & 19 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,18 @@
const maxPing = 5;
const waitBetweenPings = 100; //in milliseconds

/**
* The reason why getElementsByClassName("artdeco-dropdown")[1] isn't using a variable name
* is because the variable will keep the reference of the variable. If you remove() on the variable,
* you will remove the reference. If you were to click into LinkedIn messaging, and then click back
* into the LinkedIn feed, the feed will reload back in and the blocker wouldn't work. I believe
* LinkedIn is a single page application.
*/

function hideFeed() {

if (document.getElementsByClassName("artdeco-dropdown") && document.getElementsByClassName("artdeco-dropdown")[1]) {
if (document.getElementsByClassName("artdeco-dropdown")[1].nextElementSibling) {
document.getElementsByClassName("artdeco-dropdown")[1].nextElementSibling.classList.add("displayNone");
}
if (window.location.href.endsWith("feed/")) {
document.getElementsByTagName("main")[0].style.display = "none";
}
}

function addFeed() {

if (document.getElementsByClassName("artdeco-dropdown") && document.getElementsByClassName("artdeco-dropdown")[1]) {
if (document.getElementsByClassName("artdeco-dropdown")[1].nextElementSibling) {
document.getElementsByClassName("artdeco-dropdown")[1].nextElementSibling.classList.remove("displayNone");
}
if (window.location.href.endsWith("feed/")) {
document.getElementsByTagName("main")[0].style.display = null;
}
}


/**
* For some odd reason, the news seem to load much slower than the feed. Therefore, multiple attempts
* on removing the news is necessary.
Expand Down
9 changes: 3 additions & 6 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"manifest_version": 2,
"manifest_version": 3,
"name": "Feed Blocker for LinkedIn",
"version": "1.1.1",
"version": "1.1.2",
"description": "Block the feed on LinkedIn",
"background": {
"scripts":["background.js"]
},
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
Expand All @@ -20,7 +17,7 @@
"css": ["content.css"]
}
],
"browser_action": {
"action": {
"default_popup": "popup.html"
},
"permissions": [
Expand Down

0 comments on commit 818a3aa

Please sign in to comment.