added on click listeners on comments
This commit is contained in:
@@ -62,7 +62,9 @@ class Controller {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const seek = document.getElementById("seek");
|
const seek = document.getElementById("seek");
|
||||||
seek.addEventListener("input", this.view.videoPlayer.skipAhead);
|
seek.addEventListener("input", function() {
|
||||||
|
this.view.videoPlayer.skipAhead(seek.value);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
document.addEventListener("keyup", function (e) {
|
document.addEventListener("keyup", function (e) {
|
||||||
if (e.keyCode == 32) {
|
if (e.keyCode == 32) {
|
||||||
|
|||||||
@@ -26,12 +26,10 @@ class VideoPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Posouvání ve videu
|
// Posouvání ve videu
|
||||||
skipAhead() {
|
skipAhead(skipTo) {
|
||||||
const progressBar = document.getElementById("progress-bar");
|
const progressBar = document.getElementById("progress-bar");
|
||||||
const video = document.getElementById("video");
|
const video = document.getElementById("video");
|
||||||
|
|
||||||
let skipTo = this.value;
|
|
||||||
|
|
||||||
video.currentTime = skipTo;
|
video.currentTime = skipTo;
|
||||||
progressBar.value = skipTo;
|
progressBar.value = skipTo;
|
||||||
}
|
}
|
||||||
|
|||||||
14
js/view.js
14
js/view.js
@@ -56,6 +56,13 @@ class View {
|
|||||||
comment.appendChild(commentText);
|
comment.appendChild(commentText);
|
||||||
|
|
||||||
aside.appendChild(comment);
|
aside.appendChild(comment);
|
||||||
|
|
||||||
|
comment.addEventListener(
|
||||||
|
"click",
|
||||||
|
function () {
|
||||||
|
this.videoPlayer.skipAhead(comments[i].start);
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +87,13 @@ class View {
|
|||||||
videoComment.appendChild(img);
|
videoComment.appendChild(img);
|
||||||
|
|
||||||
videoProgress.appendChild(videoComment);
|
videoProgress.appendChild(videoComment);
|
||||||
|
|
||||||
|
videoComment.addEventListener(
|
||||||
|
"click",
|
||||||
|
function () {
|
||||||
|
this.videoPlayer.skipAhead(comments[i].start);
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user