arximir / JiraDeskStylizer

// ==UserScript==
// @name         JiraDeskStylizer
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Optimize Kanban Board View
// @author       Mikhail Buinevich
// @license      MIT
// @match        http://jira.enav.kronshtadt.ru/secure/RapidBoard.jspa?*
// @icon         https://www.google.com/s2/favicons?domain=tampermonkey.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var head = document.getElementsByTagName('head')[0];
    if (!head) return;

    head.appendChild(Style('#ghx-header { padding: 2px 2px 2px 2px; }'));
    head.appendChild(Style('.ghx-controls-filters dt, .ghx-controls-filters dd {margin: 0 0 0px 0;}'));
    head.appendChild(Style('.ghx-controls-filters dd a { margin: 0 3px 0 0; padding: 1px 1px; }'));
    head.appendChild(Style('.ghx-gh { font-size: 10px;}'));
    head.appendChild(Style('#announcement-banner { padding: 0px; }'));
    head.appendChild(Style('#ghx-header h1, #ghx-header h2 { font-size: 24px; }'));
    head.appendChild(Style('.ghx-rapid-views #gh #ghx-work #ghx-pool-column #ghx-column-headers .ghx-column { padding-top: 2px; }'));
    head.appendChild(Style('.ghx-column-headers .ghx-column { padding: 2px 9px; }'));
    head.appendChild(Style('.ghx-swimlane-header .ghx-heading { margin: 0px 0; }'));
    head.appendChild(Style('.ghx-rapid-views #gh #ghx-work #ghx-pool-column .ghx-swimlane .ghx-swimlane-header { top: 29px; }'));
    head.appendChild(Style('.ghx-rapid-views #gh #ghx-work #ghx-pool-column .ghx-columns,'+
                           ' .ghx-rapid-views #gh #ghx-work #ghx-pool-column #ghx-column-headers,'+
                           ' .ghx-rapid-views #gh #ghx-work #ghx-pool-column .ghx-zone-overlay-table'+
                           ' {grid-column-gap: 1px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));}'));
    head.appendChild(Style('.ghx-rapid-views #gh #ghx-work #ghx-pool-column .ghx-columns .ghx-column,'+
                           ' .ghx-rapid-views #gh #ghx-work #ghx-pool-column #ghx-column-headers .ghx-column,'+
                           ' .ghx-rapid-views #gh #ghx-work #ghx-pool-column .ghx-zone-overlay-table .ghx-column,'+
                           ' .ghx-rapid-views #gh #ghx-work #ghx-pool-column .ghx-columns .ghx-zone-overlay-column,'+
                           ' .ghx-rapid-views #gh #ghx-work #ghx-pool-column #ghx-column-headers .ghx-zone-overlay-column,'+
                           ' .ghx-rapid-views #gh #ghx-work #ghx-pool-column .ghx-zone-overlay-table .ghx-zone-overlay-column'+
                           ' { grid-row: 1; min-width: 150px; }'));

    setTimeout(() => {
        RemoveById('ghx-header');
        //RemoveByClass('subnav-container');
    }, 500);
})();

function Style(css) {
    var style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    return style;
}

function RemoveById(id) {
    var element = document.getElementById(id);
    if (element) element.parentNode.removeChild(element);
}

function RemoveByClass(classname) {
    var collection = document.getElementsByClassName(classname);
    if (collection[0]) collection[0].parentNode.removeChild(collection[0]);
}