Drop the comment interval setting
CI / Deploy / test (push) Successful in 52s
CI / Deploy / deploy (push) Skipped

Comments on the stage are always timed by their length now, so the
selectable interval and results.commentInterval are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-09 14:18:01 +01:00
1 parent 05ff5967e3
commit 8d128095ed
7 files changed
+23 -86

No files matched your search

+11 -23
View File
@@ -297,7 +297,6 @@
* so position, pause and timer live here and survive the re-render.
*/
var Comments = {
seconds: 0,
key: null,
index: 0,
paused: false,
@@ -305,17 +304,16 @@
items: [],
node: null,
// Automatic interval: time to read the comment on the stage, within sensible bounds.
AUTO_BASE_MS: 2500,
AUTO_CHARS_PER_SECOND: 15,
AUTO_MIN_MS: 5000,
AUTO_MAX_MS: 30000,
// Time per comment: enough to read it on the stage, within sensible bounds.
BASE_MS: 2500,
CHARS_PER_SECOND: 15,
MIN_MS: 5000,
MAX_MS: 30000,
/**
* @param {Array} items comments, oldest first
* @param {number} [seconds] time per comment (slide setting), 0 = depending on its length
*/
render: function (items, seconds) {
render: function (items) {
// A different first comment means a different slide (or a reset): start over.
var key = String(items[0].id);
if (key !== Comments.key) {
@@ -323,13 +321,6 @@
Comments.index = 0;
Comments.paused = false;
}
seconds = seconds > 0 ? seconds : 0;
if (seconds !== Comments.seconds) {
// Setting changed (or another slide): apply it right away.
Comments.seconds = seconds;
clearTimeout(Comments.timer);
Comments.timer = null;
}
Comments.items = items;
Comments.index = Math.min(Comments.index, items.length - 1);
@@ -382,19 +373,16 @@
},
/**
* How long a comment stays on the stage: the fixed setting, or (automatic)
* a base time plus reading time for its length, between AUTO_MIN_MS and AUTO_MAX_MS.
* How long a comment stays on the stage: a base time plus reading time
* for its length, between MIN_MS and MAX_MS.
*
* @param {Object} item comment
* @return {number} milliseconds
*/
delay: function (item) {
if (Comments.seconds > 0) {
return Comments.seconds * 1000;
}
var length = item && item.text ? Array.from(item.text).length : 0;
var ms = Comments.AUTO_BASE_MS + length / Comments.AUTO_CHARS_PER_SECOND * 1000;
return Math.round(Math.min(Comments.AUTO_MAX_MS, Math.max(Comments.AUTO_MIN_MS, ms)));
var ms = Comments.BASE_MS + length / Comments.CHARS_PER_SECOND * 1000;
return Math.round(Math.min(Comments.MAX_MS, Math.max(Comments.MIN_MS, ms)));
},
/** (Re)start the countdown for the comment currently shown. */
@@ -553,7 +541,7 @@
]),
gauge
]);
var comments = results.comments && results.comments.length ? Comments.render(results.comments, results.commentInterval) : null;
var comments = results.comments && results.comments.length ? Comments.render(results.comments) : null;
return el('div', { class: 'scale-results' }, [average, columns, labels, comments]);
},