Skip to content

Commit

Permalink
fix: #56 hide whole feed feature is now working again (#57)
Browse files Browse the repository at this point in the history
* fix: #56 hide whole feed feature is now working again

* fix: dont hide feed on notifications page
  • Loading branch information
iamtalhaasghar authored Aug 15, 2024
1 parent 1f26226 commit 0a0dca6
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,26 @@ function getStorageAndDoIt() {
async function toggleFeed(shown) {
let attempts = 0
let success = false

let className = 'scaffold-finite-scroll__content' // feed element css class
if (window.location.href != 'https://www.linkedin.com/feed/'){
// dont hide this element on notifications & jobs page. Only hide on home feed instead.
return
}
while (!success && attempts < 50) {
await new Promise((resolve) => {
setTimeout(() => {
if (
document.getElementsByClassName('artdeco-dropdown') &&
document.getElementsByClassName('artdeco-dropdown')[1] &&
document.getElementsByClassName('artdeco-dropdown')[1]
.nextElementSibling
) {
if (shown) {
document
.getElementsByClassName('artdeco-dropdown')[1]
.nextElementSibling.classList.add('hide')
} else {
document
.getElementsByClassName('artdeco-dropdown')[1]
.nextElementSibling.classList.remove('hide', 'dim')
}
success = true
setTimeout(() => {
if (shown) {
document
.getElementsByClassName(className).item(0)
.classList.add('hide')
console.log(`LinkOff: feed disabled`)
} else {
document
.getElementsByClassName(className).item(0)
.classList.remove('hide')
console.log(`LinkOff: feed enabled`)
}
success = true
attempts = attempts + 1
resolve()
}, 100 + attempts * 10)
Expand Down

0 comments on commit 0a0dca6

Please sign in to comment.