This repository has been archived on 2026-09-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
privacy-protection/PP-binding/frontend/web/script/index.js
T
2026-04-14 18:43:35 +08:00

38 lines
1.1 KiB
JavaScript

window.onload = () => {
main()
}
function main() {
const tableContainer = document.getElementById("table-outer-scrollable-container")
const tableItems = tableContainer.children
const backgroundColor = "rgba(164,168,157,0.16)"
const addItemButton = document.getElementById("add-item-button")
const addItemDialog = document.getElementById("add-item-dialog")
const addItemDialogCloseButton = document.getElementById("add-item-dialog-close-button")
for (let i = 1; i < tableItems.length; i += 2) {
if (hasSpecificClassNameByNode(tableItems[i], "table-items-container")) {
tableItems[i].setAttribute("style", `background-color: ${backgroundColor};`)
}
}
addItemButton.addEventListener("click", () => {
addItemDialog.showModal()
})
addItemDialogCloseButton.addEventListener("click", ()=>{
addItemDialog.close()
})
}
function hasSpecificClassNameByNode(node, className) {
const classList = node.classList
let isContain = false
classList.forEach((value) => {
if (value === className) {
isContain = true
}
})
return isContain
}