Criticality Field Highlighter Autor: zminkobinko
Colors criticality (td.customfield_11429) cells based on their criticality number.
1 użytkownik1 użytkownik
Metadane rozszerzenia
O tym rozszerzeniu
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
});
})();
Ocenione na 0 przez 0 recenzentów
Uprawnienia i dane
Wymagane uprawnienia:
- Mieć dostęp do danych użytkownika na wszystkich stronach
Zbieranie danych:
- Autorzy tego rozszerzenia twierdzą, że nie wymaga ono zbierania danych.
Więcej informacji
- Odnośniki dodatku
- Wersja
- 1.0.0
- Rozmiar
- 8,77 KB
- Ostatnia aktualizacja
- miesiąc temu (22 cze 2026)
- Powiązane kategorie
- Licencja
- Licencja MIT
- Historia wersji
- Dodaj do kolekcji