Skip to content

Commit

Permalink
Populate flag data in button
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuuuube committed Nov 5, 2024
1 parent 545a0d8 commit 9931698
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ext/js/display/display-anki.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,33 @@ export class DisplayAnki {
this._tagsNotification.open();
}

/**
* @param {number} i
* @param {(?import('anki').NoteInfo)[]} noteInfos
*/
_setupFlagsIndicator(i, noteInfos) {
const flagsIndicator = this._flagsIndicatorFind(i);
if (flagsIndicator === null) {
return;
}

const displayFlags = new Set();
for (const item of noteInfos) {
if (item === null) { continue; }
for (const cardInfo of item.cardsInfo) {
if (cardInfo.flags !== 0) {
displayFlags.add(cardInfo.flags);
}
}
}

if (displayFlags.size > 0) {
flagsIndicator.disabled = false;
flagsIndicator.hidden = false;
flagsIndicator.title = `Card flags: ${[...displayFlags].join(', ')}`;
}
}

/**
* @param {import('display-anki').CreateMode} mode
*/
Expand Down

0 comments on commit 9931698

Please sign in to comment.