Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing the First Version v0.1.0 still a lot way go and solve many more bugs #2

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Bump version
on:
pull_request:
types:
- closed
branches:
- production

jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'

- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.64.0 # Don't use @master or @v1 unless you're happy to test the latest version
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }} # if you don't want to set write permissions use a PAT token
WITH_V: true
PRERELEASE: true
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
48 changes: 48 additions & 0 deletions js/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
let lastScrollPosition = 0;
let isScrollingDown = false;

window.addEventListener("scroll", function () {
let currentScrollPosition = window.scrollY;

// Check if the user is scrolling down (scrolling away from the top)
if (currentScrollPosition > lastScrollPosition) {
isScrollingDown = true;
} else {
isScrollingDown = false;
}

// Check if the user scrolled at least 100px and is scrolling down
if (
Math.abs(currentScrollPosition - lastScrollPosition) >= 100 &&
isScrollingDown
) {
hideSuggestedPosts();
lastScrollPosition = currentScrollPosition;
}
});

function hideSuggestedPosts() {
console.log("Runed");
let allElements = document.querySelectorAll(
'span.x193iq5w.xeuugli.x13faqbe.x1vvkbs.x1xmvt09.x1lliihq.x1s928wv.xhkezso.x1gmr53x.x1cpjm7i.x1fgarty.x1943h6x.xudqn12.x3x7a5m.x6prxxf.xvq8zen.xo1l8bm.xi81zsa[dir="auto"]'
);
let suggestedElements = [];

for (let i = 0; i < allElements.length; i++) {
let element = allElements[i];
if (element.textContent === "Suggested for you") {
suggestedElements.push(element);
}
}

suggestedElements.forEach(function (spanElement) {
let parentElement = spanElement.parentElement;
while (parentElement) {
if (parentElement.classList.contains("x1lliihq")) {
parentElement.remove();
break;
}
parentElement = parentElement.parentElement;
}
});
}
23 changes: 11 additions & 12 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
{
"manifest_version": 3,
"name": "Facebook Suggested Posts Remover",
"version": "1.0",
"description": "Remove suggested posts on Facebook after every 100px of mouse scroll.",
"name": "Facebook QuietFeed",
"version": "0.1.0",
"description": "Facebook QuietFeed: Silence the noise and distractions on your Facebook feed for a more focused browsing experience.",
"permissions": [
"activeTab",
"storage",
"webNavigation",
"https://www.facebook.com/"
"webNavigation"
],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/icon16.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
"16": "assets/logo/icon16.png",
"48": "assets/logo/icon48.png",
"128": "assets/logo/icon128.png"
}
},
"content_scripts": [
Expand All @@ -23,13 +22,13 @@
"https://www.facebook.com/*"
],
"js": [
"content.js"
"js/content.js"
]
}
],
"icons": {
"16": "images/icon16.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
"16": "assets/logo/icon16.png",
"48": "assets/logo/icon48.png",
"128": "assets/logo/icon128.png"
}
}
10 changes: 10 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Facebook QuietFeed</title>
</head>
<body>
</body>
</html>