Criticality Field Highlighter by zminkobinko
Colors criticality (td.customfield_11429) cells based on their criticality number.
Extension Metadata
About this extension
Made for the volvo vira
source code:
(function () {
"use strict";
// Maps a criticality number to a background color.
const COLOR_MAP = {
300: "#e53935", // red
100: "#ff5722", // red-orange
75: "#ff9800", // orange
50: "#ffeb3b", // yellow
30: "#cddc39", // lime
10: "#4caf50" // green
};
const SELECTOR = "td.customfield_11429";
function colorCell(cell) {
// Extract the first standalone number from the cell, ignoring any
// surrounding markup/labels (e.g. "High (300)").
const match = cell.textContent.match(/\d+/);
if (!match) return;
}
function colorAll(root) {
const cells =
root.nodeType === Node.ELEMENT_NODE && root.matches?.(SELECTOR)
? [root]
: [];
root.querySelectorAll?.(SELECTOR).forEach((c) => cells.push(c));
cells.forEach(colorCell);
}
// Initial pass.
colorAll(document);
// Re-apply when the page updates dynamically (e.g. AJAX-loaded tables).
const observer = new MutationObserver((mutations) => {
for (const m of mutations) {
m.addedNodes.forEach((node) => {
if (node.nodeType === Node.ELEMENT_NODE) colorAll(node);
});
}
});
observer.observe(document.body || document.documentElement, {
childList: true,
subtree: true
});
})();
source code:
(function () {
"use strict";
// Maps a criticality number to a background color.
const COLOR_MAP = {
300: "#e53935", // red
100: "#ff5722", // red-orange
75: "#ff9800", // orange
50: "#ffeb3b", // yellow
30: "#cddc39", // lime
10: "#4caf50" // green
};
const SELECTOR = "td.customfield_11429";
function colorCell(cell) {
// Extract the first standalone number from the cell, ignoring any
// surrounding markup/labels (e.g. "High (300)").
const match = cell.textContent.match(/\d+/);
if (!match) return;
const color = COLOR_MAP[parseInt(match[0], 10)];
if (!color) return;
cell.style.backgroundColor = color;
}
function colorAll(root) {
const cells =
root.nodeType === Node.ELEMENT_NODE && root.matches?.(SELECTOR)
? [root]
: [];
root.querySelectorAll?.(SELECTOR).forEach((c) => cells.push(c));
cells.forEach(colorCell);
}
// Initial pass.
colorAll(document);
// Re-apply when the page updates dynamically (e.g. AJAX-loaded tables).
const observer = new MutationObserver((mutations) => {
for (const m of mutations) {
m.addedNodes.forEach((node) => {
if (node.nodeType === Node.ELEMENT_NODE) colorAll(node);
});
}
});
observer.observe(document.body || document.documentElement, {
childList: true,
subtree: true
});
})();
Rated 0 by 0 reviewers
Permissions and data
Required permissions:
- Access your data for all websites
Data collection:
- The developer says this extension doesn't require data collection.
More information
- Add-on Links
- Version
- 1.0.0
- Size
- 8.77 KB
- Last updated
- 7 days ago (Jun 22, 2026)
- Related Categories
- License
- MIT License
- Version History
- Add to collection