Skip to content

Instantly share code, notes, and snippets.

@stefanv
Created October 25, 2011 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanv/1311057 to your computer and use it in GitHub Desktop.
Save stefanv/1311057 to your computer and use it in GitHub Desktop.
Userscript for fixing monospace fonts on GitHub to browser default
// ==UserScript==
// @name GitHub Fixed Font
// @namespace http://jonasgalvez.com.br/
// @description Fixed-font code listings for GitHub
// @include http://github.com/*
// @include http://*.github.com/*
// @include https://*.github.com/*
// @include https://*.github.com/*
// ==/UserScript==
var css = 'pre, code { font-family: monospace !important; }';
var append_to_css = function(txt) { css += '\n' + txt; }
append_to_css('#commit .human .message { font-family: monospace !important; }');
append_to_css('css #commit .machine { font-family: monospace !important; }');
append_to_css('#commit .commit_oneline .commit, #commit .commit_oneline .tree { font-family: monospace !important; }');
append_to_css('#forkqueue table td.sha, #forkqueue table td.message { font-family: monospace !important; }');
append_to_css('#forkqueue table td.human { font-family: monospace !important; }');
append_to_css('#forkqueue table.choice td.code { font-family: monospace !important; }');
append_to_css('#toc { font-family: monospace !important; }');
append_to_css('#browser table { font-family: monospace !important; }');
append_to_css('#readme div.plain pre { font-family: monospace !important; }');
append_to_css('#files textarea { font-family: monospace !important; }');
append_to_css('#files .file { font-family: monospace !important; }');
append_to_css('#files .file .data pre, #files .file .line-data { font-family: monospace !important; }');
append_to_css('#files .meta .bubble { font-family: monospace !important; }');
append_to_css('#repos .repo .commit .machine { font-family: monospace !important; }');
append_to_css('.news pre, .news code { font-family: monospace !important; }');
append_to_css('#code_search_instructions table.instruction tr td.inst { font-family: monospace !important; }');
append_to_css('#code_search_results .result .snippet { font-family: monospace !important; }');
append_to_css('#files .file .data pre,#files .file .line-data,#files .file .line-number,.file-box .data pre,.file-box .line-data,.file-box .line-number{font-family: monospace !important; }');
if(typeof GM_addStyle != "undefined") {
GM_addStyle(css);
} else if(typeof addStyle != "undefined") {
addStyle(css);
} else {
var heads = document.getElementsByTagName("head");
if(heads.length > 0) {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
heads[0].appendChild(node);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment