@@ -48,17 +48,19 @@ article {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
article img {
|
article img {
|
||||||
max-width: 100%;
|
max-width: 25vh;
|
||||||
max-height: 25vh;
|
max-height: 100%;
|
||||||
margin: 1em;
|
margin: 0.5em 1em;
|
||||||
}
|
padding: .2em;
|
||||||
|
clear: both;
|
||||||
article img:nth-child(odd) {
|
border: 1px solid #bbb;
|
||||||
float: right;
|
border-radius: .2rem;
|
||||||
}
|
|
||||||
|
|
||||||
article img:nth-child(even) {
|
|
||||||
float: left;
|
float: left;
|
||||||
|
clear: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
article p {
|
||||||
|
clear: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
article h1:first-child {
|
article h1:first-child {
|
||||||
@@ -69,6 +71,7 @@ h1,
|
|||||||
h2,
|
h2,
|
||||||
h3 {
|
h3 {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
clear: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
@@ -154,7 +157,7 @@ article p:last-child {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress {
|
#video-progress progress {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 0.5vh;
|
height: 0.5vh;
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
class Comment {
|
class Comment {
|
||||||
constructor(start, end, text, fulltext) {
|
constructor(start, end, tittle, text) {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
this.text = text;
|
this.tittle = tittle;
|
||||||
this.fulltext = fulltext;
|
this.text = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < text.length; i++) {
|
||||||
|
this.text.push(text[i].innerHTML);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Controller {
|
|||||||
init(videoToLoad) {
|
init(videoToLoad) {
|
||||||
this.loadXml(videoToLoad).then(
|
this.loadXml(videoToLoad).then(
|
||||||
function (v) {
|
function (v) {
|
||||||
this.view.drawCommentsText(v);
|
this.view.drawCommentTittles(v);
|
||||||
this.addEventListeners();
|
this.addEventListeners();
|
||||||
this.view.drawCommentsToVideo(v);
|
this.view.drawCommentsToVideo(v);
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
@@ -145,9 +145,17 @@ class Controller {
|
|||||||
|
|
||||||
if (this.activeComment !== null) {
|
if (this.activeComment !== null) {
|
||||||
this.view.activateComment(this.activeComment);
|
this.view.activateComment(this.activeComment);
|
||||||
this.view.activateCommentText(
|
console.log(this.model.comments[this.activeComment].text.length);
|
||||||
this.model.comments[this.activeComment].fulltext
|
|
||||||
);
|
for (
|
||||||
|
let i = 0;
|
||||||
|
i < this.model.comments[this.activeComment].text.length;
|
||||||
|
i++
|
||||||
|
) {
|
||||||
|
this.view.activateCommentText(
|
||||||
|
this.model.comments[this.activeComment].text[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.lastActiveComment = this.activeComment;
|
this.lastActiveComment = this.activeComment;
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ class Model {
|
|||||||
for (let i = 0; i < comment.length; i++) {
|
for (let i = 0; i < comment.length; i++) {
|
||||||
let start = comment[i].getElementsByTagName("start")[0].innerHTML;
|
let start = comment[i].getElementsByTagName("start")[0].innerHTML;
|
||||||
let end = comment[i].getElementsByTagName("end")[0].innerHTML;
|
let end = comment[i].getElementsByTagName("end")[0].innerHTML;
|
||||||
let text = comment[i].getElementsByTagName("text")[0].innerHTML;
|
let tittle = comment[i].getElementsByTagName("tittle")[0].innerHTML;
|
||||||
let fulltext = comment[i].getElementsByTagName("fulltext")[0].innerHTML;
|
let text = comment[i].getElementsByTagName("text");
|
||||||
|
|
||||||
this.comments.push(new Comment(start, end, text, fulltext));
|
this.comments.push(new Comment(start, end, tittle, text));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.comments;
|
return this.comments;
|
||||||
|
|||||||
19
js/view.js
19
js/view.js
@@ -21,7 +21,7 @@ class View {
|
|||||||
); */
|
); */
|
||||||
}
|
}
|
||||||
|
|
||||||
drawCommentsText(comments) {
|
drawCommentTittles(comments) {
|
||||||
let aside = document.getElementsByTagName("aside")[0];
|
let aside = document.getElementsByTagName("aside")[0];
|
||||||
|
|
||||||
for (let i = 0; i < comments.length; i++) {
|
for (let i = 0; i < comments.length; i++) {
|
||||||
@@ -49,11 +49,11 @@ class View {
|
|||||||
|
|
||||||
comment.appendChild(time);
|
comment.appendChild(time);
|
||||||
|
|
||||||
let commentText = document.createElement("div");
|
let commentTittle = document.createElement("div");
|
||||||
commentText.setAttribute("class", "commentText");
|
commentTittle.setAttribute("class", "commentText");
|
||||||
commentText.innerHTML = comments[i].text;
|
commentTittle.innerHTML = comments[i].tittle;
|
||||||
|
|
||||||
comment.appendChild(commentText);
|
comment.appendChild(commentTittle);
|
||||||
|
|
||||||
aside.appendChild(comment);
|
aside.appendChild(comment);
|
||||||
|
|
||||||
@@ -120,7 +120,14 @@ class View {
|
|||||||
activateCommentText(text) {
|
activateCommentText(text) {
|
||||||
let textArea = document.getElementsByTagName("article")[0];
|
let textArea = document.getElementsByTagName("article")[0];
|
||||||
|
|
||||||
textArea.innerHTML = text;
|
if (text == null) {
|
||||||
|
textArea.innerHTML = text;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let div = document.createElement("div");
|
||||||
|
div.innerHTML = text;
|
||||||
|
textArea.append(div);
|
||||||
}
|
}
|
||||||
|
|
||||||
commentHover(c, active = true) {
|
commentHover(c, active = true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user