Skip to content

Commit

Permalink
✨ Automatically update card selection from input
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed May 26, 2024
1 parent 9aa8f12 commit 8d509cf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/assets/cardfoldr.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ const updateCardSelection = () => {
syncQueryParams();
}

const refreshCardSelection = async () => {
refreshRangeSelection(document.getElementById('cardSelection').value, document.getElementById('cards'), '.card');
}

const rotateImage180 = async (image) => {
const img = new Image();
img.src = image;
Expand Down Expand Up @@ -905,6 +909,10 @@ for (const element of document.getElementsByClassName("grid-definition")) {
element.addEventListener('change', async () => { await refreshGrid() });
}

for (const id of ["pageSelection", "backgroundPageSelection"]) {
document.getElementById(id).addEventListener('change', async () => { await refreshPageSelection() });
}

const onPdfChange = async (event) => {
pdf = null;
clearCards();
Expand Down Expand Up @@ -963,6 +971,10 @@ document.getElementById('refresh').addEventListener('click', async () => {
}
});

document.getElementById("cardSelection").addEventListener('change', async () => {
await refreshCardSelection();
});

document.getElementById('extractCards').addEventListener('click', async () => {
if (!pdf) {
alert("Please select a file for the cards first");
Expand Down

0 comments on commit 8d509cf

Please sign in to comment.