-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
110 additions
and
27 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,56 @@ | ||
const filterPackages = () => { | ||
const trs = document.querySelectorAll('.eco-table-row'); | ||
const filter = document.querySelector('#eco-filter').value; | ||
const regex = new RegExp(filter, 'i'); | ||
const tdFound = td => regex.test(td.innerHTML); | ||
const pkgFound = childrenArr => childrenArr.some(tdFound); | ||
const toggleTrs = ({ style, children }) => { | ||
style.display = pkgFound([ | ||
...children | ||
]) ? '' : 'none' ; | ||
trs = document.querySelectorAll('.eco-table-entry'); | ||
filter = document.querySelector('#eco-filter').value; | ||
regex = new RegExp(filter, 'i'); | ||
function toggleTrs(tr) { | ||
if (regex.test(tr.innerText)) { | ||
tr.style.display = "" | ||
// tr.classList.add("grid-hiderows") | ||
} else { | ||
tr.style.display = "none" | ||
// tr.classList.remove("grid-hiderows") | ||
} | ||
}; | ||
trs.forEach(toggleTrs); | ||
} | ||
|
||
// trs = document.querySelectorAll('.eco-table-entry'); | ||
// tr = trs[0] | ||
// regex = new RegExp("oracle", 'i'); | ||
// function toggleTrs(tr) { | ||
// console.log(regex.test(tr.innerText)) | ||
// if (regex.test(tr.innerText)) { | ||
// tr.classList.add("grid-hiderows") | ||
// console.log("hid") | ||
// } else { | ||
// tr.classList.remove("grid-hiderows") | ||
// console.log("revealed") | ||
// } | ||
// } | ||
// toggleTrs2 = (tr) => { | ||
// console.log(regex.test(tr.innerText)) | ||
// // if (pkgFound([...tr.children])) { | ||
// if (regex.test(tr.innerText)) { | ||
// tr.classList.add("grid-hiderows") | ||
// } else { | ||
// tr.classList.remove("grid-hiderows") | ||
// } | ||
// }; | ||
|
||
|
||
// const filterPackages = () => { | ||
// const trs = document.querySelectorAll('.eco-table-entry'); | ||
// console.log(trs) | ||
// const filter = document.querySelector('#eco-filter').value; | ||
// const regex = new RegExp(filter, 'i'); | ||
// function pkgFound(childrenArr) { return childrenArr.some(td => regex.test(td.innerHTML)) }; | ||
// const toggleTrs = ({ style, children }) => { | ||
// console.log(children.length) | ||
// console.log(pkgFound([...children])) | ||
// style.display = pkgFound([ | ||
// ...children | ||
// ]) ? '' : 'none' ; | ||
// console.log(style) | ||
// }; | ||
// trs.forEach(toggleTrs); | ||
// } |