An element attribute deobfuscator for Reddit. Turn the original attribute names into the obfuscated/randomized ones and vice versa. Eases and allows the creation of new Reddit modifying userscripts.
- Copy & paste AttributeDeobfuscator to your userscript, or require it
// @require https://raw.githubusercontent.com/Hakorr/AttributeDeobfuscator/main/attributedeobfuscator.js
- Run the script at start
// @run-at document-start
- Create a new instance and define a function to be ran when AttributeDeobfuscator is loaded and ready
const Deobfuscator = new AttributeDeobfuscator();
Deobfuscator.ready(yourFunction);
- Use
obfuscateClass
anddeobfuscateClass
functions accordingly
// Returns the element's obfuscated/randomized className
Deobfuscator.obfuscateClass("Input", false); // "zgT5MfUrDMC54cpiCpZFu"
// Returns the results of a querySelectorAll
Deobfuscator.obfuscateClass("Input", true); // Array of [Element Object]
// Returns the normal className
Deobfuscator.deobfuscateClass("zgT5MfUrDMC54cpiCpZFu") // "Input"
- Add this this to your function which is called when the deobfuscator is ready
unsafeWindow.deobfuscate = className => console.log(Deobfuscator.deobfuscateClass(className));
// or
console.log(Deobfuscator.attributeArr);
- If you chose the first one, run the command from the devtools, otherwise just look at the logged array manually
deobfuscate("obfuscatedClassname"); // "deobfuscatedClassName"
- With the deobfuscated class name, you can access the element from your script, like so
Deobfuscator.obfuscateClass("deobfuscatedClassName", true); // [Element]
This way you can create userscripts that won't rely on changing obfuscated values!
Change the background to an image
// ==UserScript==
// @name name
// @namespace namespace
// @match https://www.reddit.com/*
// @grant none
// @version 1.0
// @author author
// @run-at document-start
// @description description
// @require https://raw.githubusercontent.com/Hakorr/AttributeDeobfuscator/main/attributedeobfuscator.js
// ==/UserScript==
const IMAGE_URL = "https://images.pexels.com/photos/853199/pexels-photo-853199.jpeg";
const Deobfuscator = new AttributeDeobfuscator();
Deobfuscator.ready(() => {
const layer = Deobfuscator.obfuscateClass("innerContainer", true);
layer[0].style["background-image"] = `url("${IMAGE_URL}")`;
layer[0].style["background-repeat"] = 'no-repeat';
layer[0].style["background-attachment"] = 'fixed';
layer[0].style["background-positio"] = '0% 50%';
});
Helper script
// ==UserScript==
// @name RedditDeobfuscateHelper
// @namespace namespace
// @match https://www.reddit.com/*
// @grant none
// @version 1.0
// @author author
// @run-at document-start
// @description Use the command "deobfuscate()" to deobfuscate attribute names
// @require https://raw.githubusercontent.com/Hakorr/AttributeDeobfuscator/main/attributedeobfuscator.js
// ==/UserScript==
const Deobfuscator = new AttributeDeobfuscator();
Deobfuscator.ready(() => {
unsafeWindow.deobfuscate = className => console.log(Deobfuscator.deobfuscateClass(className));
});
- Speed up the load time