Skip to content

Instantly share code, notes, and snippets.

@daveseah
Forked from BenjaminKlatt/github-print-bookmarklet
Last active September 23, 2015 21:02
Show Gist options
  • Save daveseah/86a137013abc90cee89e to your computer and use it in GitHub Desktop.
Save daveseah/86a137013abc90cee89e to your computer and use it in GitHub Desktop.
Bookmarklet for Removing GitHub Frame for Printing
/// copy the line below for bookmarklet, use as URL
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1); f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window, document,"1.3.2",function($,L){$('#header,.pagehead,.breadcrumb,.commit,.meta,#footer,#footer-push,.wiki-actions,#last-edit,.actions,.header,.site-footer,.repository-sidebar,.file-navigation,.gh-header-meta,.gh-header-actions,#wiki-rightbar,#wiki-footer').remove();$('#files,.file').css({"background":"none","border":"none"});$('link').removeAttr('media');$('.container,.repository-with-sidebar .repository-content').css('width','100%');$('.gh-header-title,.has-rightbar #wiki-body').css('margin-right','0');});
/*/ NOTES
1. Figured out what CSS to change using Chrome Developer Tools Inspect Element
2. Uncrunched src bookmarklet (jsbeautifer.org) to see where to insert jquery
3. Manually created bookmark with the re-crunched 'javascript:etc' as URL
4. Ran bookmarklet on Wiki documentation page to render printable page
5. 'Inspect Element' on HTML node, choose 'Edit as HTML'
6. Copy html text, paste into a text editor, save as .html file
SEEMS TO WORK. Tested in Chrome only
/*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment