Skip to content

Instantly share code, notes, and snippets.

@KronicDeth
Forked from anonymous/colorCodeTag
Last active February 5, 2018 21:13
Show Gist options
  • Select an option

  • Save KronicDeth/06e035180da2df1d3d50bb9f5a0dcd0f to your computer and use it in GitHub Desktop.

Select an option

Save KronicDeth/06e035180da2df1d3d50bb9f5a0dcd0f to your computer and use it in GitHub Desktop.

Revisions

  1. KronicDeth revised this gist Feb 5, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion colorCodeTag.html
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    var cells = document.getElementsByTagName("td");// finding all the TD tags

    for (var cell of cells) {
    if (cell.classList.contains("ms-vb-title")) {
    if (!cell.classList.contains("ms-vb-title")) {
    const innerText = cell.innerText

    switch (cell.innerText) {
  2. KronicDeth revised this gist Feb 5, 2018. 2 changed files with 28 additions and 25 deletions.
    25 changes: 0 additions & 25 deletions colorCodeTag
    Original file line number Diff line number Diff line change
    @@ -1,25 +0,0 @@
    <script>
    function colorCodeTags(){
    var classTitle = document.getElementsByClassName("ms-vb-title"); // find all tags in the title column
    var colorCode = document.getElementsByTagName("td");// finding all the TD tags
    var i = 0;
    var j = 0;

    for (i = 0; i < colorCode.length; i += 1) {
    for (j = 0; j < classTitle.length; j += 1) {
    if (colorCode[i] != classTitle[j]){
    if (colorCode[i].innerText === "Blue"){
    colorCode[i].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'/>";
    } else if (colorCode[i].innerText === "Green"){
    colorCode[i].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'/>";
    } else if (colorCode[i].innerText === "Yellow"){
    colorCode[i].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'/>";
    } else if (colorCode[i].innerText === "Red"){
    colorCode[i].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'/>";
    }
    }
    }
    }
    }
    setInterval(colorCodeTags, 100);
    </script>
    28 changes: 28 additions & 0 deletions colorCodeTag.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    <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>
  3. @invalid-email-address Anonymous created this gist Feb 5, 2018.
    25 changes: 25 additions & 0 deletions colorCodeTag
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    <script>
    function colorCodeTags(){
    var classTitle = document.getElementsByClassName("ms-vb-title"); // find all tags in the title column
    var colorCode = document.getElementsByTagName("td");// finding all the TD tags
    var i = 0;
    var j = 0;

    for (i = 0; i < colorCode.length; i += 1) {
    for (j = 0; j < classTitle.length; j += 1) {
    if (colorCode[i] != classTitle[j]){
    if (colorCode[i].innerText === "Blue"){
    colorCode[i].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'/>";
    } else if (colorCode[i].innerText === "Green"){
    colorCode[i].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'/>";
    } else if (colorCode[i].innerText === "Yellow"){
    colorCode[i].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'/>";
    } else if (colorCode[i].innerText === "Red"){
    colorCode[i].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'/>";
    }
    }
    }
    }
    }
    setInterval(colorCodeTags, 100);
    </script>