Skip to content

Instantly share code, notes, and snippets.

@demian85
Last active December 24, 2015 18:19
Show Gist options
  • Save demian85/6842382 to your computer and use it in GitHub Desktop.
Save demian85/6842382 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Colorful Teg
// @version 1.0
// @match *teg.avature.net*
// @run-at document-end
// ==/UserScript==
[
'.analysis_functional > td {background-color: rgba(255, 80, 168, 0.45) !important; }',
'.testing > td { background-color: rgba(255, 255, 176, 0.45) !important; }',
'.analysis_technical > td { background-color: rgba(184, 134, 11, 0.45) !important; }',
'.autotesting > td { background-color: rgba(189, 183, 107, 0.45) !important; }',
'.autotesting_failed > td { background-color: rgba(255, 0, 0, 0.45) !important; }',
'.onhold > td { background-color: rgba(255, 216, 80, 0.45) !important; }',
'.development > td { background-color: rgba(200, 200, 255, 0.45) !important; }',
'.code_review > td { background-color: rgba(153, 85, 238, 0.45) !important; }',
'.functional_testing > td { background-color: rgba(250, 204, 46, 0.45) !important; }',
'.merge > td { background-color: rgba(204, 238, 221, 0.45) !important; }',
'tbody tr td.DynamicTableTd table, tbody tr td.DynamicTableTd td { background-color: transparent; }',
'.DynamicTableTd.DynamicTableTdPrimaryField.mouseover { background-color: #1B75D9 !important; }',
'tr.selected { background-color: #e4eaf0 !important; }'
].forEach(function(rule) {
document.styleSheets[0].insertRule(rule, document.styleSheets[0].cssRules.length);
});
var domObserver = new MutationObserver(function(records) {
records.forEach(function(record) {
if (record.type === 'childList') {
addBgColors();
}
});
});
domObserver.observe(document.body, {
childList: true,
subtree: true
});
function addBgColors() {
var rows = document.querySelectorAll('tbody.resultList > tr');
for (var i = 0, len = rows.length; i < len; ++i) {
var workflowSelector = rows[i].querySelector('.Td_jobOwnWorkflowStep .workflowStatusDropDownLink');
if (workflowSelector) {
rows[i].className = workflowSelector.textContent.trim().toLowerCase().replace(/\s+/g, '_');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment