Skip to content

Instantly share code, notes, and snippets.

@KronicDeth
Forked from anonymous/colorCodeTag
Last active February 5, 2018 21:13
Show Gist options
  • Save KronicDeth/06e035180da2df1d3d50bb9f5a0dcd0f to your computer and use it in GitHub Desktop.
Save KronicDeth/06e035180da2df1d3d50bb9f5a0dcd0f to your computer and use it in GitHub Desktop.
<script>
function colorCodeTags(){
var cells = document.getElementsByTagName("td");// finding all the TD tags
for (var cell of cells) {
if (!cell.classList.contains("ms-vb-title")) {
const innerText = cell.innerText
switch (cell.innerText) {
case "Blue":
cell.innerHTML = "<style>img {height: 20px; width: 20px; display: block; margin-left: auto; margin-right: auto; }</style><img src = 'https://collaboration.merck.com/sites/ngppm-uat/Style%20Library/Images/blue.png'/>";
break;
case "Green":
cell.innerHTML = "<style>img {height: 20px; width: 20px; display: block; margin-left: auto; margin-right: auto; }</style><img src = 'https://collaboration.merck.com/sites/ngppm-uat/Style%20Library/Images/Green.png'/>";
break;
case "Yellow":
cell.innerHTML = "<style>img {height: 20px; width: 20px; display: block; margin-left: auto; margin-right: auto; }</style><img src = 'https://collaboration.merck.com/sites/ngppm-uat/Style%20Library/Images/Yellow.png'/>";
break;
case "Red":
cell.innerHTML = "<style>img {height: 20px; width: 20px; display: block; margin-left: auto; margin-right: auto; }</style><img src = 'https://collaboration.merck.com/sites/ngppm-uat/Style%20Library/Images/Red.png'/>";
break;
}
}
}
}
setInterval(colorCodeTags, 100);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment