Skip to content

Instantly share code, notes, and snippets.

@andreasisaak
Created November 11, 2021 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasisaak/788955c51499504a03d85d3b065ff52e to your computer and use it in GitHub Desktop.
Save andreasisaak/788955c51499504a03d85d3b065ff52e to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Jira Print
// @namespace https://github.com/andreasisaak
// @match https://*.atlassian.net/sr/jira.issueviews:searchrequest-printable/*
// @description Jira Print
// @version 1
// @author Patrick Kahl <kahl.patrick@googlemail.com>, Andreas Isaak <andy.jared@googlemail.com>
// ==/UserScript==
(function() {
'use strict';
document.querySelectorAll('tbody tr').forEach(tr => {
const th = document.querySelector('thead .rowHeader').cloneNode('deep');
tr.parentNode.insertBefore(th, tr);
});
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
addGlobalStyle(
'.result-header { display: none; }' +
'.jira-macro-single-issue-export-pdf { display: none; }' +
'.headerrow-issuekey { min-width: 100px; }' +
'.headerrow-summary { min-width: 250px; }' +
'.issuekey a.issue-link { white-space: nowrap }' +
'#issuetable thead { display: none; }' +
'#issuetable tbody { display: block; }' +
'tr.issuerow { margin-bottom: 30px; page-break-after: always;/* page-break-inside: avoid;*/ }' +
'#issuetable tbody tr.rowHeader th { background: #e2e2e2 !important; }' +
'tr.issuerow, tr.rowHeader { display: flex; flex-wrap: no-wrap; border-bottom: none !important; }' +
'tr.issuerow td, tr.rowHeader th { flex: 1; border-top: none !important; }' +
'tr.issuerow td:not(.description), tr.rowHeader th:not(.headerrow-description) { flex:0 1 auto; min-width: 100px; }' +
'tr.issuerow td.issuekey, tr.rowHeader th.headerrow-issuekey { flex: 0 1 85px; min-width: 85px; }' +
'tr.issuerow td.labels, tr.rowHeader th.headerrow-labels { flex: 0 1 100px; min-width: 100px; }' +
'tr.issuerow td.fixVersions, tr.rowHeader th.headerrow-fixVersions { flex: 0 1 160px; min-width: 160px; }' +
'tr.issuerow td.issuekey a, tr.issuerow td.summary a { color: #333; }' +
'tr.issuerow td.summary, tr.rowHeader th.headerrow-summary { flex: 0 1 170px; min-width: 170px; }' +
'tr.issuerow td.description .image-wrap img { max-width: 800px; height: auto; }',
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment