-
-
Save gaute/1385148 to your computer and use it in GitHub Desktop.
Printable GitHub
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
// ==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); |
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
Printable issues, commits, pull requests and wikis.