Created
November 22, 2019 16:43
-
-
Save cuylerstuwe/be5154b9664828f77aab79b12c179e96 to your computer and use it in GitHub Desktop.
Uncensor Images in Facebook Posts By Default
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
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."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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