Skip to content

Instantly share code, notes, and snippets.

@cuylerstuwe
Created November 22, 2019 16:43
Show Gist options
  • Save cuylerstuwe/be5154b9664828f77aab79b12c179e96 to your computer and use it in GitHub Desktop.
Save cuylerstuwe/be5154b9664828f77aab79b12c179e96 to your computer and use it in GitHub Desktop.
Uncensor Images in Facebook Posts By Default
const startTime = performance.now();
const ss = [...document.styleSheets];
const rules = ss.flatMap(styleSheet => [...styleSheet.rules]);
console.log("There are", rules.length, "rules to sift through.");
const censorshipClassSelector =
rules
.find(rule => rule.cssText.match(/\..+ \..+ { filter: blur\(15px\); }/))
.cssText
.match(/^[^ ]+/)[0];
rules.forEach((rule) => {
if(rule.cssText.startsWith(censorshipClassSelector)) {
const styleObj = rule.style;
for (var i = styleObj.length; i--;) {
var nameString = styleObj[i];
styleObj.removeProperty(nameString);
}
}
});
const endTime = performance.now();
console.log("It took", Math.floor(endTime - startTime), "ms to apply the uncensorship patch.");
@cuylerstuwe
Copy link
Author

I took the time to investigate this and write this script because I was angry that this Facebook post was censored by default:
https://www.facebook.com/1458124747741083/photos/a.1458151774405047/2606493742904172/?type=3&theater

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment