Skip to content

Instantly share code, notes, and snippets.

@ink-ru
Last active July 15, 2021 16:38
Show Gist options
  • Save ink-ru/5ea560d74707b63a4765abf32234d7cb to your computer and use it in GitHub Desktop.
Save ink-ru/5ea560d74707b63a4765abf32234d7cb to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Jira Server enhancements
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Jira Server enhancements
// @author George Wise
// @include /^https://jira\.[\w\.]+2\.ru/.*/
// @resource IMPORTED_CSS https://gist.githubusercontent.com/ink-ru/5ea560d74707b63a4765abf32234d7cb/raw/48fe1df3e0ff1e5d4c0170c2bb847e9cd0b0f95d/jira_board_style.css
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @grant GM_getResourceText
// @grant GM_addStyle
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
const my_css = GM_getResourceText("IMPORTED_CSS");
GM_addStyle(my_css);
var $ = window.jQuery;
// ========================================================================
if(!!document.querySelector(".gh-create-issue-in-epic-lnk"))
{
console.log('CustomJira - This is NOT an epic!');
}
else
{
console.log('CustomJira - This is an epic.');
let button_exsits = !!document.querySelector("#greenhopper-epics-issue-web-panel_heading .ops > li#hide_done");
if(!button_exsits)
{
let menu = document.querySelector("#greenhopper-epics-issue-web-panel_heading .ops");
let new_li = document.createElement('li');
new_li.setAttribute("id", "hide_done");
new_li.textContent = 'Hide Done';
menu.appendChild(new_li);
console.log('CustomJira - button initial creattion');
}
else
{
console.log('CustomJira - button already exists');
}
function Display_done()
{
let li = document.querySelector("#hide_done");
var elementList = document.querySelectorAll("#ghx-issues-in-epic-table .issuerow .status .jira-issue-status-lozenge-done");
if (elementList.length > 0)
{
elementList.forEach(function(IssueItem)
{
if(window.getComputedStyle(IssueItem.parentElement.parentElement, null).getPropertyValue("display") !== "none")
{
IssueItem.parentElement.parentElement.style.display = "none";
console.log('CustomJira - element have been hidden');
li.textContent = 'Show Done';
}
else
{
IssueItem.parentElement.parentElement.style.display = "table-row";
console.log('CustomJira - elements have been restored');
li.textContent = 'Hide Done';
}
// console.log(window.getComputedStyle(IssueItem.parentElement.parentElement, null).getPropertyValue("display"))
});
}
}
Display_done();
// document.querySelector("#greenhopper-epics-issue-web-panel_heading .ops #hide_done").addEventListener( "click", Display_done() );
$(document).on('click', '#hide_done', function() {
Display_done();
});
}
// ========================================================================
if ($('#screenAssociations').length > 0)
{
var checked = true
$("#add-field-to-screen .descriptionrow .desc-wrap").append( '<button id="uncheck_cust_jira" type="button">UnCheck*</button>' );
$('#uncheck_cust_jira').on("click",function(){
/*
$( "table#screenAssociations input[name='associatedScreens']" ).on( "mouseover", function() {
$( this ).css( "opacity": ".5", "background-color": "silver" )
})
*/
if (checked)
{
$( "table#screenAssociations input[name='associatedScreens']" ).each(function( index ) {
$( this ).prop( "checked", false );
});
checked = false
}
else
{
$( "table#screenAssociations input[name='associatedScreens']" ).each(function( index ) {
$( this ).prop( "checked", true );
});
checked = true
}
})
}
})();
// https://github.com/Tampermonkey/tampermonkey/issues/835
// https://www.tampermonkey.net/documentation.php#GM_addStyle
/* Issue number */
.ghx-issue .ghx-key-link {
font-size: xx-small;
}
/* Issue athor */
.ghx-avatar-img:before {
content: attr(alt);
}
.ghx-avatar-img:after {
content: attr(alt);
}
/* Main caption */
.ghx-issue-fields .ghx-summary .ghx-inner {
font-weight: bold;
color: darkslategrey;
font-size:1.2em;
}
/* Hiding board type */
.subnavigator-title, .ghx-header .subnav-container, span.subnav-container {
display: none;
}
/* Compact header panel */
.ghx-actions-tools, .ghx-compact-toggle {
padding:0;
margin:0;
height:inherit;
}
#ghx-header {
padding:1ex;
margin:0;
}
/* Compact quick filters */
.ghx-quick-content.aui-expander-content, .ghx-quick-content, .ghx-controls-filters dt, .ghx-controls-filters dd {
padding:0;
margin:0;
line-height: inherit;
height: inherit;
}
.ghx-controls-filters dd a {
padding:0 1ex;
margin:0;
}
#ghx-controls .ghx-controls-work {
min-height: unset;
}
/* release */
.ghx-release {
display:none;
}
/* card */
.ghx-issue {
min-height: 8em;
/* margin:0.2ex 0.6ex; */
padding:0.2ex 0.2ex 0.2ex 1ex;
overflow: hidden;
}
/* card footer */
.ghx-issue .ghx-card-footer
{
margin: 0 0.8ex 0 0; /* for negative margin */
float: right;
}
.ghx-card-footer div, .ghx-issue .ghx-card-footer div {
position: static;
/* margin-left: auto; */
justify-content: flex-end;
}
.ghx-issue .ghx-card-footer img
{
width: 1.2em;
height: 1.2em;
min-width: auto;
margin:0;
padding:0;
overflow:visible;
-webkit-border-radius: unset;
border-radius: unset;
}
.ghx-issue .ghx-card-footer div:not(:first-child)
{
padding-top:0.4ex;
}
.ghx-issue .ghx-card-footer div.ghx-days {
position: absolute;
top: 0;
right:-6em;
overflow: hidden;
}
.ghx-days b {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
/* lables */
.ghx-issue-content .ghx-highlighted-fields .ghx-highlighted-field {
opacity: 0.82;
}
/* Issue hover */
.ghx-issue:hover {
background-color:rgba(250, 250, 250, 0.5);
/* zoom: 1.02; */
border: 1px dotted silver;
margin-left:1ex;
/* padding:0 0.6ex; */
}
/* .ghx-issue:hover .ghx-issue-fields .ghx-summary .ghx-inner {
font-size:1.5em;
} */
/* === Tempo === */
#tempo-app .ReactVirtualized__Table__Grid .virtualized-table-row {
position: relative!important;
margin-top: -1ex;
margin-bottom: -9.4ex;
max-height: 6ex;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment