Last active
October 19, 2016 02:39
-
-
Save ab/ea1e48f6e492e29616e7e024de0db5d5 to your computer and use it in GitHub Desktop.
Github Print Bookmarklet (like others, but does not require jQuery). Paste the minified javascript: into a bookmark to use it.
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
/* Remove stuff from the page to make github pages pretty for printing */ | |
console.log("Github pretty print 0.1"); | |
function removeClassElems(name) { | |
console.log("looking for class:", name); | |
Array.from(document.getElementsByClassName(name)).forEach(function(e) { | |
console.log("Removing", e); | |
e.parentNode.removeChild(e); | |
}); | |
} | |
/* Classes to remove from DOM */ | |
[ | |
"anchor", | |
"header", | |
"pagehead", | |
"site-footer", | |
"file-header", | |
"file-navigation", | |
"commit-tease", | |
"all_commit_comments", | |
"thread-subscription-status", | |
"discussion-timeline", | |
].forEach(removeClassElems); | |
/* remove border */ | |
Array.from(document.getElementsByClassName("file")).forEach(function(e) { | |
console.log("Removing border from", e); | |
e.style.border = "none"; | |
}); |
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
javascript:console.log("Github pretty print 0.1");function removeClassElems(name){console.log("looking for class:",name);Array.from(document.getElementsByClassName(name)).forEach(function(e){console.log("Removing",e);e.parentNode.removeChild(e)})}["anchor","header","pagehead","site-footer","file-header","file-navigation","commit-tease","all_commit_comments","thread-subscription-status","discussion-timeline",].forEach(removeClassElems);Array.from(document.getElementsByClassName("file")).forEach(function(e){console.log("Removing border from",e);e.style.border="none"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment