diff options
| author | Jakob L. Kreuze | 2026-10-16 13:33:41 -0400 |
|---|---|---|
| committer | Jakob L. Kreuze | 2026-10-16 13:33:41 -0400 |
| commit | 5752078582767fbf9619bf3e886c2effab6de9f4 (patch) | |
| tree | 9b06e712385229ee8ff8589dcdbdd4933ecf30d7 | |
| parent | 2d1c163c68a026ace41c4bf5564164d6a9565066 (diff) | |
Add a maximum number of cards to show per session
| -rw-r--r-- | srs-anywhere-config.js | 3 | ||||
| -rw-r--r-- | srs-anywhere.js | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/srs-anywhere-config.js b/srs-anywhere-config.js index f74e674..8a38e2b 100644 --- a/srs-anywhere-config.js +++ b/srs-anywhere-config.js @@ -19,5 +19,6 @@ const SRS_ANYWHERE_CONFIG = { banner: false, bannerText: "UNCLASSIFIED", bannerColor: "#008000", - network: false + network: false, + maxCardsPerSession: null }; diff --git a/srs-anywhere.js b/srs-anywhere.js index 4efed9b..8e0af3b 100644 --- a/srs-anywhere.js +++ b/srs-anywhere.js @@ -386,6 +386,11 @@ function loadCards(data) { document.getElementById('rating-button-easy') .addEventListener('click', () => rateCard('easy')); + const maxCards = SRS_ANYWHERE_CONFIG.maxCardsPerSession; + if (maxCards !== null && maxCards > 0) { + window.maxCards = maxCards; + } + const cramEnabled = document.getElementById('cram-mode-checkbox').checked; if (cramEnabled) { @@ -396,7 +401,7 @@ function loadCards(data) { today.setHours(0, 0, 0, 0); window.cards = data.filter((card) => { return (new Date(card._scheduled)) <= today; - }); + }).slice(0, window.maxCards || data.length); } shuffleArray(window.cards); |