hide already added points
This commit is contained in:
		
							parent
							
								
									dcc9265adb
								
							
						
					
					
						commit
						a0483cb07e
					
				
							
								
								
									
										39
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								main.js
									
									
									
									
									
								
							| @ -2476,27 +2476,42 @@ | |||||||
|       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) { | ||||||
|           let category = points[getCpNumberFromOption(option)].categories.find(category => category.cat_id === catId) |         let category = points[getCpNumberFromOption(option)].categories.find(category => category.cat_id === catId) | ||||||
|           if (category && category.pivot.bonus_time == "0") { |         if (category && category.pivot.bonus_time == "0") { | ||||||
|             let stage = parseInt(category.pivot.stage) |           let stage = parseInt(category.pivot.stage) | ||||||
|             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) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user