Oprava bugu - caste prekreslovani

closes #7 a closes #6
master
David Zálešák 3 years ago
parent d2c5282d65
commit a3d917f67c

@ -62,15 +62,21 @@ class Controller {
);
const seek = document.getElementById("seek");
seek.addEventListener("input", function() {
this.view.videoPlayer.skipAhead(seek.value);
}.bind(this));
seek.addEventListener(
"input",
function () {
this.view.videoPlayer.skipAhead(seek.value);
}.bind(this)
);
document.addEventListener("keyup", function (e) {
if (e.keyCode == 32) {
this.view.videoPlayer.togglePlay();
}
}.bind(this));
document.addEventListener(
"keyup",
function (e) {
if (e.keyCode == 32) {
this.view.videoPlayer.togglePlay();
}
}.bind(this)
);
}
async loadVideo(v) {
@ -101,16 +107,28 @@ class Controller {
for (let i = 0; i < this.model.comments.length; i++) {
if (
currentTime > this.model.comments[i].start &&
currentTime < this.model.comments[i].end
currentTime >= this.model.comments[i].start &&
currentTime <= this.model.comments[i].end
) {
this.view.activateComment(i);
this.view.activateCommentText(this.model.comments[i].fulltext);
return;
} else {
this.view.activateComment(null);
this.view.activateCommentText(null);
this.activeComment = i;
break;
}
if (i == this.model.comments.length - 1) {
this.activeComment = null;
}
}
if (this.activeComment !== this.lastActiveComment) {
this.view.activateComment(null);
this.view.activateCommentText(null);
if (this.activeComment !== null) {
this.view.activateComment(this.activeComment);
this.view.activateCommentText(
this.model.comments[this.activeComment].fulltext
);
}
}
this.lastActiveComment = this.activeComment;
}
}

Loading…
Cancel
Save