Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jonschoning
Last active November 29, 2020 03:27
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 jonschoning/4ffa2f3e3e6f36b417cfac3428eb7967 to your computer and use it in GitHub Desktop.
Save jonschoning/4ffa2f3e3e6f36b417cfac3428eb7967 to your computer and use it in GitHub Desktop.
Facebook messages: Declutter
// ==UserScript==
// @name Facebook messages: Declutter
// @version 1
// @grant none
// ==/UserScript==
const SPECS =
[ { selectors: `._4_j5`, description: 'remove right pane', action: action_remove, enabled: true }
,
];
function action_remove(el) {
if(el) {
el.remove();
}
}
function specAction(container, spec) {
container.querySelectorAll(spec.selectors).forEach(el => {
console.log(`specAction: ${spec.description}; ${spec.selectors}; ${el} `);
spec.action(el);
});
}
function go() {
document.querySelectorAll('iframe').forEach(i => {
SPECS.filter(spec => spec.enabled).forEach(spec => {
specAction(i.contentWindow.document, spec);
});
});
}
setInterval(go, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment