Difference between revisions of "Generation Reports"
Jump to navigation
Jump to search
m (1 revision imported) |
(Table update preformed by bot) |
||
Line 1: | Line 1: | ||
<html> | <html> | ||
<script> | <script> | ||
+ | var entityMap = { | ||
+ | '&': '&', | ||
+ | '<': '<', | ||
+ | '>': '>', | ||
+ | '"': '"', | ||
+ | "'": ''', | ||
+ | '/': '/', | ||
+ | '`': '`', | ||
+ | '=': '=', | ||
+ | 'm': 'm', | ||
+ | 'a': 'a', | ||
+ | 'p': 'p' | ||
+ | }; | ||
+ | |||
+ | function sanitizeHtml(string) { | ||
+ | return String(string).replace(/[&<>"'`=\/]/g, function(s) { | ||
+ | return entityMap[s]; | ||
+ | }); | ||
+ | } | ||
+ | |||
var selectedButton = ''; | var selectedButton = ''; | ||
Line 7: | Line 27: | ||
}, false); | }, false); | ||
− | function hideStrat(){ | + | function hideStrat() { |
var tables = document.getElementsByClassName("wikitable sortable table"); | var tables = document.getElementsByClassName("wikitable sortable table"); | ||
− | for (const table of tables){ | + | for (const table of tables) { |
− | + | var tr = table.getElementsByTagName("tr"); | |
− | + | // console.log(th.lastChild) | |
− | + | for (var i = 0; i < tr.length; i++) { | |
− | + | // console.log(tr[i].lastChild) | |
− | + | tr[i].lastChild.style["display"] = "None" | |
− | + | } | |
} | } | ||
} | } | ||
− | function filterA(filterStringA){ | + | function filterA(filterStringA) { |
− | filterStringA = filterStringA.toLowerCase() | + | filterStringA = sanitizeHtml(filterStringA).toLowerCase(); |
var tables = document.getElementsByClassName("wikitable sortable table jquery-tablesorter"); | var tables = document.getElementsByClassName("wikitable sortable table jquery-tablesorter"); | ||
− | for (const table of tables){ | + | for (const table of tables) { |
− | + | var tr = table.getElementsByTagName("tr"); | |
− | + | var selectedValue = ""; | |
− | + | // Reset | |
− | + | for (var i = 0; i < tr.length; i++) { | |
− | + | tr[i].style.display = ""; | |
− | + | } | |
− | + | if (filterStringA == "") continue; | |
− | + | // Loop through all table rows, and hide those who don't match the search query | |
− | + | for (var i = 0; i < tr.length; i++) { | |
− | + | for (const td of tr[i].getElementsByTagName("td")) { | |
− | + | if (td) { | |
− | + | var txtValue = td.textContent.trim().toLowerCase() || td.innerText.trim().toLowerCase(); | |
− | + | if (txtValue.indexOf(filterStringA) == -1) { | |
− | + | tr[i].style.display = "none"; | |
− | + | } else { | |
− | + | tr[i].style.display = ""; | |
− | + | selectedValue = txtValue; | |
− | + | break; | |
− | + | } | |
− | |||
− | |||
− | |||
− | |||
+ | } | ||
} | } | ||
} | } | ||
− | |||
} // end for | } // end for | ||
− | + | selectedButton = filterStringA; | |
} | } | ||
− | function filterB(filterStringB){ | + | // Had to add sanitize flag for People & Process section |
− | filterStringB = filterStringB.toLowerCase(); | + | function filterB(filterStringB) { |
+ | if (filterStringB.startsWith("People ")) { | ||
+ | if(filterStringB.endsWith(" Process")){ | ||
+ | if(filterStringB.length == 16){ | ||
+ | filterStringB = filterStringB.toLowerCase(); | ||
+ | } else { | ||
+ | filterStringB = sanitizeHtml(filterStringB).toLowerCase(); | ||
+ | } | ||
+ | } else { | ||
+ | filterStringB = sanitizeHtml(filterStringB).toLowerCase(); | ||
+ | } | ||
+ | } else { | ||
+ | filterStringB = sanitizeHtml(filterStringB).toLowerCase(); | ||
+ | } | ||
+ | console.log(filterStringB); | ||
+ | |||
filterA(selectedButton); | filterA(selectedButton); | ||
var tables = document.getElementsByClassName("wikitable sortable table jquery-tablesorter"); | var tables = document.getElementsByClassName("wikitable sortable table jquery-tablesorter"); | ||
− | for (const table of tables){ | + | for (const table of tables) { |
− | + | var tr = Array.from(table.getElementsByTagName("tr")).filter(function(row) { | |
− | + | return row.style.display !== "none"; | |
− | + | }); | |
// Loop through all table rows, and hide those who don't match the search query | // Loop through all table rows, and hide those who don't match the search query | ||
− | + | for (var i = 0; i < tr.length; i++) { | |
− | + | var td = tr[i].getElementsByTagName("td")[2]; | |
− | + | if (td) { | |
− | + | var txtValue = td.textContent.trim().toLowerCase() || td.innerText.trim().toLowerCase(); | |
− | + | if (txtValue.indexOf(filterStringB) == -1) { | |
− | + | // console.log("AA"); | |
− | + | tr[i].style.display = "none"; | |
− | + | } else { | |
− | + | // console.log("NB"); | |
− | + | tr[i].style.display = ""; | |
− | + | } | |
− | + | } //end td if | |
− | + | } // end for | |
− | |||
− | |||
} | } | ||
} | } |
Revision as of 14:21, 20 December 2023
Search Reports
Strategic Focus Area