Fix sample video and XML parser

master
Emil Miler 4 years ago
parent 73cbe6a8b3
commit cc90d008a8

@ -1,8 +1,8 @@
class Comment {
constructor(start, end, tittle, text) {
constructor(start, end, title, text) {
this.start = start;
this.end = end;
this.tittle = tittle;
this.title = title;
this.text = [];
for (let i = 0; i < text.length; i++) {

@ -26,7 +26,7 @@ class Controller {
init(videoToLoad) {
this.loadXml(videoToLoad).then(
function (v) {
this.view.drawCommentTittles(v);
this.view.drawCommenttitles(v);
this.addEventListeners();
this.view.drawCommentsToVideo(v);
}.bind(this)

@ -11,10 +11,10 @@ class Model {
for (let i = 0; i < comment.length; i++) {
let start = comment[i].getElementsByTagName("start")[0].innerHTML;
let end = comment[i].getElementsByTagName("end")[0].innerHTML;
let tittle = comment[i].getElementsByTagName("tittle")[0].innerHTML;
let title = comment[i].getElementsByTagName("title")[0].innerHTML;
let text = comment[i].getElementsByTagName("text");
this.comments.push(new Comment(start, end, tittle, text));
this.comments.push(new Comment(start, end, title, text));
}
return this.comments;

@ -21,7 +21,7 @@ class View {
); */
}
drawCommentTittles(comments) {
drawCommenttitles(comments) {
let aside = document.getElementsByTagName("aside")[0];
for (let i = 0; i < comments.length; i++) {
@ -49,11 +49,11 @@ class View {
comment.appendChild(time);
let commentTittle = document.createElement("div");
commentTittle.setAttribute("class", "commentText");
commentTittle.innerHTML = comments[i].tittle;
let commenttitle = document.createElement("div");
commenttitle.setAttribute("class", "commentText");
commenttitle.innerHTML = comments[i].title;
comment.appendChild(commentTittle);
comment.appendChild(commenttitle);
aside.appendChild(comment);

@ -3,15 +3,13 @@
<comment>
<start>12</start>
<end>15</end>
<text>Toto je testovací poznámka</text>
<fulltext>Toto je dlouhý text, který bude zobrazen ve videu dole a bude moci obsahovat markdown</fulltext>
<title>Toto je testovací poznámka</title>
<text>Toto je dlouhý text, který bude zobrazen ve videu dole a bude moci obsahovat markdown</text>
</comment>
<comment>
<start>19</start>
<end>25</end>
<text>Toto je testovací poznámka</text>
<fulltext>Toto je dlouhý text, který bude zobrazen ve videu dole a bude moci obsahovat markdown</fulltext>
<title>Toto je testovací poznámka</title>
<text>Toto je dlouhý text, který bude zobrazen ve videu dole a bude moci obsahovat markdown</text>
</comment>
</video>
Loading…
Cancel
Save