diff --git a/public/assets/js/showFunctions.js b/public/assets/js/showFunctions.js index 94047cd3..155404b5 100644 --- a/public/assets/js/showFunctions.js +++ b/public/assets/js/showFunctions.js @@ -1,23 +1,26 @@ -function playOrPause(video){ - if (video.paused == true) { - video.play(); - } - else{ - video.pause(); - } -} - -// if a video player is present, set the listeners -const video = document.getElementById('video-player'); -if (video) { - // add event listener for click - video.addEventListener('click', ()=> { - playOrPause(video); - }); - // add event listener for space bar - document.body.onkeyup = (event) => { - if (event.keyCode == 32) { - playOrPause(video); +const showFunctions = { + addPlayPauseToVideo: function () { + const that = this; + const video = document.getElementById('video-asset'); + if (video) { + // add event listener for click + video.addEventListener('click', ()=> { + that.playOrPause(video); + }); + // add event listener for space bar + document.body.onkeyup = (event) => { + if (event.keyCode == 32) { + that.playOrPause(video); + } + }; } - }; + }, + playOrPause: function(video){ + if (video.paused == true) { + video.play(); + } + else{ + video.pause(); + } + } } \ No newline at end of file diff --git a/views/layouts/show.handlebars b/views/layouts/show.handlebars index 5c96d323..a4d38fa0 100644 --- a/views/layouts/show.handlebars +++ b/views/layouts/show.handlebars @@ -21,9 +21,9 @@ + {{> navBar}} {{{ body }}} - diff --git a/views/layouts/showlite.handlebars b/views/layouts/showlite.handlebars index a97a6f02..19208522 100644 --- a/views/layouts/showlite.handlebars +++ b/views/layouts/showlite.handlebars @@ -17,8 +17,8 @@ {{ googleAnalytics }} - {{{ body }}} + {{{ body }}} diff --git a/views/partials/asset.handlebars b/views/partials/asset.handlebars index 15d94ed4..ed73dcdb 100644 --- a/views/partials/asset.handlebars +++ b/views/partials/asset.handlebars @@ -1,6 +1,6 @@
- +