Skip to content

Instantly share code, notes, and snippets.

@prednaz
Created December 19, 2023 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prednaz/9893a253ca908023f8e9b00c2e1b4ae1 to your computer and use it in GitHub Desktop.
Save prednaz/9893a253ca908023f8e9b00c2e1b4ae1 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name facebook_requests_with_posts_only
// @match https://www.facebook.com/*
// @version 1
// @grant none
// ==/UserScript==
const key = (event) => ["f", "ƒ"].includes(event.key) && event.ctrlKey && event.altKey;
let filtering = false;
document.addEventListener(
"keydown",
event =>
{
if (event.target instanceof HTMLInputElement) {return;}
if (!key(event)) {return;}
filtering = !filtering;
for (request of document.querySelector(".x1k70j0n:nth-of-type(2)").children) {
if (!request.textContent.includes("Preview")) {
request.style.display = filtering ? "none" : "";
}
}
},
true
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment