hide already added points

This commit is contained in:
Zhora Shalyapin 2025-04-04 08:05:14 +00:00
parent dcc9265adb
commit a0483cb07e

25
main.js
View File

@ -2476,11 +2476,13 @@
document.querySelectorAll(`table tr:is(:nth-child(3), :nth-child(4), :nth-child(5))`).forEach(el => el.classList.add("hidden")) document.querySelectorAll(`table tr:is(:nth-child(3), :nth-child(4), :nth-child(5))`).forEach(el => el.classList.add("hidden"))
} }
function paintCpList() { async function getPointsFromSelect() {
let options = [...document.querySelectorAll(`#cps_in option`)] let options = [...document.querySelectorAll(`#cps_in option`)]
return await getPointsByField("number", options.map(option => getCpNumberFromOption(option)))
}
;(async () => { function paintCpList(points) {
let points = await getPointsByField("number", options.map(option => getCpNumberFromOption(option))) let options = [...document.querySelectorAll(`#cps_in option`)]
let catId = urlParams().get("cat_id") let catId = urlParams().get("cat_id")
for (const option of options) { for (const option of options) {
@ -2490,13 +2492,26 @@
option.style['background-color'] = stageColors[(stage - 1) % stageColors.length] option.style['background-color'] = stageColors[(stage - 1) % stageColors.length]
} }
} }
})() }
function hideAlreadyAddedPoints(points) {
let options = [...document.querySelectorAll(`#cps_avail option`)]
for (const option of options) {
if (getCpNumberFromOption(option) in points) {
option.style.display = "none"
}
}
} }
makeTextareasOneRow() makeTextareasOneRow()
hideRedundantRows() hideRedundantRows()
createPointsInpit() createPointsInpit()
paintCpList() ;(async () => {
let points = await getPointsFromSelect()
paintCpList(points)
hideAlreadyAddedPoints(points)
})()
} }
function toggleStagePageRows(rows) { function toggleStagePageRows(rows) {