Last active
March 28, 2019 19:38
-
-
Save kpym/0e595241caeaccefdecdb09d4186c376 to your computer and use it in GitHub Desktop.
Greasemonkey : Add print style to stackexchange.com (SX).
This file contains 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 Add print style to SX | |
// @namespace https://gist.github.com/kpym/0e595241caeaccefdecdb09d4186c376 | |
// @version 0.1 | |
// @description This script inject @media print CSS to SX websites | |
// @author kpym | |
// @match http*://*.stackexchange.com/* | |
// @grant GM_addStyle | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; | |
// ------------------------------------------ | |
// CSS part injected in the page | |
GM_addStyle(" \ | |
@media print { \ | |
* { \ | |
visibility: hidden; \ | |
} \ | |
#content * { \ | |
visibility: visible; \ | |
} \ | |
header, #left-sidebar, #sidebar, form, .bottom-notice, .comments-link, .aside-cta { \ | |
display: none; \ | |
} \ | |
#mainbar { \ | |
width: 100%; \ | |
} \ | |
div.post-text { \ | |
page-break-inside: avoid; \ | |
} \ | |
} \ | |
"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment