Skip to content

Instantly share code, notes, and snippets.

@gaute
Forked from gaute/githubprint.user.js
Created November 22, 2011 08:04
Show Gist options
  • Save gaute/1385148 to your computer and use it in GitHub Desktop.
Save gaute/1385148 to your computer and use it in GitHub Desktop.
Printable GitHub
// ==UserScript==
// @name Printable GitHub
// @version 1.1
// @namespace https://github.com/gaute
// @include https://github.com/*/issues/*
// @include https://github.com/*/pull/*
// @include https://github.com/*/wiki/*
// @include https://github.com/*/commit/*
// ==/UserScript==
if (typeof($) === "undefined") {
$ = unsafeWindow.$;
}
function main() {
var printcss = '#header, #footer, .instapaper_ignore, .subnav-bar, '
+ '.context-loader, .actions, .error, '
+ '.notification-settings, .ajax-error-message, form, .back, '
+ '.avatar .overlay, '
+ '#wiki-wrapper ul.actions, #delete-link {display: none;}'
+ '.new-comments .js-comment-container {display: block;}'
+ '.new-comments {margin-left: 60px;}'
+ 'h1, h2, h3, h4, h5, h6 {page-break-after: avoid; page-break-inside: avoid;}';
var screencss = $('head link[media=screen]').attr('href');
$('head').append('<link rel="stylesheet" media="print" href="' + screencss + '" type="text/css" />');
$('head').append('<style media="print">' + printcss + '</style>');
}
var script = document.createElement('script');
script.textContent = '(' + main.toString() + ')();';
document.body.appendChild(script);
@gaute
Copy link
Author

gaute commented Nov 22, 2011

Printable issues, commits, pull requests and wikis.

@riker09
Copy link

riker09 commented May 15, 2012

It doesn't seem to work in Chrome on Ubuntu (Version: 18.0.1025.151 (Developer-Build 130497 Linux) Ubuntu 12.04). Printout still looks ugly.

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