Skip to content

Instantly share code, notes, and snippets.

@flashingpumpkin
Created December 9, 2011 14:13
Show Gist options
  • Save flashingpumpkin/1451672 to your computer and use it in GitHub Desktop.
Save flashingpumpkin/1451672 to your computer and use it in GitHub Desktop.
Gmail Monospace Font
css = """
div.Bk {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}
textarea {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}
td > div {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}
"""
try
head = document.getElementsByTagName("head")[0]
node = document.createElement "style"
node.type = "text/css";
node.appendChild document.createTextNode css
head.appendChild node
catch err
try
console.log "Error applying GMail style: "
console.log err
console.log err.stack
catch err
# pass
// @name Gmail/Google Groups Monospace
// @namespace http://owns.ch
// @description Make emails and textareas in Gmail/Google Groups monospace
// @author Alen Mujezinovic
// @homepage http://gist.github.com/1451672
// @match https://mail.google.com/*
// @match https://groups.google.com/*
// @run-at document-start
(function() {
var css, head, node;
css = "div.Bk {\n font-family: DejaVu Sans Mono, Courier, Monospace !important;\n}\ntextarea {\n font-family: DejaVu Sans Mono, Courier, Monospace !important;\n}\ntd > div {\n font-family: DejaVu Sans Mono, Courier, Monospace !important; \n}";
try {
head = document.getElementsByTagName("head")[0];
node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
head.appendChild(node);
} catch (err) {
try {
console.log("Error applying GMail style: ");
console.log(err);
console.log(err.stack);
} catch (err) {
}
}
}).call(this);
@flashingpumpkin
Copy link
Author

To install, click on the raw link on the javascript file. Enjoy.

@danguita
Copy link

Thanks!

I have updated your script in this fork. Now it works on recent versions of Google Chrome.

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