Last active
February 2, 2017 12:47
-
-
Save JesusLeon/f4e1cec675729dcab58a49ac5f2c0852 to your computer and use it in GitHub Desktop.
UserScripts for Redmine
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 Redmine better comments | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match *://somedomain.com/** | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var _style = '<style>' + | |
'#history .journal {' + | |
'margin: 20px 0;' + | |
'padding: 20px;' + | |
'border-bottom: 1px dotted #ccc;' + | |
'background-color: #efefef;' + | |
'}' + | |
'#history .journal h4 {' + | |
'border-bottom: none;' + | |
'margin-bottom: 30px;' + | |
'}' + | |
'#history .journal.has-details {' + | |
'background-color: #ffffff;' + | |
'}' + | |
'#history .journal.has-notes {' + | |
'background-color: #efefef;' + | |
'border-bottom: 1px dotted #ccc;' + | |
'}' + | |
'#history .journal.private-notes {' + | |
'background-color: #f3e3e8;' + | |
'border-bottom: none;' + | |
'}' + | |
'#history .journal p {' + | |
'line-height: 22px;' + | |
'margin: 1.2em 0;' + | |
'}' + | |
'#history .journal li {' + | |
'line-height: 22px;' + | |
'}' + | |
'#history .journal.has-notes ul.details {' + | |
' color: #959595;' + | |
' margin-bottom: 1.5em;' + | |
' background: #efefef;' + | |
' padding-top: 10px;' + | |
' padding-bottom: 10px;' + | |
' border: 1px dotted #ccc;' + | |
'}' + | |
'td {' + | |
' padding: 6px 5px !important;' + | |
' vertical-align: middle !important;' + | |
'}' + | |
'ul.details i {' + | |
'background-color: #aeafaa;' + | |
'padding: 2px 4px;' + | |
'color: #fff;' + | |
'border-radius: 2px;' + | |
'font-size: 11px' + | |
'}' + | |
'a[href*="/attachments/download/"]:not(.icon-attachment) {' + | |
' background: #70A7CE;' + | |
' color: #fff !important;' + | |
' padding: 2px 4px;' + | |
' border-radius: 2px;' + | |
'}' + | |
'</style>' | |
; | |
$('head').append(_style); | |
})(); |
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 Redmine Status Highlighter | |
// @namespace http://cbaoth.yav.in | |
// @version 0.2.1 | |
// @description Highlight issue status etc. in redmine issue list and details | |
// | |
// Change "mydomain" or path "/redmine/" if needed: | |
// @match *://somedomain.com/* | |
// @match *://*/redmine/*/issues* | |
// @match *://*/redmine/issues/* | |
// | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js | |
// @copyright 2014, [email protected] | |
// ==/UserScript== | |
// Basis: http://userscripts.org/scripts/source/177488.user.js | |
// Change the colors as desired (examples below) | |
// prevent jQuery version conflicts (with page) | |
this.$ = this.jQuery = jQuery.noConflict(true); | |
(function(){ | |
// CONFIG | |
var ENABLE_PRIORITY = true; // highlight priority | |
var ENABLE_STATUS = true; // highlight status (and custome fields) | |
var ENABLE_IN_LIST = true; // highlight in issue list | |
var ENABLE_IN_DETAILS = true; // highlight in issue detail view | |
var DEV_TODO_ONLY = true; // just highlight things that could be dev todos | |
var MY_NAME = "MY_NAME"; // for 'assigned to' highlighting | |
// which screen are we in | |
var screen = 0; | |
if (/\/issues\//.test(window.location.pathname)) { | |
screen = 2; // detail screen | |
} else { | |
screen = 1; // list screen | |
} | |
// not enabled for current screen? | |
if ((screen == 1 && !ENABLE_IN_LIST) || (screen == 2 && !ENABLE_IN_DETAILS)) { | |
return; | |
} | |
// -- PRIORITY ---------------------------------------------------------------- | |
if (ENABLE_PRIORITY) { | |
var priorityList = $('.priority'); | |
jQuery.each(priorityList, function(i, elem){ | |
text = $(elem).text().trim(); | |
if (text.indexOf("Immediate") !== -1) $(elem).css({"background-color":"rgb(236, 101, 91)", 'color':'#fff'}); // red | |
if (text.indexOf("Urgent") !== -1) $(elem).css("background-color", "#FCA"); // orange | |
if (text.indexOf("High") !== -1) $(elem).css("background-color", "#FE8"); // gold | |
//if (text == "Normal") $(elem).css("background-color", "#DFF7FF"); // light blue | |
//if (text == "Low") $(elem).css("background-color", "#DFE"); // light mint | |
}); | |
} | |
// -- STATUS ------------------------------------------------------------------ | |
if (ENABLE_STATUS) { | |
var statusList = $('.status'); | |
jQuery.each(statusList, function(i, elem){ | |
text = $(elem).text().trim(); | |
// change statuses and colors here | |
if (text.indexOf("Neu") !== -1) $(elem).css("background-color", "#f2f9b3"); // yellow | |
if (text.indexOf("Erledigt / Übertrag Livesystem") !== -1) $(elem).parent('tr').css("opacity", "0.3"); // pink | |
//if (text == "In Progress") $(elem).css("background-color", "#FE8"); // gold | |
/*if (!DEV_TODO_ONLY) { // ignore the following (not critical for devs) | |
if(text == "Resolved") $(elem).css("background-color", "#DFE"); // light mint | |
if(text == "Closed") $(elem).css("background-color", "#DDD"); // grey | |
if(text == "Rejected") $(elem).css("background-color", "#FB9"); // red/orange | |
}*/ | |
}); | |
} | |
// Assigned To | |
var assignedTo = $('.assigned_to'); | |
jQuery.each(assignedTo, function(i, elem){ | |
text = $(elem).text().trim(); | |
if (text.indexOf(MY_NAME) !== -1) $(elem).css("background-color", "#f2f9b3"); // gold | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment