// ==UserScript==
// @name         Cucumber pimper
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Pimp cucumber reports
// @author       mquiron, mcormier, nguillet shenault
// @match        https://jenkins.omnimed.com/job/*/cucumber-html-reports/*overview-tags.html
// @grant        none
// ==/UserScript==
$( document ).ready(function() {
	$("<style type='text/css'> .cukeMoc { background-color: black !important; color: white !important; } </style>").appendTo("head");
	$("<style type='text/css'> .cukeNic { background-color: red !important; color: white !important; } </style>").appendTo("head");
	$("<style type='text/css'> .cukeVal { background-color: blue !important; color: white !important; } </style>").appendTo("head");
});

function colorCucumberTagForQA(tag, qa) {
	if (tag === 'CA') {
		/* Special case: name conflits between CAS and CA. */
		if ($('.tagname > a:contains(@CA):not(:contains(@CAS))').length !== 0) {
			$('.tagname > a:contains(@CA):not(:contains(@CAS))').addClass('cuke' + qa);
		} else {
			console.warn('Cucumber tag ' + tag + ' does not exists');
		}
	} else {
		if ($('.tagname > a:contains(@' + tag + ')').length !== 0) {
			$('.tagname > a:contains(@' + tag + ')').addClass('cuke' + qa);
		} else {
			console.warn('Cucumber tag ' + tag + ' does not exists');
		}
	}
}

function colorCucumberTags() {
	colorCucumberTagForQA('Aide', 'Nic');
	colorCucumberTagForQA('AjoutResultat', 'Val');
	colorCucumberTagForQA('Allergie', 'Val');
	colorCucumberTagForQA('Antecedents', 'Val');
	colorCucumberTagForQA('Aviseur', 'Moc');

	colorCucumberTagForQA('Beta', 'Moc');

	colorCucumberTagForQA('CA', 'Nic');
	colorCucumberTagForQA('CAS', 'Nic');
	colorCucumberTagForQA('CentreAdmin', 'Nic');
	colorCucumberTagForQA('ChampConfidentiel', 'Nic');
	colorCucumberTagForQA('Compte', 'Nic');

	colorCucumberTagForQA('Dictionnaire', 'Moc');
	colorCucumberTagForQA('Droits', 'Nic');
	colorCucumberTagForQA('DSQ', 'Moc');

	colorCucumberTagForQA('Etiquette', 'Nic');

	colorCucumberTagForQA('GuideUtilisateur', 'Val');

	colorCucumberTagForQA('HabitudesDeVie', 'Nic');

	colorCucumberTagForQA('Immunisation', 'Val');

	colorCucumberTagForQA('ListeResultat', 'Val');
	colorCucumberTagForQA('ListeTaches', 'Val');

	colorCucumberTagForQA('MaladieChronique', 'Nic');

	colorCucumberTagForQA('NC', 'Nic');
	colorCucumberTagForQA('Note', 'Nic');
	colorCucumberTagForQA('Notification', 'Moc');
	colorCucumberTagForQA('Nouvelles', 'Moc');

	colorCucumberTagForQA('OC', 'Nic');

	colorCucumberTagForQA('Patient', 'Nic');
	colorCucumberTagForQA('Prescripteur', 'Moc');
	colorCucumberTagForQA('Problemes', 'Val');
	colorCucumberTagForQA('Profil', 'Nic');
	colorCucumberTagForQA('Programmes', 'Nic');

	colorCucumberTagForQA('RendezVous', 'Nic');
	colorCucumberTagForQA('Resultat', 'Val');
	colorCucumberTagForQA('RevisionNotes', 'Nic');
	colorCucumberTagForQA('RevisionResultats', 'Val');
	colorCucumberTagForQA('RevisionTaches', 'Nic');

	colorCucumberTagForQA('SalleDAttente', 'Nic');
	colorCucumberTagForQA('SmokedTest', 'Nic');
	colorCucumberTagForQA('SQII', 'Moc');
	colorCucumberTagForQA('SQIL', 'Moc');
	colorCucumberTagForQA('SQIM', 'Moc');
	colorCucumberTagForQA('SignesVitaux', 'Moc');
	colorCucumberTagForQA('SuppressionResultat', 'Val');
	colorCucumberTagForQA('SV', 'Moc');

	colorCucumberTagForQA('Taches', 'Nic');

	colorCucumberTagForQA('UMF', 'Nic');
}

colorCucumberTags();
@@ -109,9 +109,9 @@
   1.
-5
+6
 %0A// 
@@ -1957,32 +1957,76 @@
 'DSQ', 'Moc');%0A%0A
+    colorCucumberTagForQA('Elevio', 'Moc');%0A
 %09colorCucumberTa
@@ -2244,32 +2244,72 @@
 ultat', 'Val');%0A
+    colorCucumberTagForQA('LR', 'Val');%0A
 %09colorCucumberTa
@@ -2327,27 +2327,27 @@
 teTaches', '
-Val
+Nic
 ');%0A%0A%09colorC
@@ -3045,32 +3045,72 @@
 Taches', 'Nic');
+%0A    colorCucumberTagForQA('RR', 'Val');
 %0A%0A%09colorCucumber
@@ -3527,16 +3527,16 @@
 c');%0A%7D%0A%0A
-
 colorCuc
@@ -3547,8 +3547,9 @@
 rTags();
+%0A

Update script CucumberReport