From cc90d008a80212b7764971d89bef0ae5ae84e60d Mon Sep 17 00:00:00 2001 From: Emil Miler Date: Sat, 30 Jan 2021 21:04:06 +0100 Subject: [PATCH] Fix sample video and XML parser --- js/comments.js | 4 ++-- js/controller.js | 2 +- js/model.js | 4 ++-- js/view.js | 10 +++++----- videos/video.xml | 12 +++++------- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/js/comments.js b/js/comments.js index b6c1051..566efd9 100644 --- a/js/comments.js +++ b/js/comments.js @@ -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++) { diff --git a/js/controller.js b/js/controller.js index 029b431..71da2d9 100644 --- a/js/controller.js +++ b/js/controller.js @@ -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) diff --git a/js/model.js b/js/model.js index 10d6b33..fb98e6a 100644 --- a/js/model.js +++ b/js/model.js @@ -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; diff --git a/js/view.js b/js/view.js index 839745d..87ab9bf 100644 --- a/js/view.js +++ b/js/view.js @@ -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); diff --git a/videos/video.xml b/videos/video.xml index 149c2af..7ff8f59 100644 --- a/videos/video.xml +++ b/videos/video.xml @@ -3,15 +3,13 @@ 12 15 - Toto je testovací poznámka - Toto je dlouhý text, který bude zobrazen ve videu dole a bude moci obsahovat markdown - + Toto je testovací poznámka + Toto je dlouhý text, který bude zobrazen ve videu dole a bude moci obsahovat markdown 19 25 - Toto je testovací poznámka - Toto je dlouhý text, který bude zobrazen ve videu dole a bude moci obsahovat markdown - + Toto je testovací poznámka + Toto je dlouhý text, který bude zobrazen ve videu dole a bude moci obsahovat markdown - \ No newline at end of file +