Last active
November 29, 2020 03:27
-
-
Save jonschoning/4ffa2f3e3e6f36b417cfac3428eb7967 to your computer and use it in GitHub Desktop.
Facebook messages: Declutter
This file contains hidden or 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
// ==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