Created
December 31, 2022 18:56
-
-
Save eai04191/67a219dd484141120b96c992f90e7a1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const classNames = { | |
"4b": [ | |
"table_filter_1_column_12", | |
"table_filter_1_column_13", | |
"table_filter_1_column_14", | |
"table_filter_1_column_15", | |
], | |
"5b": [ | |
"table_filter_1_column_16", | |
"table_filter_1_column_17", | |
"table_filter_1_column_18", | |
"table_filter_1_column_19", | |
], | |
"6b": [ | |
"table_filter_1_column_20", | |
"table_filter_1_column_21", | |
"table_filter_1_column_22", | |
"table_filter_1_column_23", | |
], | |
"8b": [ | |
"table_filter_1_column_24", | |
"table_filter_1_column_25", | |
"table_filter_1_column_26", | |
"table_filter_1_column_27", | |
], | |
}; | |
const td = [...document.querySelectorAll("#table_sorter_1 tbody td")]; | |
const counts = Object.keys(classNames).reduce((acc, key) => { | |
const count = td | |
.filter((e) => classNames[key].some((s) => e.className === s)) | |
.filter((e) => e.innerText !== "-").length; | |
acc[key] = count; | |
return acc; | |
}, {}); | |
console.log(counts); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment