Last active
February 5, 2020 09:21
-
-
Save pioug/33d2a6a7e1ac8e5c52404cbfee11f2d6 to your computer and use it in GitHub Desktop.
Highlight Zendesk tickets based on their priority
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Zendesk Highlight | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Highlight Zendesk tickets based on their priority | |
// @author Gilles Piou | |
// @match https://bandlab.zendesk.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
"use strict"; | |
const observer = new MutationObserver(mutationRecords => { | |
mutationRecords.forEach(function(m) { | |
m.addedNodes.forEach(function(node) { | |
if (!node.innerText || node.nodeName !== "TR") { | |
return; | |
} | |
if (/\n(\s)*Urgent(\s)*\n/.test(node.innerText)) { | |
node.style.backgroundColor = "#f48fb1"; | |
} else if (/\n(\s)*High(\s)*\n/.test(node.innerText)) { | |
node.style.backgroundColor = "#ffab91"; | |
} else if (/\n(\s)*Normal(\s)*\n/.test(m.addedNodes[0].innerText)) { | |
node.style.backgroundColor = "#fff59d"; | |
} else if (/\n(\s)*Low(\s)*\n/.test(m.addedNodes[0].innerText)) { | |
node.style.backgroundColor = "#90caf9"; | |
} | |
}); | |
}); | |
}); | |
observer.observe(document.body, { | |
childList: true, | |
subtree: true | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment