()
| 14 | let boxMap; |
| 15 | fetchBoxes(); |
| 16 | function fetchBoxes() { |
| 17 | boxMap = new Map(); |
| 18 | const boxes = document.querySelectorAll(".boxbg"); |
| 19 | for (let box of boxes) { |
| 20 | const text = box.innerText; |
| 21 | boxMap.set(text, box); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | // rect gets the bounding box for box with text t. |
| 26 | function rect(t) { |