-
-
Save Snarp/e33d5083724307a51ce329a658eb6fff to your computer and use it in GitHub Desktop.
expose source names on Tumblr
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
tumblr.getCssMap().then(cssMap => { | |
const keys = Object.keys(cssMap); | |
const elements = document.querySelectorAll("[class]"); | |
for (const {classList} of elements) { | |
for (const className of classList) { | |
const mappedClassName = keys.find(key => cssMap[key].includes(className)); | |
if (mappedClassName) classList.add(`tumblr--${mappedClassName}`); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment