-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8fb2ea
commit f25d584
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
## Google Chrome Tampermonkey Scripts | ||
### 23 Oct 2024 | ||
|
||
```javascript | ||
// ==UserScript== | ||
// @name Simple Promotion Blocker (LinkedIn) | ||
// @version 0.1.0 | ||
// @description Blocks promoted posts on LinkedIn. | ||
// @match http://linkedin.com/* | ||
// @match https://linkedin.com/* | ||
// @match http://www.linkedin.com/* | ||
// @match https://www.linkedin.com/* | ||
// ==/UserScript== | ||
|
||
(function() { | ||
console.clear(); | ||
console.log("Simple Promotion Blocker running"); | ||
|
||
let pending; | ||
|
||
function findParent(el) { | ||
let parent = el | ||
|
||
do { | ||
parent = parent.parentNode | ||
} while (!parent.parentNode.classList.contains("scaffold-finite-scroll__content")) | ||
|
||
return parent | ||
} | ||
|
||
var observer = new MutationObserver(function () { | ||
pending && clearTimeout(pending); | ||
|
||
pending = setTimeout(() => { | ||
Array.from(document.querySelectorAll(`span[aria-hidden="true"]`)) | ||
.filter((el) => /promoted/i.test(el.textContent.trim()) && findParent(el).remove()); | ||
}, 200); | ||
}); | ||
|
||
observer.observe(document, { childList: true, subtree: true }); | ||
})(); | ||
``` | ||
|
||
```javascript | ||
// ==UserScript== | ||
// @name Simple Promotion Blocker (Reddit) | ||
// @version 0.1.0 | ||
// @description Blocks promoted posts on Reddit. | ||
// @match http://reddit.com/* | ||
// @match https://reddit.com/* | ||
// @match http://www.reddit.com/* | ||
// @match https://www.reddit.com/* | ||
// @match http://old.reddit.com/* | ||
// @match https://old.reddit.com/* | ||
// ==/UserScript== | ||
|
||
(function() { | ||
console.log("Simple Promotion Blocker running"); | ||
|
||
var observer = new MutationObserver(function() { | ||
for (const el of document.querySelectorAll(".promotedlink")) { | ||
el.remove(); | ||
} | ||
}); | ||
|
||
observer.observe(document, { childList: true, subtree: true }); | ||
})(); | ||
``` |