Last active
May 19, 2018 02:00
-
-
Save phatsk/47d4d8e916aadc4c42ed5d33c4f7444e to your computer and use it in GitHub Desktop.
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 Make JIRA Comments Readable | |
// @namespace https://gist.github.com/phatsk | |
// @version 0.1 | |
// @description Makes JIRA comments readable. | |
// @author phatsk@ | |
// @include /^https://.*\.atlassian\.net/browse/\w+-\d+/ | |
// @include /^https://jira\..*\.com/browse/\w+-\d+/ | |
// @grant none | |
// ==/UserScript== | |
( function() { | |
'use strict'; | |
var avs = {}; | |
$( 'a.collapsed-comments' ).trigger( 'click' ); | |
setTimeout( function() { | |
var palettes = { | |
pastel: { | |
min: 200, | |
max: 255 | |
} | |
}; | |
var palette = palettes.pastel; | |
$( '#activitymodule .verbose .user-avatar[rel]' ).map( function( i, el ) { | |
var user = $( el ).attr( 'rel' ); | |
if ( avs[user] ) { | |
$( el ) | |
.parents( '.twixi-wrap' ) | |
.css( 'background-color', avs[user] ); | |
return; | |
} | |
avs[user] = ( setTimeout( | |
( function( $el ) { | |
var color = [], | |
i; | |
for ( i = 3; i--; ) { | |
var x = 0; | |
do { | |
x = Math.ceil( Math.random() * 255 ); | |
} while ( palette.min > x || palette.max < x ); | |
color.push( x ); | |
} | |
color = 'rgb(' + color.join( ',' ) + ')'; | |
console.log( color ); | |
$( '.twixi-wrap:has(.user-avatar[rel=' + $el.attr( 'rel' ) + '])' ).css( | |
'background-color', | |
color | |
); | |
return true; | |
} )( $( el ) ) | |
), | |
250 ); | |
} ); | |
$( '.activity-comment' ).css( { padding: '1px' } ); | |
$( '.actionContainer' ).css( { padding: '10px' } ); | |
$( '#activitymodule' ).css( { width: '1200px' } ); | |
}, 1000 ); | |
} () ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment