{"ScriptPreparationCode":null,"TestCases":[{"Name":"New","Code":"(function() {\r\n \u0027use strict\u0027;\r\n\r\n window.DS = {};\r\n\r\n window.DS.base = function(){\r\n var _self = this;\r\n _self.id = id;\r\n _self.cl = cl;\r\n _self.childWithClass = childWithClass;\r\n _self.closestParent = getClosestParent;\r\n _self.tag = tag;\r\n _self.eAddAll = eAddAll;\r\n _self.eRmAll = eRmAll;\r\n _self.addClass = addClass;\r\n _self.removeClass = removeClass;\r\n _self.toggleClass = toggleClass;\r\n _self.query = query;\r\n _self.getElementIndex = getElementIndex;\r\n _self.getURLQueryVariables = getURLQueryVariables;\r\n _self.validateEmail = validateEmail;\r\n _self.ajax = ajax;\r\n\r\n\r\n function query(selector, context) {\r\n context = context || document;\r\n if (/^(#?[\\w-]\u002B|\\.[\\w-.]\u002B)$/.test(selector)) {\r\n switch (selector.charAt(0)) {\r\n case \u0027#\u0027:\r\n return [context.getElementById(selector.substr(1))];\r\n case \u0027.\u0027:\r\n var classes = selector.substr(1).replace(/\\./g, \u0027 \u0027);\r\n return [].slice.call(context.getElementsByClassName(classes));\r\n default:\r\n return [].slice.call(context.getElementsByTagName(selector));\r\n }\r\n }\r\n return [].slice.call(context.querySelectorAll(selector));\r\n };\r\n\r\n function getElementIndex(node) {\r\n var index = 0;\r\n while ( (node = node.previousElementSibling) ) {\r\n index\u002B\u002B;\r\n }\r\n return index;\r\n };\r\n\r\n\r\n function id (id) {\r\n return document.getElementById(id);\r\n };\r\n\r\n function cl(classname, parent) {\r\n if(parent){\r\n return parent.querySelectorAll(\u0027.\u0027 \u002B classname);\r\n }\r\n\r\n else {\r\n return document.getElementsByClassName(classname);\r\n }\r\n\r\n\r\n };\r\n\r\n function tag(tag, parent) {\r\n if(parent) {\r\n return parent.querySelectorAll(tag);\r\n }\r\n\r\n else {\r\n return document.getElementsByTagName(tag);\r\n }\r\n\r\n };\r\n\r\n function childWithClass(element, classname) {\r\n var ar = [];\r\n for (var i = 0; i \u003C element.childNodes.length; i\u002B\u002B) {\r\n if (doc.childNodes[i].className == classname) {\r\n ar.push(doc.childNodes[i]);\r\n\r\n }\r\n }\r\n };\r\n\r\n function eAddAll(object, type, listenFunction) {\r\n\r\n for(var i=0;i\u003Cobject.length;i\u002B\u002B) {\r\n object[i].addEventListener(type, listenFunction);\r\n }\r\n };\r\n\r\n function eRmAll(object, type, listenFunction) {\r\n for(var i=0;i\u003Cobject.length;i\u002B\u002B) {\r\n object[i].addEventListener(type, listenFunction);\r\n }\r\n };\r\n\r\n function addClass(element, classname) {\r\n if(element.length) {\r\n for(var i=0;i\u003Celement.length;i\u002B\u002B) {\r\n element[i].classList.add(classname);\r\n }\r\n }\r\n\r\n else {\r\n element.classList.add(classname);\r\n }\r\n };\r\n\r\n function removeClass(element, classname) {\r\n\r\n if(element.length) {\r\n for(var i=0;i\u003Celement.length;i\u002B\u002B) {\r\n element[i].classList.remove(classname);\r\n }\r\n }\r\n\r\n else {\r\n element.classList.remove(classname);\r\n }\r\n\r\n\r\n };\r\n\r\n\r\n function toggleClass(element, classname) {\r\n if(element.length) {\r\n for(var i=0;i\u003Celement.length;i\u002B\u002B) {\r\n\r\n if(element[i].classList.contains(classname)) {\r\n element[i].classList.remove(classname);\r\n }\r\n\r\n else {\r\n element[i].classList.add(classname);\r\n }\r\n\r\n }\r\n }\r\n\r\n else {\r\n if(element.classList.contains(classname)) {\r\n element.classList.remove(classname);\r\n }\r\n\r\n else {\r\n element.classList.add(classname);\r\n }\r\n\r\n }\r\n };\r\n\r\n function getClosestParent ( elem, selector ) {\r\n\r\n // Element.matches() polyfill\r\n if (!Element.prototype.matches) {\r\n Element.prototype.matches =\r\n Element.prototype.matchesSelector ||\r\n Element.prototype.mozMatchesSelector ||\r\n Element.prototype.msMatchesSelector ||\r\n Element.prototype.oMatchesSelector ||\r\n Element.prototype.webkitMatchesSelector ||\r\n function(s) {\r\n var matches = (this.document || this.ownerDocument).querySelectorAll(s),\r\n i = matches.length;\r\n while (--i \u003E= 0 \u0026\u0026 matches.item(i) !== this) {}\r\n return i \u003E -1;\r\n };\r\n }\r\n\r\n // Get closest match\r\n for ( ; elem \u0026\u0026 elem !== document; elem = elem.parentNode ) {\r\n if ( elem.matches( selector ) ) return elem;\r\n }\r\n\r\n return null;\r\n\r\n };\r\n\r\n function getURLQueryVariables(qstr) {\r\n\r\n qstr = qstr.split(\u0027?\u0027);\r\n qstr = qstr[1];\r\n\r\n var query = {};\r\n var a = (qstr[0] === \u0027?\u0027 ? qstr.substr(1) : qstr).split(\u0027\u0026\u0027);\r\n for (var i = 0; i \u003C a.length; i\u002B\u002B) {\r\n var b = a[i].split(\u0027=\u0027);\r\n query[decodeURIComponent(b[0])] = decodeURIComponent(b[1] || \u0027\u0027);\r\n }\r\n return query;\r\n };\r\n\r\n function validateEmail(email) {\r\n var re = /^(([^\u003C\u003E()\\[\\]\\\\.,;:\\s@\u0022]\u002B(\\.[^\u003C\u003E()\\[\\]\\\\.,;:\\s@\u0022]\u002B)*)|(\u0022.\u002B\u0022))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]\u002B\\.)\u002B[a-zA-Z]{2,}))$/;\r\n return re.test(email);\r\n }\r\n\r\n function ajax(type, endpoint, data, callback) {\r\n var xhr = new XMLHttpRequest();\r\n var url = endpoint \u002B \u0022?data=\u0022 \u002B encodeURIComponent(JSON.stringify(data/*{\u0022form_key\u0022: \u0022form_keyValue\u0022, \u0022password\u0022: \u0022101010\u0022}*/));\r\n xhr.open(type, url, true);\r\n xhr.setRequestHeader(\u0022Content-type\u0022, \u0022application/json\u0022);\r\n xhr.onreadystatechange = function () {\r\n if (xhr.readyState === 4 \u0026\u0026 xhr.status === 200) {\r\n var json = JSON.parse(xhr.responseText);\r\n console.log(json);\r\n return callback(json);\r\n }\r\n };\r\n xhr.send();\r\n };\r\n\r\n\r\n\r\n\r\n\r\n\r\n };\r\n\r\n\r\n\r\n // document.addEventListener(\u0022DOMContentLoaded\u0022, function(event) {\r\n // console.log(\u0022base.js - DOM loaded and parsed\u0022);\r\n // });\r\n\r\n})();\r\n\r\n\r\nvar onYouTubeIframeAPIReady;\r\n(function() {\r\n \u0027use strict\u0027;\r\n\r\n //Required base functions\r\n var base = new DS.base,\r\n query = base.query,\r\n id = base.id,\r\n cl = base.cl,\r\n tag = base.tag,\r\n eAddAll = base.eAddAll,\r\n eRmAll = base.eRmAll,\r\n addClass = base.addClass,\r\n removeClass = base.removeClass,\r\n toggleClass = base.toggleClass,\r\n getURLQueryVariables = base.getURLQueryVariables;\r\n\r\n\r\n window.DS.video = function() {\r\n var self = this,\r\n videoBtns = cl(\u0027cta-video\u0027);\r\n\r\n\r\n\r\n var videoModalHTML;\r\n videoModalHTML \u002B=\u0027\u003Cdiv id=\u0022video-modal\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022bk\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022player\u0022 id=\u0022plaer\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Ca href=\u0022\u0022 title=\u0022close\u0022 class=\u0022close\u0022\u003EClose\u003C/a\u003E\u0027\r\n videoModalHTML \u002B=\u0027 \u003Cdiv id=\u0022video-container\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022controls\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022playpause\u0022 title=\u0022Play/Pause\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cspan class=\u0022play\u0022\u003E\u003C/span\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cspan class=\u0022pause\u0022\u003E\u003C/span\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022progress\u0022 title=\u0022Video Progress\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cspan class=\u0022progress-time\u0022\u003E\u003Cspan class=\u0022progress-time-value\u0022\u003E0:00\u003C/span\u003E\u003C/span\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022progress-bar-wrapper\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cprogress class=\u0022progress-bar\u0022 value=\u00220\u0022 max=\u0022100\u0022\u003E\u003C/progress\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cspan class=\u0022total-time\u0022\u003E\u003Cspan class=\u0022progress-total-value\u0022\u003E0:00\u003C/span\u003E\u003C/span\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022volume\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022on-off-region\u0022 title=\u0022Volume on/off\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022level-region\u0022 data-vol=\u0022100\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022bar-1 volume-bar\u0022 title=\u0022Volume 33%\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022bar-2 volume-bar\u0022 title=\u0022Volume 66%\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022bar-3 volume-bar\u0022 title=\u0022Volume 100%\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022fullscreen\u0022 title=\u0022View fullscreen\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-container\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-tl\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-tr\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-bl\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-br\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n\r\n //console.log(videoModalHTML);\r\n\r\n init();\r\n\r\n function init() {\r\n _checkforVideos();\r\n\r\n }\r\n\r\n function _checkforVideos() {\r\n var ctas = query(\u0027.cta-video\u0027);\r\n\r\n if(ctas.length) {\r\n _initializeAPI();\r\n _listen();\r\n }\r\n\r\n\r\n };\r\n\r\n function _listen() {\r\n eAddAll(videoBtns, \u0027click\u0027, _buildVideoPlayer)\r\n }\r\n\r\n function _initializeAPI() {\r\n var tag = document.createElement(\u0027script\u0027),\r\n firstScriptTag = document.getElementsByTagName(\u0027script\u0027)[0];\r\n\r\n tag.setAttribute(\u0027id\u0027, \u0027youtube-scripts\u0027);\r\n tag.src = \u0022https://www.youtube.com/iframe_api\u0022;\r\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\r\n };\r\n\r\n function _buildVideoPlayer(e) {\r\n e.preventDefault();\r\n\r\n var _this = this,\r\n videoURL = _this.getAttribute(\u0027data-video\u0027),\r\n queryObject = getURLQueryVariables(videoURL),\r\n videoID = queryObject.v,\r\n player,\r\n videoProgressInterval,\r\n videoDuration,\r\n videoLength,\r\n curPercentage = 0;\r\n\r\n\r\n document.getElementById(\u0027vp-wrap\u0027).insertAdjacentHTML( \u0027beforeend\u0027, videoModalHTML );\r\n afterModalAppended();\r\n\r\n\r\n function afterModalAppended() {\r\n\r\n var videoModal = id(\u0027video-modal\u0027),\r\n closeBTN = query(\u0027.close\u0027, videoModal),\r\n playpauseBTN = query(\u0027.playpause\u0027, videoModal),\r\n curDurationHTML = query(\u0027.progress-time-value\u0027, videoModal),\r\n totalDurationHTML = query(\u0027.progress-total-value\u0027, videoModal),\r\n progressBarWrapper = query(\u0027.progress-bar-wrapper\u0027, videoModal),\r\n progressBar = query(\u0027.progress-bar\u0027, videoModal),\r\n soundOnOff = query(\u0027.on-off-region\u0027, videoModal),\r\n levelRegion = query(\u0027.level-region\u0027, videoModal),\r\n levelBars = query(\u0027.volume-bar\u0027, videoModal),\r\n videoPlayer = id(\u0027plaer\u0027),\r\n iframeButton = query(\u0027.fullscreen\u0027);\r\n\r\n _createPlayer();\r\n\r\n function secToMinute(s){return(s-(s%=60))/60\u002B(9\u003Cs?\u0027:\u0027:\u0027:0\u0027)\u002Bs}\r\n\r\n function videoPlayerListeners() {\r\n closeBTN[0].addEventListener(\u0027click\u0027, _closeVideoModal);\r\n playpauseBTN[0].addEventListener(\u0027click\u0027, _playPauseVideo);\r\n progressBarWrapper[0].addEventListener(\u0027click\u0027, _updateProgress);\r\n soundOnOff[0].addEventListener(\u0027click\u0027, _toggleSound);\r\n eAddAll(levelBars, \u0027click\u0027, _updateLevelByBar);\r\n iframeButton[0].addEventListener(\u0027click\u0027, _triggerFullscreen);\r\n };\r\n\r\n\r\n function _closeVideoModal(e) {\r\n e.preventDefault();\r\n\r\n closeBTN[0].removeEventListener(\u0027click\u0027, _closeVideoModal);\r\n playpauseBTN[0].removeEventListener(\u0027click\u0027, _playPauseVideo);\r\n progressBarWrapper[0].removeEventListener(\u0027click\u0027, _updateProgress);\r\n soundOnOff[0].removeEventListener(\u0027click\u0027, _toggleSound);\r\n eRmAll(levelBars, \u0027click\u0027, _updateLevelByBar);\r\n iframeButton[0].removeEventListener(\u0027click\u0027, _triggerFullscreen);\r\n\r\n clearInterval(videoProgressInterval);\r\n videoProgressInterval = null;\r\n\r\n player.destroy();\r\n\r\n id(\u0027vp-wrap\u0027).removeChild(videoModal);\r\n\r\n\r\n return false;\r\n };\r\n\r\n\r\n function _playPauseVideo(e) {\r\n e.preventDefault();\r\n\r\n var playerState = player.getPlayerState();\r\n\r\n switch(playerState) {\r\n case 1:\r\n player.pauseVideo();\r\n break;\r\n case 2:\r\n player.playVideo();\r\n break;\r\n }\r\n\r\n return false;\r\n };\r\n\r\n function _updateProgress(e) {\r\n var _this = this,\r\n percentage = e.offsetX/_this.offsetWidth;\r\n\r\n player.seekTo(player.getDuration() * percentage);\r\n\r\n };\r\n\r\n function _toggleSound(e) {\r\n var _this = this,\r\n curVol = player.getVolume();\r\n\r\n if(curVol\u003E0) {\r\n player.setVolume(0);\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 0);\r\n }\r\n\r\n else {\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 100);\r\n player.setVolume(100);\r\n }\r\n\r\n };\r\n\r\n\r\n function _updateLevelByBar(e) {\r\n var _this = this;\r\n\r\n\r\n if(_this.classList.contains(\u0027bar-1\u0027)) {\r\n player.setVolume(33);\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 33);\r\n }\r\n\r\n else if(_this.classList.contains(\u0027bar-2\u0027)) {\r\n player.setVolume(66);\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 66);\r\n }\r\n\r\n else if(_this.classList.contains(\u0027bar-3\u0027)) {\r\n player.setVolume(100);\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 100);\r\n }\r\n };\r\n\r\n\r\n\r\n function _triggerFullscreen(e) {\r\n var iframe = videoPlayer;\r\n var requestFullScreen = iframe.requestFullScreen || iframe.mozRequestFullScreen || iframe.webkitRequestFullScreen || iframe.msRequestFullscreen;\r\n var exitFullScreen = iframe.exitFullscreen || iframe.webkitExitFullscreen || iframe.mozCancelFullScreen || iframe.msExitFullscreen;\r\n var fullscreenEnabled = iframe.fullscreenEnabled || iframe.webkitFullscreenEnabled || iframe.mozFullScreenEnabled || iframe.msFullscreenEnabled;\r\n var docFS = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;\r\n\r\n //iframe.classList.contains(\u0027fullscreen\u0027) ? isFS = true : isFS = false;\r\n\r\n iframe.addEventListener(\u0022fullscreenchange\u0022, fullScreenOnEsc);\r\n iframe.addEventListener(\u0022webkitfullscreenchange\u0022, fullScreenOnEsc);\r\n iframe.addEventListener(\u0022mozfullscreenchange\u0022, fullScreenOnEsc);\r\n iframe.addEventListener(\u0022MSFullscreenChange\u0022, fullScreenOnEsc);\r\n\r\n if(document.fullscreenElement ||\r\n document.webkitFullscreenElement ||\r\n document.mozFullScreenElement ||\r\n document.msFullscreenElement) {\r\n\r\n if (document.exitFullscreen) {\r\n document.exitFullscreen();\r\n } else if (document.webkitExitFullscreen) {\r\n document.webkitExitFullscreen();\r\n } else if (document.mozCancelFullScreen) {\r\n document.mozCancelFullScreen();\r\n } else if (document.msExitFullscreen) {\r\n document.msExitFullscreen();\r\n }\r\n\r\n\r\n\r\n }\r\n\r\n else {\r\n if (requestFullScreen) {\r\n requestFullScreen.bind(iframe)();\r\n //console.log(\u0027enter click\u0027);\r\n }\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n function fullScreenOnEsc() {\r\n\r\n\r\n if(document.fullscreenElement ||\r\n document.webkitFullscreenElement ||\r\n document.mozFullScreenElement ||\r\n document.msFullscreenElement) {\r\n addClass(iframe, \u0027fullscreen\u0027);\r\n }\r\n\r\n else {\r\n removeClass(iframe, \u0027fullscreen\u0027);\r\n }\r\n };\r\n\r\n\r\n\r\n };\r\n\r\n\r\n\r\n function _createPlayer() {\r\n player = new YT.Player(\u0027video-container\u0027, {\r\n height: \u0027100%\u0027,\r\n width: \u0027100%\u0027,\r\n videoId: videoID,\r\n playerVars: {\r\n controls:0,\r\n enablejsapi:1,\r\n modestbranding:1,\r\n showinfo:0,\r\n rel: 0\r\n },\r\n events: {\r\n \u0027onReady\u0027: onPlayerReady,\r\n \u0027onStateChange\u0027: onPlayerStateChange\r\n }\r\n });\r\n }\r\n\r\n function onPlayerReady(event) {\r\n\r\n videoPlayerListeners();\r\n videoLength = secToMinute(player.getDuration());\r\n totalDurationHTML[0].innerHTML = videoLength;\r\n event.target.playVideo();\r\n\r\n }\r\n\r\n\r\n function onPlayerStateChange(event) {\r\n\r\n\r\n\r\n switch(event.data) {\r\n case 0:\r\n //ENDED\r\n removeClass(playpauseBTN, \u0027playing\u0027);\r\n clearInterval(videoProgressInterval);\r\n videoProgressInterval = null;\r\n break;\r\n case 1:\r\n //PLAYING\r\n addClass(playpauseBTN, \u0027playing\u0027);\r\n videoProgressInterval = setInterval(_checkVideoProgress, 500);\r\n break;\r\n case 2:\r\n //PAUSED\r\n removeClass(playpauseBTN, \u0027playing\u0027);\r\n clearInterval(videoProgressInterval);\r\n videoProgressInterval = null;\r\n break;\r\n case 3:\r\n //BUFFERING\r\n break;\r\n case -1:\r\n //UNSTARTED\r\n break;\r\n case 5:\r\n //CUED\r\n break;\r\n }\r\n }\r\n\r\n\r\n function _checkVideoProgress() {\r\n var curTime = secToMinute(Math.floor(player.getCurrentTime())),\r\n totalPercentage = Math.ceil((player.getCurrentTime()/player.getDuration())*100);\r\n\r\n curDurationHTML[0].innerHTML = curTime;\r\n\r\n if(curPercentage!==totalPercentage) {\r\n curPercentage = totalPercentage;\r\n progressBar[0].setAttribute(\u0027value\u0027, curPercentage);\r\n }\r\n\r\n\r\n }\r\n };\r\n\r\n\r\n\r\n return false;\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n };\r\n\r\n //$ using jQuery, pass jQuery to function above - (function($) { - below - })(jQuery);\r\n //$(document).ready(function() {\r\n\r\n document.addEventListener(\u0022DOMContentLoaded\u0022, function(event) {\r\n console.log(\u0022video.js - DOM loaded and parsed\u0022);\r\n var dsObject = new window.DS.video();\r\n\r\n });\r\n\r\n //});\r\n\r\n})();\r\n\r\n\r\n","IsDeferred":false},{"Name":"Define","Code":"(function() {\r\n \u0027use strict\u0027;\r\n\r\n window.DS = {};\r\n\r\n\r\n define(getPropValue, \u0027base\u0027);\r\n define(id, \u0027id\u0027);\r\n define(cl, \u0027cl\u0027);\r\n define(childWithClass, \u0027childWithClass\u0027);\r\n define(getClosestParent, \u0027closestParent\u0027);\r\n define(tag, \u0027tag\u0027);\r\n define(eAddAll, \u0027eAddAll\u0027);\r\n define(eRmAll, \u0027eRmAll\u0027);\r\n define(addClass, \u0027addClass\u0027);\r\n define(removeClass, \u0027removeClass\u0027);\r\n define(toggleClass, \u0027toggleClass\u0027);\r\n define(query, \u0027query\u0027);\r\n define(getElementIndex, \u0027getElementIndex\u0027);\r\n define(getURLQueryVariables, \u0027getURLQueryVariables\u0027);\r\n define(validateEmail, \u0027validateEmail\u0027);\r\n define(ajax, \u0027ajax\u0027);\r\n define(debounce, \u0027debounce\u0027);\r\n\r\n\r\n function getPropValue(name) {\r\n return Object.getOwnPropertyDescriptor(window.DS, name).value;\r\n };\r\n\r\n function define(func, name) {\r\n return Object.defineProperty(window.DS, name, {\r\n value:func,\r\n enumerable: false,\r\n writable: false,\r\n configurable: false\r\n });\r\n };\r\n\r\n function query(selector, context) {\r\n context = context || document;\r\n if (/^(#?[\\w-]\u002B|\\.[\\w-.]\u002B)$/.test(selector)) {\r\n switch (selector.charAt(0)) {\r\n case \u0027#\u0027:\r\n return [context.getElementById(selector.substr(1))];\r\n case \u0027.\u0027:\r\n var classes = selector.substr(1).replace(/\\./g, \u0027 \u0027);\r\n return [].slice.call(context.getElementsByClassName(classes));\r\n default:\r\n return [].slice.call(context.getElementsByTagName(selector));\r\n }\r\n }\r\n return [].slice.call(context.querySelectorAll(selector));\r\n };\r\n\r\n function getElementIndex(node) {\r\n var index = 0;\r\n while ( (node = node.previousElementSibling) ) {\r\n index\u002B\u002B;\r\n }\r\n return index;\r\n };\r\n\r\n\r\n function id(id) {\r\n return document.getElementById(id);\r\n };\r\n\r\n function cl(classname, parent) {\r\n if(parent){\r\n return parent.querySelectorAll(\u0027.\u0027 \u002B classname);\r\n }\r\n\r\n else {\r\n return document.getElementsByClassName(classname);\r\n }\r\n\r\n\r\n };\r\n\r\n function tag(tag, parent) {\r\n if(parent) {\r\n return parent.querySelectorAll(tag);\r\n }\r\n\r\n else {\r\n return document.getElementsByTagName(tag);\r\n }\r\n\r\n };\r\n\r\n function childWithClass(element, classname) {\r\n var ar = [];\r\n for (var i = 0; i \u003C element.childNodes.length; i\u002B\u002B) {\r\n if (doc.childNodes[i].className == classname) {\r\n ar.push(doc.childNodes[i]);\r\n\r\n }\r\n }\r\n };\r\n\r\n function eAddAll(object, type, listenFunction) {\r\n\r\n for(var i=0;i\u003Cobject.length;i\u002B\u002B) {\r\n object[i].addEventListener(type, listenFunction);\r\n }\r\n };\r\n\r\n function eRmAll(object, type, listenFunction) {\r\n for(var i=0;i\u003Cobject.length;i\u002B\u002B) {\r\n object[i].addEventListener(type, listenFunction);\r\n }\r\n };\r\n\r\n function addClass(element, classname) {\r\n if(element.length) {\r\n for(var i=0;i\u003Celement.length;i\u002B\u002B) {\r\n element[i].classList.add(classname);\r\n }\r\n }\r\n\r\n else {\r\n element.classList.add(classname);\r\n }\r\n };\r\n\r\n function removeClass(element, classname) {\r\n\r\n if(element.length) {\r\n for(var i=0;i\u003Celement.length;i\u002B\u002B) {\r\n element[i].classList.remove(classname);\r\n }\r\n }\r\n\r\n else {\r\n element.classList.remove(classname);\r\n }\r\n\r\n\r\n };\r\n\r\n\r\n function toggleClass(element, classname) {\r\n if(element.length) {\r\n for(var i=0;i\u003Celement.length;i\u002B\u002B) {\r\n\r\n if(element[i].classList.contains(classname)) {\r\n element[i].classList.remove(classname);\r\n }\r\n\r\n else {\r\n element[i].classList.add(classname);\r\n }\r\n\r\n }\r\n }\r\n\r\n else {\r\n if(element.classList.contains(classname)) {\r\n element.classList.remove(classname);\r\n }\r\n\r\n else {\r\n element.classList.add(classname);\r\n }\r\n\r\n }\r\n };\r\n\r\n function getClosestParent ( elem, selector ) {\r\n\r\n // Element.matches() polyfill\r\n if (!Element.prototype.matches) {\r\n Element.prototype.matches =\r\n Element.prototype.matchesSelector ||\r\n Element.prototype.mozMatchesSelector ||\r\n Element.prototype.msMatchesSelector ||\r\n Element.prototype.oMatchesSelector ||\r\n Element.prototype.webkitMatchesSelector ||\r\n function(s) {\r\n var matches = (this.document || this.ownerDocument).querySelectorAll(s),\r\n i = matches.length;\r\n while (--i \u003E= 0 \u0026\u0026 matches.item(i) !== this) {}\r\n return i \u003E -1;\r\n };\r\n }\r\n\r\n // Get closest match\r\n for ( ; elem \u0026\u0026 elem !== document; elem = elem.parentNode ) {\r\n if ( elem.matches( selector ) ) return elem;\r\n }\r\n\r\n return null;\r\n\r\n };\r\n\r\n function getURLQueryVariables(qstr) {\r\n\r\n qstr = qstr.split(\u0027?\u0027);\r\n qstr = qstr[1];\r\n\r\n var query = {};\r\n var a = (qstr[0] === \u0027?\u0027 ? qstr.substr(1) : qstr).split(\u0027\u0026\u0027);\r\n for (var i = 0; i \u003C a.length; i\u002B\u002B) {\r\n var b = a[i].split(\u0027=\u0027);\r\n query[decodeURIComponent(b[0])] = decodeURIComponent(b[1] || \u0027\u0027);\r\n }\r\n return query;\r\n };\r\n\r\n function validateEmail(email) {\r\n var re = /^(([^\u003C\u003E()\\[\\]\\\\.,;:\\s@\u0022]\u002B(\\.[^\u003C\u003E()\\[\\]\\\\.,;:\\s@\u0022]\u002B)*)|(\u0022.\u002B\u0022))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]\u002B\\.)\u002B[a-zA-Z]{2,}))$/;\r\n return re.test(email);\r\n }\r\n\r\n function ajax(type, endpoint, data, callback) {\r\n var xhr = new XMLHttpRequest();\r\n var url = endpoint \u002B \u0022?data=\u0022 \u002B encodeURIComponent(JSON.stringify(data/*{\u0022form_key\u0022: \u0022form_keyValue\u0022, \u0022password\u0022: \u0022101010\u0022}*/));\r\n xhr.open(type, url, true);\r\n xhr.setRequestHeader(\u0022Content-type\u0022, \u0022application/json\u0022);\r\n xhr.onreadystatechange = function () {\r\n if (xhr.readyState === 4 \u0026\u0026 xhr.status === 200) {\r\n var json = JSON.parse(xhr.responseText);\r\n console.log(json);\r\n return callback(json);\r\n }\r\n };\r\n xhr.send();\r\n };\r\n\r\n function debounce(func, wait, immediate) {\r\n var timeout;\r\n return function() {\r\n var context = this, args = arguments;\r\n var later = function() {\r\n timeout = null;\r\n if (!immediate) func.apply(context, args);\r\n };\r\n var callNow = immediate \u0026\u0026 !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if (callNow) func.apply(context, args);\r\n };\r\n };\r\n\r\n\r\n\r\n\r\n})();\r\n\r\n\r\n\r\nvar onYouTubeIframeAPIReady;\r\n(function() {\r\n \u0027use strict\u0027;\r\n\r\n //Required base functions\r\n var base = Object.getOwnPropertyDescriptor(window.DS, \u0027base\u0027).value,\r\n query = base(\u0027query\u0027),\r\n id = base(\u0027id\u0027),\r\n cl = base(\u0027cl\u0027),\r\n tag = base(\u0027tag\u0027),\r\n eAddAll = base(\u0027eAddAll\u0027),\r\n eRmAll = base(\u0027eRmAll\u0027),\r\n addClass = base(\u0027addClass\u0027),\r\n removeClass = base(\u0027removeClass\u0027),\r\n toggleClass = base(\u0027toggleClass\u0027),\r\n getURLQueryVariables = base(\u0027getURLQueryVariables\u0027);\r\n\r\n\r\n window.DS.video = function() {\r\n var self = this,\r\n videoBtns = cl(\u0027cta-video\u0027);\r\n\r\n\r\n\r\n var videoModalHTML;\r\n videoModalHTML \u002B=\u0027\u003Cdiv id=\u0022video-modal\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022bk\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022player\u0022 id=\u0022plaer\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Ca href=\u0022\u0022 title=\u0022close\u0022 class=\u0022close\u0022\u003EClose\u003C/a\u003E\u0027\r\n videoModalHTML \u002B=\u0027 \u003Cdiv id=\u0022video-container\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022controls\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022playpause\u0022 title=\u0022Play/Pause\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cspan class=\u0022play\u0022\u003E\u003C/span\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cspan class=\u0022pause\u0022\u003E\u003C/span\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022progress\u0022 title=\u0022Video Progress\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cspan class=\u0022progress-time\u0022\u003E\u003Cspan class=\u0022progress-time-value\u0022\u003E0:00\u003C/span\u003E\u003C/span\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022progress-bar-wrapper\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cprogress class=\u0022progress-bar\u0022 value=\u00220\u0022 max=\u0022100\u0022\u003E\u003C/progress\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cspan class=\u0022total-time\u0022\u003E\u003Cspan class=\u0022progress-total-value\u0022\u003E0:00\u003C/span\u003E\u003C/span\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022volume\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022on-off-region\u0022 title=\u0022Volume on/off\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022level-region\u0022 data-vol=\u0022100\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022bar-1 volume-bar\u0022 title=\u0022Volume 33%\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022bar-2 volume-bar\u0022 title=\u0022Volume 66%\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022bar-3 volume-bar\u0022 title=\u0022Volume 100%\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022fullscreen\u0022 title=\u0022View fullscreen\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-container\u0022\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-tl\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-tr\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-bl\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003Cdiv class=\u0022region-br\u0022\u003E\u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n videoModalHTML \u002B=\u0027 \u003C/div\u003E\u0027;\r\n\r\n //console.log(videoModalHTML);\r\n\r\n init();\r\n\r\n function init() {\r\n _checkforVideos();\r\n\r\n }\r\n\r\n function _checkforVideos() {\r\n var ctas = query(\u0027.cta-video\u0027);\r\n\r\n if(ctas.length) {\r\n _initializeAPI();\r\n _listen();\r\n }\r\n\r\n\r\n };\r\n\r\n function _listen() {\r\n eAddAll(videoBtns, \u0027click\u0027, _buildVideoPlayer)\r\n }\r\n\r\n function _initializeAPI() {\r\n var tag = document.createElement(\u0027script\u0027),\r\n firstScriptTag = document.getElementsByTagName(\u0027script\u0027)[0];\r\n\r\n tag.setAttribute(\u0027id\u0027, \u0027youtube-scripts\u0027);\r\n tag.src = \u0022https://www.youtube.com/iframe_api\u0022;\r\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\r\n };\r\n\r\n function _buildVideoPlayer(e) {\r\n e.preventDefault();\r\n\r\n var _this = this,\r\n videoURL = _this.getAttribute(\u0027data-video\u0027),\r\n queryObject = getURLQueryVariables(videoURL),\r\n videoID = queryObject.v,\r\n player,\r\n videoProgressInterval,\r\n videoDuration,\r\n videoLength,\r\n curPercentage = 0;\r\n\r\n\r\n document.getElementById(\u0027vp-wrap\u0027).insertAdjacentHTML( \u0027beforeend\u0027, videoModalHTML );\r\n afterModalAppended();\r\n\r\n\r\n function afterModalAppended() {\r\n\r\n var videoModal = id(\u0027video-modal\u0027),\r\n closeBTN = query(\u0027.close\u0027, videoModal),\r\n playpauseBTN = query(\u0027.playpause\u0027, videoModal),\r\n curDurationHTML = query(\u0027.progress-time-value\u0027, videoModal),\r\n totalDurationHTML = query(\u0027.progress-total-value\u0027, videoModal),\r\n progressBarWrapper = query(\u0027.progress-bar-wrapper\u0027, videoModal),\r\n progressBar = query(\u0027.progress-bar\u0027, videoModal),\r\n soundOnOff = query(\u0027.on-off-region\u0027, videoModal),\r\n levelRegion = query(\u0027.level-region\u0027, videoModal),\r\n levelBars = query(\u0027.volume-bar\u0027, videoModal),\r\n videoPlayer = id(\u0027plaer\u0027),\r\n iframeButton = query(\u0027.fullscreen\u0027);\r\n\r\n _createPlayer();\r\n\r\n function secToMinute(s){return(s-(s%=60))/60\u002B(9\u003Cs?\u0027:\u0027:\u0027:0\u0027)\u002Bs}\r\n\r\n function videoPlayerListeners() {\r\n closeBTN[0].addEventListener(\u0027click\u0027, _closeVideoModal);\r\n playpauseBTN[0].addEventListener(\u0027click\u0027, _playPauseVideo);\r\n progressBarWrapper[0].addEventListener(\u0027click\u0027, _updateProgress);\r\n soundOnOff[0].addEventListener(\u0027click\u0027, _toggleSound);\r\n eAddAll(levelBars, \u0027click\u0027, _updateLevelByBar);\r\n iframeButton[0].addEventListener(\u0027click\u0027, _triggerFullscreen);\r\n };\r\n\r\n\r\n function _closeVideoModal(e) {\r\n e.preventDefault();\r\n\r\n closeBTN[0].removeEventListener(\u0027click\u0027, _closeVideoModal);\r\n playpauseBTN[0].removeEventListener(\u0027click\u0027, _playPauseVideo);\r\n progressBarWrapper[0].removeEventListener(\u0027click\u0027, _updateProgress);\r\n soundOnOff[0].removeEventListener(\u0027click\u0027, _toggleSound);\r\n eRmAll(levelBars, \u0027click\u0027, _updateLevelByBar);\r\n iframeButton[0].removeEventListener(\u0027click\u0027, _triggerFullscreen);\r\n\r\n clearInterval(videoProgressInterval);\r\n videoProgressInterval = null;\r\n\r\n player.destroy();\r\n\r\n id(\u0027vp-wrap\u0027).removeChild(videoModal);\r\n\r\n\r\n return false;\r\n };\r\n\r\n\r\n function _playPauseVideo(e) {\r\n e.preventDefault();\r\n\r\n var playerState = player.getPlayerState();\r\n\r\n switch(playerState) {\r\n case 1:\r\n player.pauseVideo();\r\n break;\r\n case 2:\r\n player.playVideo();\r\n break;\r\n }\r\n\r\n return false;\r\n };\r\n\r\n function _updateProgress(e) {\r\n var _this = this,\r\n percentage = e.offsetX/_this.offsetWidth;\r\n\r\n player.seekTo(player.getDuration() * percentage);\r\n\r\n };\r\n\r\n function _toggleSound(e) {\r\n var _this = this,\r\n curVol = player.getVolume();\r\n\r\n if(curVol\u003E0) {\r\n player.setVolume(0);\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 0);\r\n }\r\n\r\n else {\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 100);\r\n player.setVolume(100);\r\n }\r\n\r\n };\r\n\r\n\r\n function _updateLevelByBar(e) {\r\n var _this = this;\r\n\r\n\r\n if(_this.classList.contains(\u0027bar-1\u0027)) {\r\n player.setVolume(33);\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 33);\r\n }\r\n\r\n else if(_this.classList.contains(\u0027bar-2\u0027)) {\r\n player.setVolume(66);\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 66);\r\n }\r\n\r\n else if(_this.classList.contains(\u0027bar-3\u0027)) {\r\n player.setVolume(100);\r\n levelRegion[0].setAttribute(\u0027data-vol\u0027, 100);\r\n }\r\n };\r\n\r\n\r\n\r\n function _triggerFullscreen(e) {\r\n var iframe = videoPlayer;\r\n var requestFullScreen = iframe.requestFullScreen || iframe.mozRequestFullScreen || iframe.webkitRequestFullScreen || iframe.msRequestFullscreen;\r\n var exitFullScreen = iframe.exitFullscreen || iframe.webkitExitFullscreen || iframe.mozCancelFullScreen || iframe.msExitFullscreen;\r\n var fullscreenEnabled = iframe.fullscreenEnabled || iframe.webkitFullscreenEnabled || iframe.mozFullScreenEnabled || iframe.msFullscreenEnabled;\r\n var docFS = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement;\r\n\r\n //iframe.classList.contains(\u0027fullscreen\u0027) ? isFS = true : isFS = false;\r\n\r\n iframe.addEventListener(\u0022fullscreenchange\u0022, fullScreenOnEsc);\r\n iframe.addEventListener(\u0022webkitfullscreenchange\u0022, fullScreenOnEsc);\r\n iframe.addEventListener(\u0022mozfullscreenchange\u0022, fullScreenOnEsc);\r\n iframe.addEventListener(\u0022MSFullscreenChange\u0022, fullScreenOnEsc);\r\n\r\n if(document.fullscreenElement ||\r\n document.webkitFullscreenElement ||\r\n document.mozFullScreenElement ||\r\n document.msFullscreenElement) {\r\n\r\n if (document.exitFullscreen) {\r\n document.exitFullscreen();\r\n } else if (document.webkitExitFullscreen) {\r\n document.webkitExitFullscreen();\r\n } else if (document.mozCancelFullScreen) {\r\n document.mozCancelFullScreen();\r\n } else if (document.msExitFullscreen) {\r\n document.msExitFullscreen();\r\n }\r\n\r\n\r\n\r\n }\r\n\r\n else {\r\n if (requestFullScreen) {\r\n requestFullScreen.bind(iframe)();\r\n //console.log(\u0027enter click\u0027);\r\n }\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n function fullScreenOnEsc() {\r\n\r\n\r\n if(document.fullscreenElement ||\r\n document.webkitFullscreenElement ||\r\n document.mozFullScreenElement ||\r\n document.msFullscreenElement) {\r\n addClass(iframe, \u0027fullscreen\u0027);\r\n }\r\n\r\n else {\r\n removeClass(iframe, \u0027fullscreen\u0027);\r\n }\r\n };\r\n\r\n\r\n\r\n };\r\n\r\n\r\n\r\n function _createPlayer() {\r\n player = new YT.Player(\u0027video-container\u0027, {\r\n height: \u0027100%\u0027,\r\n width: \u0027100%\u0027,\r\n videoId: videoID,\r\n playerVars: {\r\n controls:0,\r\n enablejsapi:1,\r\n modestbranding:1,\r\n showinfo:0,\r\n rel: 0\r\n },\r\n events: {\r\n \u0027onReady\u0027: onPlayerReady,\r\n \u0027onStateChange\u0027: onPlayerStateChange\r\n }\r\n });\r\n }\r\n\r\n function onPlayerReady(event) {\r\n\r\n videoPlayerListeners();\r\n videoLength = secToMinute(player.getDuration());\r\n totalDurationHTML[0].innerHTML = videoLength;\r\n event.target.playVideo();\r\n\r\n }\r\n\r\n\r\n function onPlayerStateChange(event) {\r\n\r\n\r\n\r\n switch(event.data) {\r\n case 0:\r\n //ENDED\r\n removeClass(playpauseBTN, \u0027playing\u0027);\r\n clearInterval(videoProgressInterval);\r\n videoProgressInterval = null;\r\n break;\r\n case 1:\r\n //PLAYING\r\n addClass(playpauseBTN, \u0027playing\u0027);\r\n videoProgressInterval = setInterval(_checkVideoProgress, 500);\r\n break;\r\n case 2:\r\n //PAUSED\r\n removeClass(playpauseBTN, \u0027playing\u0027);\r\n clearInterval(videoProgressInterval);\r\n videoProgressInterval = null;\r\n break;\r\n case 3:\r\n //BUFFERING\r\n break;\r\n case -1:\r\n //UNSTARTED\r\n break;\r\n case 5:\r\n //CUED\r\n break;\r\n }\r\n }\r\n\r\n\r\n function _checkVideoProgress() {\r\n var curTime = secToMinute(Math.floor(player.getCurrentTime())),\r\n totalPercentage = Math.ceil((player.getCurrentTime()/player.getDuration())*100);\r\n\r\n curDurationHTML[0].innerHTML = curTime;\r\n\r\n if(curPercentage!==totalPercentage) {\r\n curPercentage = totalPercentage;\r\n progressBar[0].setAttribute(\u0027value\u0027, curPercentage);\r\n }\r\n\r\n\r\n }\r\n };\r\n\r\n\r\n\r\n return false;\r\n\r\n }\r\n\r\n\r\n\r\n\r\n\r\n\r\n };\r\n\r\n //$ using jQuery, pass jQuery to function above - (function($) { - below - })(jQuery);\r\n //$(document).ready(function() {\r\n\r\n document.addEventListener(\u0022DOMContentLoaded\u0022, function(event) {\r\n console.log(\u0022video.js - DOM loaded and parsed\u0022);\r\n var dsObject = new window.DS.video();\r\n\r\n });\r\n\r\n //});\r\n\r\n})();\r\n","IsDeferred":false}]}