From ab4e8129d5c94ff96e6c85d0d2b66a04a052b4e5 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:26:15 +0800 Subject: [PATCH] TODO#139888 嚴選配對 - 文案修改 --- PAMapp/node_modules/istanbul-reports/lib/html/assets/sorter.js | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/PAMapp/node_modules/istanbul-reports/lib/html/assets/sorter.js b/PAMapp/node_modules/istanbul-reports/lib/html/assets/sorter.js index 878725e..5ab961d 100644 --- a/PAMapp/node_modules/istanbul-reports/lib/html/assets/sorter.js +++ b/PAMapp/node_modules/istanbul-reports/lib/html/assets/sorter.js @@ -23,6 +23,31 @@ return getTableHeader().querySelectorAll('th')[n]; } + function onFilterInput() { + const searchValue = document.getElementById('fileSearch').value; + const rows = document.getElementsByTagName('tbody')[0].children; + for (let i = 0; i < rows.length; i++) { + const row = rows[i]; + if ( + row.textContent + .toLowerCase() + .includes(searchValue.toLowerCase()) + ) { + row.style.display = ''; + } else { + row.style.display = 'none'; + } + } + } + + // loads the search box + function addSearchBox() { + var template = document.getElementById('filterTemplate'); + var templateClone = template.content.cloneNode(true); + templateClone.getElementById('fileSearch').oninput = onFilterInput; + template.parentElement.appendChild(templateClone); + } + // loads all columns function loadColumns() { var colNodes = getTableHeader().querySelectorAll('th'), @@ -161,6 +186,7 @@ } cols = loadColumns(); loadData(); + addSearchBox(); addSortIndicators(); enableUI(); }; -- Gitblit v1.8.0