Greasy Fork is available in English.

Redmine Status Highlighter

Highlight issue status etc. in redmine issue list and details

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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      *://*/*/issues*
// @match      *://*/issues/*
// @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           = "John Doe"; // 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 == "Immediate")    $(elem).css("background-color", "#FBA"); // red
            if (text == "Urgent")       $(elem).css("background-color", "#FCA"); // orange
            if (text == "High")         $(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 == "New")              $(elem).css("background-color", "#FBA"); // red
            if (text == "Feedback")         $(elem).css("background-color", "#FBF"); // 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 == MY_NAME) $(elem).css("background-color", "#FE8"); // gold
    });
})();