fix: addRescrapeSelected onclick was mangling JSON in HTML attribute — use stored window variable instead

This commit is contained in:
James 2026-03-20 00:10:37 -04:00
parent 23a009e60d
commit 8f143308bf
1 changed files with 3 additions and 2 deletions

View File

@ -403,7 +403,7 @@
+ '</label>'; + '</label>';
}); });
html += '</div>' html += '</div>'
+ '<button onclick="addRescrapeSelected(' + JSON.stringify(newPeople).replace(/</g,'\\u003c') + ')" class="mt-2 px-3 py-1.5 bg-[#c9a84c] hover:bg-[#b8973f] text-[#0a1628] font-semibold rounded-lg text-xs transition">Add selected</button>' + '<button onclick="addRescrapeSelected()" class="mt-2 px-3 py-1.5 bg-[#c9a84c] hover:bg-[#b8973f] text-[#0a1628] font-semibold rounded-lg text-xs transition">Add selected</button>'
+ '</div>'; + '</div>';
} }
if (notFound.length > 0) { if (notFound.length > 0) {
@ -422,7 +422,8 @@
window._rescrapeNewPeople = newPeople; window._rescrapeNewPeople = newPeople;
} }
function addRescrapeSelected(people) { function addRescrapeSelected() {
const people = window._rescrapeNewPeople || [];
const checked = document.querySelectorAll('.rescrape-cb:checked'); const checked = document.querySelectorAll('.rescrape-cb:checked');
checked.forEach(cb => { checked.forEach(cb => {
const p = people[parseInt(cb.dataset.idx)]; const p = people[parseInt(cb.dataset.idx)];