Skip to content

Instantly share code, notes, and snippets.

@graham
Created August 4, 2016 00:44
Show Gist options
  • Save graham/5bf2a51ceddf8d9b97c6eab9c002061b to your computer and use it in GitHub Desktop.
Save graham/5bf2a51ceddf8d9b97c6eab9c002061b to your computer and use it in GitHub Desktop.
// This is likely to break, because I'm sure a gmail update will change some of the tags,
// but it's helpful if people have special css classes on their emails.
function removeChildStyles(dom_element) {
dom_element.style = null;
for(var index=0; index < dom_element.children.length; index++) {
removeChildStyles(dom_element.children[index]);
}
}
function destyleGmailEmails() {
var elements = document.getElementsByClassName('ii gt adP adO');
for(var index=0; index < elements.length; index++) {
removeChildStyles(elements[index]);
}
}
destyleGmailEmails();
// as bookmarklet
/* javascript:(function()%7Bfunction removeChildStyles(dom_element) %7Bdom_element.style %3D null%3Bfor(var index%3D0%3B index < dom_element.children.length%3B index%2B%2B) %7BremoveChildStyles(dom_element.children%5Bindex%5D)%3B%7D%7Dfunction destyleGmailEmails() %7Bvar elements %3D document.getElementsByClassName('ii gt adP adO')%3Bfor(var index%3D0%3B index < elements.length%3B index%2B%2B) %7BremoveChildStyles(elements%5Bindex%5D)%3B%7D%7DdestyleGmailEmails()%7D)()
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment