Skip to content

Instantly share code, notes, and snippets.

@NathanLawrence
Created October 12, 2018 17:36
Show Gist options
  • Save NathanLawrence/16ec172438b0357484ce8c10f53032ea to your computer and use it in GitHub Desktop.
Save NathanLawrence/16ec172438b0357484ce8c10f53032ea to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Fix Core Publisher Printing Styles
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Make it so Core Publisher actually prints acceptably.
// @author Nathan Lawrence
// @match *://www.kbia.org/*
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
(function() {
'use strict';
function injectStyle(rule){
var cssDiv = $("<div />", {
"html": "&shy;<style>" + rule + '</style>'
}).appendTo("body");
}
// Your code here...
injectStyle(`
@media print {
body{
padding-top: 20px !important;
}
div#toolbar{
display: none;
}
div.region-persistent{
display: none;
}
ul.tabs{
display: none;
}
footer.footer{
display: none;
}
header.header{
width: 100% !important;
margin: 15px 0 !important;
background-color: rgba(0,0,0,0.5) !important;
}
header.header div.skiptocontent{
display: none !important;
}
header.header div.branding{
}
header.header div.branding div.brand-inner-wrapper{
display:block !important;
width: 100% !important;
}
header.header div.branding div.brand-inner-wrapper{
display:block !important;
width: 100% !important;
}
header.header div.branding div.brand-inner-wrapper a{
display: block !important;
width: 100% !important;
padding: 10px !important;
height: 100px !important;
}
header.header div.branding div.brand-inner-wrapper a[href]:after{
content: none !important;
}
header.header div.branding div.brand-inner-wrapper div.tagline{
display: none !important;
}
header.header div.branding div.brand-inner-wrapper a img{
max-height: 100% !important;
height: 100% !important;
max-width: 100% !important;
margin: auto;
}
header.header div.branding div.header-utility{
display: none !important;
}
div.wysiwyg-asset-image-wrapper{
display: block !important;
height: 300px !important;
margin: 25px auto !important;
float: none !important;
}
div.wysiwyg-asset-image-wrapper div.wysiwyg-asset-image{
height: 85%;
margin: auto;
}
div.wysiwyg-asset-image-wrapper a[href] img{
height: 100% !important;
max-width: 100% !important;
}
div.wysiwyg-asset-image-wrapper a[href]:after{
content: none !important;
}
div.unpublished {
width: 80%;
margin: 25px auto !important;
border: 2px solid black !important;
background: rgba(0,0,0, 0.2) !important;
font-size: 1em !important;
letter-spacing: normal !important;
}
div.audio-container{
page-break-inside: avoid !important;
}
div.post-body p{
font-size: 1.1em !important;
line-height: 1.7em !important;
}
}`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment