Fix sample video and XML parser

master
Emil Miler 4 years ago
parent 73cbe6a8b3
commit cc90d008a8

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

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

@ -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 tittle = comment[i].getElementsByTagName("tittle")[0].innerHTML; let title = comment[i].getElementsByTagName("title")[0].innerHTML;
let text = comment[i].getElementsByTagName("text"); 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; return this.comments;

@ -21,7 +21,7 @@ class View {
); */ ); */
} }
drawCommentTittles(comments) { drawCommenttitles(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 commentTittle = document.createElement("div"); let commenttitle = document.createElement("div");
commentTittle.setAttribute("class", "commentText"); commenttitle.setAttribute("class", "commentText");
commentTittle.innerHTML = comments[i].tittle; commenttitle.innerHTML = comments[i].title;
comment.appendChild(commentTittle); comment.appendChild(commenttitle);
aside.appendChild(comment); aside.appendChild(comment);

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

Loading…
Cancel
Save