diff --git a/.gitignore b/.gitignore index fc89694f..8adb1081 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .DS_Store +test.html thirdparty/jwplayer.* +thirdparty/jquery-*.js node_modules/ translations/???.js diff --git a/build/ableplayer.dist.js b/build/ableplayer.dist.js index c718339b..de32f0e4 100644 --- a/build/ableplayer.dist.js +++ b/build/ableplayer.dist.js @@ -251,6 +251,9 @@ // Debug - set to true to write messages to console; otherwise false this.debug = false; + + // Path to root directory of referring website + this.rootPath = this.getRootWebSitePath(); // Volume range is 0 to 1. Don't crank it to avoid overpowering screen readers this.defaultVolume = 0.5; @@ -304,7 +307,7 @@ this.fallback = 'jw'; // fallback path - specify path to fallback player files - this.fallbackPath = '../thirdparty/'; + this.fallbackPath = this.rootPath + '/thirdparty/'; // testFallback - set to true to force browser to use the fallback player (for testing) // Note: JW Player does not support offline playback (a Flash restriction) @@ -312,7 +315,7 @@ this.testFallback = false; // translationPath - specify path to translation files - this.translationPath = '../translations/'; + this.translationPath = this.rootPath + '/translations/'; // lang - default language of the player this.lang = 'en'; @@ -344,6 +347,16 @@ this.setButtonImages(); }; + AblePlayer.prototype.getRootWebSitePath = function() { + + var _location = document.location.toString(); + var domainNameIndex = _location.indexOf('/', _location.indexOf('://') + 3); + var domainName = _location.substring(0, domainNameIndex) + '/'; + var webFolderIndex = _location.indexOf('/', _location.indexOf(domainName) + domainName.length); + var webFolderFullPath = _location.substring(0, webFolderIndex); + return webFolderFullPath; + }; + AblePlayer.prototype.setButtonImages = function() { var imgPath = '../images/' + this.iconColor + '/'; diff --git a/build/ableplayer.js b/build/ableplayer.js index 80ea1838..9958ba51 100644 --- a/build/ableplayer.js +++ b/build/ableplayer.js @@ -251,6 +251,9 @@ // Debug - set to true to write messages to console; otherwise false this.debug = false; + + // Path to root directory of referring website + this.rootPath = this.getRootWebSitePath(); // Volume range is 0 to 1. Don't crank it to avoid overpowering screen readers this.defaultVolume = 0.5; @@ -304,7 +307,7 @@ this.fallback = 'jw'; // fallback path - specify path to fallback player files - this.fallbackPath = '../thirdparty/'; + this.fallbackPath = this.rootPath + '/thirdparty/'; // testFallback - set to true to force browser to use the fallback player (for testing) // Note: JW Player does not support offline playback (a Flash restriction) @@ -312,7 +315,7 @@ this.testFallback = false; // translationPath - specify path to translation files - this.translationPath = '../translations/'; + this.translationPath = this.rootPath + '/translations/'; // lang - default language of the player this.lang = 'en'; @@ -344,6 +347,16 @@ this.setButtonImages(); }; + AblePlayer.prototype.getRootWebSitePath = function() { + + var _location = document.location.toString(); + var domainNameIndex = _location.indexOf('/', _location.indexOf('://') + 3); + var domainName = _location.substring(0, domainNameIndex) + '/'; + var webFolderIndex = _location.indexOf('/', _location.indexOf(domainName) + domainName.length); + var webFolderFullPath = _location.substring(0, webFolderIndex); + return webFolderFullPath; + }; + AblePlayer.prototype.setButtonImages = function() { var imgPath = '../images/' + this.iconColor + '/'; diff --git a/build/ableplayer.min.js b/build/ableplayer.min.js index 7cb5564e..798a92d4 100644 --- a/build/ableplayer.min.js +++ b/build/ableplayer.min.js @@ -1,4 +1,4 @@ /*! ableplayer V2.1.0 */ -"use strict";!function(a){a(document).ready(function(){a("video, audio").each(function(b,c){void 0!==a(c).data("able-player")&&new AblePlayer(a(this),a(c))})}),window.onYouTubeIframeAPIReady=function(){AblePlayer.youtubeIframeAPIReady=!0,a("body").trigger("youtubeIframeAPIReady",[])},a(window).keydown(function(a){1===AblePlayer.nextIndex&&AblePlayer.lastCreated.onPlayerKeyPress(a)}),window.AblePlayer=function(b){if(AblePlayer.lastCreated=this,this.setDefaults(),this.media=b,0!==a(b).length){this.autoplay=void 0!==a(b).attr("autoplay")&&"false"!==a(b).attr("autoplay")?!0:!1;var c=b.data("include-transcript");if((void 0===c||""===c)&&b.find('track[kind="captions"], track[kind="subtitles"]').length>0&&(c=!0),this.includeTranscript=c?!0:!1,this.startTime=void 0!==a(b).data("start-time")&&""!==a(b).data("start-time")?a(b).data("start-time"):0,void 0!==a(b).data("transcript-div")&&""!==a(b).data("transcript-div")&&(this.transcriptDivLocation=a(b).data("transcript-div")),void 0!==a(b).data("use-transcript-button")&&a(b).data("use-transcript-button")===!1&&(this.useTranscriptButton=!1),void 0!==a(b).data("lyrics-mode")&&"false"!==a(b).data("lyrics-mode")&&(this.lyricsMode=!0),void 0!==a(b).data("transcript-title")&&(this.transcriptTitle=a(b).data("transcript-title")),void 0!==a(b).data("youtube-id")&&""!==a(b).data("youtube-id")&&(this.youtubeId=a(b).data("youtube-id")),void 0!==a(b).data("youtube-desc-id")&&""!==a(b).data("youtube-desc-id")&&(this.youtubeDescId=a(b).data("youtube-desc-id")),void 0!==a(b).data("debug")&&"false"!==a(b).data("debug")&&(this.debug=!0),void 0!==a(b).data("volume")&&""!==a(b).data("volume")){var d=a(b).data("volume");d>=0&&1>=d&&(this.defaultVolume=d)}if(void 0!==a(b).data("icon-type")&&""!==a(b).data("icon-type")){var e=a(b).data("icon-type");("font"===e||"image"==e)&&(this.iconType=e)}if(void 0!==a(b).data("seek-interval")&&""!==a(b).data("seek-interval")){var f=a(b).data("seek-interval");/^[1-9][0-9]*$/.test(f)&&(this.seekInterval=f,this.useFixedSeekInterval=!0)}if(void 0!==a(b).data("show-now-playing")&&"false"!==a(b).data("show-now-playing")&&(this.showNowPlaying=!0),void 0!==a(b).data("fallback")&&""!==a(b).data("fallback")){var g=a(b).data("fallback");"jw"===g&&(this.fallback=g)}if(void 0!==a(b).data("test-fallback")&&"false"!==a(b).data("test-fallback")&&(this.testFallback=!0),void 0!==a(b).data("fallback-path")&&"false"!==a(b).data("fallback-path")&&(this.fallbackPath=a(b).data("fallback-path")),void 0!==a(b).data("translation-path")&&"false"!==a(b).data("translation-path")&&(this.translationPath=a(b).data("translation-path")),void 0!==a(b).data("lang")&&""!==a(b).data("lang")){var h=a(b).data("lang");2==h.length&&(this.lang=h)}void 0!==a(b).data("force-lang")&&"false"!==a(b).data("force-lang")&&(this.forceLang=!0),void 0!==a(b).data("meta-div")&&""!==a(b).data("meta-div")&&(this.metaDiv=a(b).data("meta-div")),void 0!==a(b).data("search")&&""!==a(b).data("search")&&void 0!==a(b).data("search-div")&&""!==a(b).data("search-div")&&(this.searchString=a(b).data("search"),this.searchDiv=a(b).data("search-div")),this.ableIndex=AblePlayer.nextIndex,AblePlayer.nextIndex+=1,this.title=a(b).attr("title"),this.tt=[];var i=this;a.when(this.getTranslationText()).then(function(){i.countProperties(i.tt)>50&&(i.setup(),i.startTime>0&&!i.autoplay&&i.onMediaUpdateTime())})}},AblePlayer.nextIndex=0,AblePlayer.prototype.setup=function(){var a=this;this.debug&&this.startTime>0,this.reinitialize().then(function(){a.player?a.setupInstance().then(function(){a.recreatePlayer()}):a.provideFallback()})},AblePlayer.youtubeIframeAPIReady=!1,AblePlayer.loadingYoutubeIframeAPI=!1}(jQuery),function(a){AblePlayer.prototype.setDefaults=function(){this.debug=!1,this.defaultVolume=.5,this.playerWidth=480,this.playerHeight=360,this.iconColor="white",this.iconType="font",this.seekInterval=10,this.useFixedSeekInterval=!1,this.useSlider=!0,this.showNowPlaying=!0,this.fallback="jw",this.fallbackPath="../thirdparty/",this.testFallback=!1,this.translationPath="../translations/",this.lang="en",this.forceLang=!1,this.loop=!0,this.lyricsMode=!1,this.transcriptTitle="Transcript",this.useTranscriptButton=!0,this.setButtonImages()},AblePlayer.prototype.setButtonImages=function(){var a="../images/"+this.iconColor+"/";this.playButtonImg=a+"play.png",this.pauseButtonImg=a+"pause.png",this.rewindButtonImg=a+"rewind.png",this.forwardButtonImg=a+"forward.png",this.fasterButtonImg=a+"slower.png",this.slowerButtonImg=a+"faster.png",this.volumeMuteButtonImg=a+"volume-mute.png",this.volumeLoudButtonImg=a+"volume-loud.png",this.volumeIncreaseButtonImg=a+"volume-up.png",this.volumeDecreaseButtonImg=a+"volume-down.png",this.captionsButtonImg=a+"captions.png",this.chaptersButtonImg=a+"chapters.png",this.signButtonImg=a+"sign.png",this.transcriptButtonImg=a+"transcript.png",this.descriptionsButtonImg=a+"descriptions.png",this.fullscreenExpandButtonImg=a+"fullscreen-expand.png",this.fullscreenCollapseButtonImg=a+"fullscreen-collapse.png",this.prefsButtonImg=a+"preferences.png",this.helpButtonImg=a+"help.png"},AblePlayer.prototype.reinitialize=function(){var b=new a.Deferred,c=b.promise();if(window.console||(this.debug=!1),this.startedPlaying=!1,this.autoScrollTranscript=!0,this.$media=a(this.media).first(),this.media=this.$media[0],this.$media.is("audio"))this.mediaType="audio";else{if(!this.$media.is("video"))return this.mediaType=this.$media.get(0).tagName,this.debug,b.fail(),c;this.mediaType="video"}return this.$sources=this.$media.find("source"),this.debug,this.player=this.getPlayer(),this.setIconType(),this.setDimensions(),b.resolve(),c},AblePlayer.prototype.setDimensions=function(){this.$media.attr("width")&&(this.playerWidth=parseInt(this.$media.attr("width"),10)),this.$media.attr("height")&&(this.playerHeight=parseInt(this.$media.attr("height"),10))},AblePlayer.prototype.setIconType=function(){var b;b=a("",{"class":"icon-play able-clipped"}),a("body").append(b),"font"===this.iconType&&(window.getComputedStyle?(this.controllerFont=window.getComputedStyle(b.get(0),null).getPropertyValue("font-family"),this.controllerFont?(this.controllerFont=this.controllerFont.replace(/["']/g,""),this.iconType="font"):this.iconType="image"):this.iconType="image"),this.debug&&"font"===this.iconType,b.remove()},AblePlayer.prototype.setupInstance=function(){var b=new a.Deferred,c=b.promise();return this.$media.attr("id")?this.mediaId=this.$media.attr("id"):(this.mediaId="ableMediaId_"+this.ableIndex,this.$media.attr("id",this.mediaId)),this.setupInstancePlaylist(),b.resolve(),c},AblePlayer.prototype.setupInstancePlaylist=function(){var b=this;if(this.hasPlaylist=!1,a(".able-playlist").each(function(){if(a(this).data("player")===b.mediaId){b.hasPlaylist=!0,b.$playlist=a(this).find("li"),a(this).find("li").attr("tabindex","0"),b.playlistIndex=0;var c=a(this).data("embedded");b.playlistEmbed="undefined"!=typeof c&&c!==!1?!0:!1}}),this.hasPlaylist&&this.playlistEmbed){var c=this.$playlist.parent();this.$playlistDom=c.clone(),c.remove()}},AblePlayer.prototype.recreatePlayer=function(){var a=this;return this.player?(this.setMediaAttributes(),this.loadCurrentPreferences(),this.injectPlayerCode(),this.initSignLanguage(),void this.setupTracks().then(function(){a.setupPopups(),a.initDescription(),a.updateDescription(),a.initializing=!1,a.initPlayer(),a.initDefaultCaption(),a.updateCaption(),a.updateTranscript(),a.showSearchResults()})):void console.log("Can't create player; no appropriate player type detected.")},AblePlayer.prototype.initPlayer=function(){var b,c=this;this.debug&&this.player,"html5"===this.player?b=this.initHtml5Player():"jw"===this.player?b=this.initJwPlayer():"youtube"===this.player&&(b=this.initYoutubePlayer());var d=new a.Deferred,e=d.promise();return b.done(function(){if(c.addControls(),c.addEventListeners(),c.setMute(!1),c.setFullscreen(!1),c.setVolume(c.defaultVolume),c.initializing=!0,c.initializing=!1,c.refreshControls(),"html5"===c.player&&c.isIOS()&&c.$media[0].load(),c.useFixedSeekInterval===!1){var a=c.getDuration();a>0?(c.seekInterval=Math.max(c.seekInterval,a/10),c.seekIntervalCalculated=!0):c.seekIntervalCalculated=!1}d.resolve()}),e},AblePlayer.prototype.initDefaultCaption=function(){var a;if(this.captions.length>0)for(a=0;a").attr("id",d));var e;e=b.youtubeDescId&&b.prefDesc?b.youtubeDescId:b.youtubeId,b.youtubePlayer=new YT.Player(d,{videoId:e,height:b.playerHeight.toString(),width:b.playerWidth.toString(),playerVars:{start:b.startTime,controls:0},events:{onReady:function(){c.resolve()},onError:function(){c.fail()}}}),b.$media.remove()};return AblePlayer.youtubeIframeAPIReady?e():(AblePlayer.loadingYoutubeIframeAPI||a.getScript("https://www.youtube.com/iframe_api").fail(function(){b.debug}),a("body").on("youtubeIframeAPIReady",function(){e()})),d},AblePlayer.prototype.setMediaAttributes=function(){this.$media.attr("tabindex",-1);var a=this.$media.get(0).textTracks;if(a)for(var b=0;b0)for(b=0;b",{"class":"able-prefs-form"}),c="

"+this.tt.prefIntro+"

\n",d=a("

",{html:c}),e=a("

"),f=a(""+this.tt.prefFeatures+""),e.append(f),g=a("
"),h=a(""+this.tt.prefKeys+""),g.append(h),i=0;i"),l=this.mediaId+"_"+j,m=a('"),n=a("",{type:"checkbox",name:j,id:l,value:"true"}),k.append(n).append(m),1===this[j]&&n.prop("checked",!0),0===i||1===i||2===i?g.append(k):e.append(k);b.append(d).append(g).append(e),a("body").append(b);var q=new AccessibleDialog(b,"dialog",o.tt.prefTitle,d,o.tt.closeButtonLabel,"32em");b.append("
");var r=a('"),s=a('");r.click(function(){q.hide(),o.savePrefsFromForm()}),s.click(function(){q.hide()}),b.append(r),b.append(s),this.prefsDialog=q},AblePlayer.prototype.savePrefsFromForm=function(){var b;b=0;for(var c=this.getCookie(),d=this.getAvailablePreferences(),e=0;e0?(this.setCookie(c),this.showAlert(this.tt.prefSuccess)):this.showAlert(this.tt.prefNoChange),this.updatePrefs()},AblePlayer.prototype.updatePrefs=function(){var b;b=1===this.prefAltKey?"Alt + ":"",1===this.prefCtrlKey&&(b+="Control + "),1===this.prefShiftKey&&(b+="Shift + "),a(".able-help-modifiers").text(b),1===this.prefTabbable?a(".able-transcript span.able-transcript-seekpoint").attr("tabindex","0"):a(".able-transcript span.able-transcript-seekpoint").removeAttr("tabindex"),this.updateCaption(),this.updateDescription()},AblePlayer.prototype.usingModifierKeys=function(a){return(1!==this.prefAltKey||a.altKey)&&(1!==this.prefCtrlKey||a.ctrlKey)&&(1!==this.prefShiftKey||a.shiftKey)?!0:!1}}(jQuery),function(a){function b(a,b){var d=[];for(var e in b)d.push(c(a,b[e]));return d}function c(a,b){var c=b(a);if(null!==a.error)throw a.error;return c}function d(a,b){for(var c in b)"\n"===b[c]?(a.column=1,a.line+=1):a.column+=1}function e(a,b){var c=a.text.substring(0,b);return d(a,c),a.text=a.text.substring(b),c}function f(a){var b,c=a.text.indexOf("\n");return-1===c?(b=a.text,d(a,b),a.text=""):(b=a.text.substring(0,c),d(a,b+"\n"),a.text=a.text.substring(c+1)),b}function g(a){var b=a.text.indexOf("\n");return-1===b?a.text:a.text.substring(0,b)}function h(a){b(a,[s,t]);var c=a.text[0];" "===c||" "===c||"\n"===c?b(a,[x,i,z,m]):a.error="WEBVTT signature not followed by whitespace."}function i(a){for(;;){var b=g(a);if(-1!==b.indexOf("-->"))return;if(0===b.length)return;var d=c(a,k);a.metadata[d[0]]=d[1],c(a,x)}}function j(a){var b=[],c=a.indexOf(" ");c>=0&&b.push(c);var d=a.indexOf(" ");d>=0&&b.push(d);var e=a.indexOf("\n");return e>=0&&b.push(e),Math.min.apply(null,b)}function k(a){var b=a.text.indexOf("\n"),c=e(a,b),d=c.indexOf(":");if(-1===d)return void(a.error="Missing colon.");var f=c.substring(0,d),g=c.substring(d+1);return[f,g]}function l(a){var b=j(a.text),c=e(a,b),d=c.indexOf(":");if(-1===d)return void(a.error="Missing colon.");var f=c.substring(0,d),g=c.substring(d+1);return[f,g]}function m(d){for(;;){var e=g(d);if(0!==e.indexOf("NOTE")||4!==e.length&&" "!==e[4]&&" "!==e[4]){if(0===a.trim(e).length)return;c(d,n)}else b(d,[r,y])}}function n(a){var d,h=g(a);-1===h.indexOf("-->")&&(d=f(a));var i=b(a,[A,w,u,w,A]),j=i[0],k=i[4];if(j>=k)return void(a.error="Start time is not sooner than end time.");c(a,v);var l=c(a,o);e(a,1);var m=c(a,p);a.cues.push({id:d,start:j,end:k,settings:l,components:m})}function o(a){for(var b={};a.text.length>0&&"\n"!==a.text[0];){var d=c(a,l);b[d[0]]=d[1],c(a,v)}return b}function p(b){for(var d={type:"internal",tagName:"",value:"",classes:[],annotation:"",parent:null,children:[],language:""},f=d,h=[];b.text.length>0;){var i=g(b);if(-1!==i.indexOf("-->"))break;if(b.text.length>=2&&"\n"===b.text[0]&&"\n"===b.text[1]){e(b,2);break}var j=q(b);if("string"===j.type)f.children.push(j);else if("startTag"===j.type)j.type=j.tagName,j.parent=f,-1!==a.inArray(j.tagName,["c","i","b","u","ruby"])?(h.length>0&&(f.language=h[h.length-1]),f.children.push(j),f=j):"rt"===j.tagName&&"ruby"===f.tagName?(h.length>0&&(f.language=h[h.length-1]),f.children.push(j),f=j):"v"===j.tagName?(j.value=j.annotation,h.length>0&&(f.language=h[h.length-1]),f.children.push(j),f=j):"lang"===j.tagName&&(h.push(j.annotation),h.length>0&&(f.language=h[h.length-1]),f.children.push(j),f=j);else if("endTag"===j.type)j.tagName===f.type&&-1!==a.inArray(j.tagName,["c","i","b","u","ruby","rt","v"])?f=f.parent:"lang"===j.tagName&&"lang"===f.type?(f=f.parent,h.pop()):"ruby"===j.tagName&&"rt"===f.type&&(f=f.parent.parent);else if("timestampTag"===j.type){var k={text:j.value,error:null,metadata:{},cues:[],line:1,column:1};try{var l=c(k,A);0===k.text.length&&(j.value=l,f.push(j))}catch(m){}}}return d}function q(b){for(var c="data",d=[],f="",g={type:"",tagName:"",value:"",classes:[],annotation:"",children:[]};;){var h;if(h=b.text.length>=2&&"\n"===b.text[0]&&"\n"===b.text[1]?"":b.text.length>0?b.text[0]:"","data"===c)if("&"===h)f="&";else if("<"===h){if(0!==d.length)return g.type="string",g.value=d.join(""),g;c="tag"}else{if(""===h)return{type:"string",value:d.join("")};d.push(h)}else if("escape"===c)if("&"===h)d.push(f),f="&";else if(h.match(/[0-9a-z]/))f+=h;else if(";"===h)"&"===f?d.push("&"):"<"===f?d.push("<"):">"===f?d.push(">"):"&lrm"===f?d.push("‎"):"&rlm"===f?d.push("‏"):" "===f?d.push(" "):(d.push(f),d.push(";")),c="data";else{if("<"===h||""===h)return d.push(f),g.type="string",g.value=d.join(""),g;d.push(f),c="data"}else if("tag"===c)if(" "===h||"\n"===h||"\f"===h||" "===h)c="startTagAnnotation";else if("."===h)c="startTagClass";else if("/"===h)c="endTag";else if(h.match("[0-9]"))c="timestampTag",d.push(h);else{if(">"===h){e(b,1);break}if(""===h)return g.tagName="",g.type="startTag",g;d.push(h),c="startTag"}else if("startTag"===c)if(" "===h||"\f"===h||" "===h)c="startTagAnnotation";else if("\n"===h)f=h,c="startTagAnnotation";else if("."===h)c="startTagClass";else{if(">"===h)return e(b,1),g.tagName=d.join(""),g.type="startTag",g;if(""===h)return g.tagName=d.join(""),g.type="startTag",g;d.push(h)}else if("startTagClass"===c)if(" "===h||"\f"===h||" "===h)g.classes.push(f),f="",c="startTagAnnotation";else if("\n"===h)g.classes.push(f),f=h,c="startTagAnnotation";else if("."===h)g.classes.push(f),f="";else{if(">"===h)return e(b,1),g.classes.push(f),g.type="startTag",g.tagName=d.join(""),g;if(""===h)return g.classes.push(f),g.type="startTag",g.tagName=d.join(""),g;f+="c"}else if("startTagAnnotation"===c){if(">"===h)return e(b,1),f=a.trim(f).replace(/ +/," "),g.type="startTag",g.tagName=d.join(""),g.annotation=f,g;if(""===h)return f=a.trim(f).replace(/ +/," "),g.type="startTag",g.tagName=d.join(""),g.annotation=f,g;f+=h}else if("endTag"===c){if(">"===h)return e(b,1),g.type="endTag",g.tagName=d.join(""),g;if(""===h)return g.type="endTag",g.tagName=d.join(""),g;d.push(h)}else{if("timestampTag"!==c)throw"Unknown tokenState "+c;if(">"===h)return e(b,1),g.type="timestampTag",g.name=d.join(""),g;if(""===h)return g.type="timestampTag",g.name=d.join(""),g;d.push(h)}e(b,1)}}function r(b){var c=f(b);if(-1!==c.indexOf("-->"))return void(b.error="Invalid syntax: --> in NOTE line.");for(;;){var d=g(b);if(0===a.trim(d).length)return;if(-1!==d.indexOf("-->"))return void(b.error="Invalid syntax: --> in comment.");f(b)}}function s(a){""===a.text[0]&&e(a,1)}function t(a){"WEBVTT"===a.text.substring(0,6)?e(a,6):a.error="Invalid signature."}function u(a){a.text.length<3||"-->"!==a.text.substring(0,3)?a.error="Missing -->":e(a,3)}function v(a){for(;" "===a.text[0]||" "===a.text[0];)e(a,1)}function w(a){for(var b=0;" "===a.text[0]||" "===a.text[0];)e(a,1),b+=1;0===b&&(a.error="Missing space.")}function x(a){var b=a.text.indexOf("\n");-1===b?a.error="Missing EOL.":e(a,b+1)}function y(b){for(;b.text.length>0;){var c=g(b);if(0!==a.trim(c).length)break;f(b)}}function z(b){for(var c=0;b.text.length>0;){var d=g(b);if(0!==a.trim(d).length)break;f(b),c+=1}0===c&&(b.error="Missing empty line.")}function A(a){var b=j(a.text);if(-1===b)return void a.error("Missing timing.");var c=e(a,b),d=/((\d\d):)?((\d\d):)(\d\d).(\d\d\d)|(\d+).(\d\d\d)/.exec(c);if(!d)return void(a.error="Unable to parse timestamp.");var f=0,g=d[2],h=d[4];if(h){if(parseInt(h,10)>59)return void(a.error="Invalid minute range.");g&&(f+=3600*parseInt(g,10)),f+=60*parseInt(h,10);var i=d[5];if(parseInt(i,10)>59)return void(a.error="Invalid second range.");f+=parseInt(i,10),f+=parseInt(d[6],10)/1e3}else f+=parseInt(d[7],10),f+=parseInt(d[8],10)/1e3;return f}AblePlayer.prototype.parseWebVTT=function(a){a=a.replace(/(\r\n|\n|\r)/g,"\n");var b={text:a,error:null,metadata:{},cues:[],line:1,column:1};try{c(b,h)}catch(d){}return b}}(jQuery),function(a){AblePlayer.prototype.injectPlayerCode=function(){if(this.$mediaContainer=this.$media.wrap('
').parent(),this.$ableDiv=this.$mediaContainer.wrap('
').parent(),this.$mediaContainer.width(this.playerWidth),"video"==this.mediaType&&this.$mediaContainer.height(this.playerHeight),this.$ableDiv.width(this.playerWidth),this.injectOffscreenHeading(),"video"===this.mediaType&&"youtube"!==this.player){this.injectBigPlayButton();var b=a("
",{"class":"able-vidcap-container"});this.$vidcapContainer=this.$mediaContainer.wrap(b).parent()}this.injectPlayerControlArea(),this.injectTextDescriptionArea(),this.includeTranscript&&(this.injectTranscriptArea(),this.addTranscriptAreaEvents()),this.injectAlert(),this.injectPlaylist(),this.injectPrefsForm()},AblePlayer.prototype.injectOffscreenHeading=function(){var b,c=this.$ableDiv.parents();if(c.each(function(){var c=a(this),d=c.find("h1, h2, h3, h4, h5, h6"),e=d.length;return e?(b=d.eq(e-1).prop("tagName"),!1):void 0}),"undefined"==typeof b)var b="h1";else{var d=parseInt(b[1]);d+=1,d>6&&(d=6),b="h"+d.toString()}this.playerHeadingLevel=d,this.$headingDiv=a("<"+b+">"),this.$ableDiv.prepend(this.$headingDiv),this.$headingDiv.addClass("able-offscreen"),this.$headingDiv.text(this.tt.playerHeading)},AblePlayer.prototype.injectBigPlayButton=function(){this.$bigPlayButton=a(""),j.click(function(){k.hide()}),b.append(j),this.helpDialog=k},AblePlayer.prototype.calculateControlLayout=function(){var a={ul:["play","stop"],ur:[],bl:[],br:[]};this.useSlider&&(a.ur.push("rewind"),a.ur.push("seek"),a.ur.push("forward"));var b=[];this.browserSupportsVolume()&&(b.push("mute"),b.push("volume-up"),b.push("volume-down"));var c=[];return"video"===this.mediaType&&(this.hasCaptions&&c.push("captions"),this.hasSignLanguage&&c.push("sign"),(this.hasOpenDesc||this.hasClosedDesc)&&c.push("descriptions")),this.includeTranscript&&this.useTranscriptButton&&c.push("transcript"),this.isPlaybackRateSupported()&&(c.push("slower"),c.push("faster")),"video"===this.mediaType&&this.hasChapters&&c.push("chapters"),b.length>0&&c.length>0?(a.bl=b,a.bl.push("pipe"),a.bl=a.bl.concat(c)):a.bl=b.concat(c),a.br.push("preferences"),a.br.push("help"),"video"===this.mediaType&&"jw"!==this.player&&a.br.push("fullscreen"),a},AblePlayer.prototype.addControls=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q=100,r=this.calculateControlLayout(),s={0:"ul",1:"ur",2:"bl",3:"br"};for(f=this.mediaId+"-tooltip",g=a("
",{id:f,"class":"able-tooltip"}),this.$controllerDiv.append(g),b=0;3>=b;b++){for(d=r[s[b]],e=b%2===0?a("",{"class":"able-left-controls"}):a("",{"class":"able-right-controls"}),this.$controllerDiv.append(e),c=0;c
');e.append(t),this.seekBar=new AccessibleSeekBar(t,q)}else if("pipe"===h){var u=a("",{tabindex:"-1","aria-hidden":"true"});if("font"===this.iconType)u.addClass("icon-pipe");else{var v=a("",{src:"../images/"+this.iconColor+"/pipe.png",alt:"",role:"presentation"});u.append(v)}e.append(u)}else{j="mute"===h?"../images/"+this.iconColor+"/volume-mute.png":"fullscreen"===h?"../images/"+this.iconColor+"/fullscreen-expand.png":"../images/"+this.iconColor+"/"+h+".png",k=this.getButtonTitle(h),l=a(""),s=a('");r.click(function(){q.hide(),o.savePrefsFromForm()}),s.click(function(){q.hide()}),b.append(r),b.append(s),this.prefsDialog=q},AblePlayer.prototype.savePrefsFromForm=function(){var b;b=0;for(var c=this.getCookie(),d=this.getAvailablePreferences(),e=0;e0?(this.setCookie(c),this.showAlert(this.tt.prefSuccess)):this.showAlert(this.tt.prefNoChange),this.updatePrefs()},AblePlayer.prototype.updatePrefs=function(){var b;b=1===this.prefAltKey?"Alt + ":"",1===this.prefCtrlKey&&(b+="Control + "),1===this.prefShiftKey&&(b+="Shift + "),a(".able-help-modifiers").text(b),1===this.prefTabbable?a(".able-transcript span.able-transcript-seekpoint").attr("tabindex","0"):a(".able-transcript span.able-transcript-seekpoint").removeAttr("tabindex"),this.updateCaption(),this.updateDescription()},AblePlayer.prototype.usingModifierKeys=function(a){return(1!==this.prefAltKey||a.altKey)&&(1!==this.prefCtrlKey||a.ctrlKey)&&(1!==this.prefShiftKey||a.shiftKey)?!0:!1}}(jQuery),function(a){function b(a,b){var d=[];for(var e in b)d.push(c(a,b[e]));return d}function c(a,b){var c=b(a);if(null!==a.error)throw a.error;return c}function d(a,b){for(var c in b)"\n"===b[c]?(a.column=1,a.line+=1):a.column+=1}function e(a,b){var c=a.text.substring(0,b);return d(a,c),a.text=a.text.substring(b),c}function f(a){var b,c=a.text.indexOf("\n");return-1===c?(b=a.text,d(a,b),a.text=""):(b=a.text.substring(0,c),d(a,b+"\n"),a.text=a.text.substring(c+1)),b}function g(a){var b=a.text.indexOf("\n");return-1===b?a.text:a.text.substring(0,b)}function h(a){b(a,[s,t]);var c=a.text[0];" "===c||" "===c||"\n"===c?b(a,[x,i,z,m]):a.error="WEBVTT signature not followed by whitespace."}function i(a){for(;;){var b=g(a);if(-1!==b.indexOf("-->"))return;if(0===b.length)return;var d=c(a,k);a.metadata[d[0]]=d[1],c(a,x)}}function j(a){var b=[],c=a.indexOf(" ");c>=0&&b.push(c);var d=a.indexOf(" ");d>=0&&b.push(d);var e=a.indexOf("\n");return e>=0&&b.push(e),Math.min.apply(null,b)}function k(a){var b=a.text.indexOf("\n"),c=e(a,b),d=c.indexOf(":");if(-1===d)return void(a.error="Missing colon.");var f=c.substring(0,d),g=c.substring(d+1);return[f,g]}function l(a){var b=j(a.text),c=e(a,b),d=c.indexOf(":");if(-1===d)return void(a.error="Missing colon.");var f=c.substring(0,d),g=c.substring(d+1);return[f,g]}function m(d){for(;;){var e=g(d);if(0!==e.indexOf("NOTE")||4!==e.length&&" "!==e[4]&&" "!==e[4]){if(0===a.trim(e).length)return;c(d,n)}else b(d,[r,y])}}function n(a){var d,h=g(a);-1===h.indexOf("-->")&&(d=f(a));var i=b(a,[A,w,u,w,A]),j=i[0],k=i[4];if(j>=k)return void(a.error="Start time is not sooner than end time.");c(a,v);var l=c(a,o);e(a,1);var m=c(a,p);a.cues.push({id:d,start:j,end:k,settings:l,components:m})}function o(a){for(var b={};a.text.length>0&&"\n"!==a.text[0];){var d=c(a,l);b[d[0]]=d[1],c(a,v)}return b}function p(b){for(var d={type:"internal",tagName:"",value:"",classes:[],annotation:"",parent:null,children:[],language:""},f=d,h=[];b.text.length>0;){var i=g(b);if(-1!==i.indexOf("-->"))break;if(b.text.length>=2&&"\n"===b.text[0]&&"\n"===b.text[1]){e(b,2);break}var j=q(b);if("string"===j.type)f.children.push(j);else if("startTag"===j.type)j.type=j.tagName,j.parent=f,-1!==a.inArray(j.tagName,["c","i","b","u","ruby"])?(h.length>0&&(f.language=h[h.length-1]),f.children.push(j),f=j):"rt"===j.tagName&&"ruby"===f.tagName?(h.length>0&&(f.language=h[h.length-1]),f.children.push(j),f=j):"v"===j.tagName?(j.value=j.annotation,h.length>0&&(f.language=h[h.length-1]),f.children.push(j),f=j):"lang"===j.tagName&&(h.push(j.annotation),h.length>0&&(f.language=h[h.length-1]),f.children.push(j),f=j);else if("endTag"===j.type)j.tagName===f.type&&-1!==a.inArray(j.tagName,["c","i","b","u","ruby","rt","v"])?f=f.parent:"lang"===j.tagName&&"lang"===f.type?(f=f.parent,h.pop()):"ruby"===j.tagName&&"rt"===f.type&&(f=f.parent.parent);else if("timestampTag"===j.type){var k={text:j.value,error:null,metadata:{},cues:[],line:1,column:1};try{var l=c(k,A);0===k.text.length&&(j.value=l,f.push(j))}catch(m){}}}return d}function q(b){for(var c="data",d=[],f="",g={type:"",tagName:"",value:"",classes:[],annotation:"",children:[]};;){var h;if(h=b.text.length>=2&&"\n"===b.text[0]&&"\n"===b.text[1]?"":b.text.length>0?b.text[0]:"","data"===c)if("&"===h)f="&";else if("<"===h){if(0!==d.length)return g.type="string",g.value=d.join(""),g;c="tag"}else{if(""===h)return{type:"string",value:d.join("")};d.push(h)}else if("escape"===c)if("&"===h)d.push(f),f="&";else if(h.match(/[0-9a-z]/))f+=h;else if(";"===h)"&"===f?d.push("&"):"<"===f?d.push("<"):">"===f?d.push(">"):"&lrm"===f?d.push("‎"):"&rlm"===f?d.push("‏"):" "===f?d.push(" "):(d.push(f),d.push(";")),c="data";else{if("<"===h||""===h)return d.push(f),g.type="string",g.value=d.join(""),g;d.push(f),c="data"}else if("tag"===c)if(" "===h||"\n"===h||"\f"===h||" "===h)c="startTagAnnotation";else if("."===h)c="startTagClass";else if("/"===h)c="endTag";else if(h.match("[0-9]"))c="timestampTag",d.push(h);else{if(">"===h){e(b,1);break}if(""===h)return g.tagName="",g.type="startTag",g;d.push(h),c="startTag"}else if("startTag"===c)if(" "===h||"\f"===h||" "===h)c="startTagAnnotation";else if("\n"===h)f=h,c="startTagAnnotation";else if("."===h)c="startTagClass";else{if(">"===h)return e(b,1),g.tagName=d.join(""),g.type="startTag",g;if(""===h)return g.tagName=d.join(""),g.type="startTag",g;d.push(h)}else if("startTagClass"===c)if(" "===h||"\f"===h||" "===h)g.classes.push(f),f="",c="startTagAnnotation";else if("\n"===h)g.classes.push(f),f=h,c="startTagAnnotation";else if("."===h)g.classes.push(f),f="";else{if(">"===h)return e(b,1),g.classes.push(f),g.type="startTag",g.tagName=d.join(""),g;if(""===h)return g.classes.push(f),g.type="startTag",g.tagName=d.join(""),g;f+="c"}else if("startTagAnnotation"===c){if(">"===h)return e(b,1),f=a.trim(f).replace(/ +/," "),g.type="startTag",g.tagName=d.join(""),g.annotation=f,g;if(""===h)return f=a.trim(f).replace(/ +/," "),g.type="startTag",g.tagName=d.join(""),g.annotation=f,g;f+=h}else if("endTag"===c){if(">"===h)return e(b,1),g.type="endTag",g.tagName=d.join(""),g;if(""===h)return g.type="endTag",g.tagName=d.join(""),g;d.push(h)}else{if("timestampTag"!==c)throw"Unknown tokenState "+c;if(">"===h)return e(b,1),g.type="timestampTag",g.name=d.join(""),g;if(""===h)return g.type="timestampTag",g.name=d.join(""),g;d.push(h)}e(b,1)}}function r(b){var c=f(b);if(-1!==c.indexOf("-->"))return void(b.error="Invalid syntax: --> in NOTE line.");for(;;){var d=g(b);if(0===a.trim(d).length)return;if(-1!==d.indexOf("-->"))return void(b.error="Invalid syntax: --> in comment.");f(b)}}function s(a){""===a.text[0]&&e(a,1)}function t(a){"WEBVTT"===a.text.substring(0,6)?e(a,6):a.error="Invalid signature."}function u(a){a.text.length<3||"-->"!==a.text.substring(0,3)?a.error="Missing -->":e(a,3)}function v(a){for(;" "===a.text[0]||" "===a.text[0];)e(a,1)}function w(a){for(var b=0;" "===a.text[0]||" "===a.text[0];)e(a,1),b+=1;0===b&&(a.error="Missing space.")}function x(a){var b=a.text.indexOf("\n");-1===b?a.error="Missing EOL.":e(a,b+1)}function y(b){for(;b.text.length>0;){var c=g(b);if(0!==a.trim(c).length)break;f(b)}}function z(b){for(var c=0;b.text.length>0;){var d=g(b);if(0!==a.trim(d).length)break;f(b),c+=1}0===c&&(b.error="Missing empty line.")}function A(a){var b=j(a.text);if(-1===b)return void a.error("Missing timing.");var c=e(a,b),d=/((\d\d):)?((\d\d):)(\d\d).(\d\d\d)|(\d+).(\d\d\d)/.exec(c);if(!d)return void(a.error="Unable to parse timestamp.");var f=0,g=d[2],h=d[4];if(h){if(parseInt(h,10)>59)return void(a.error="Invalid minute range.");g&&(f+=3600*parseInt(g,10)),f+=60*parseInt(h,10);var i=d[5];if(parseInt(i,10)>59)return void(a.error="Invalid second range.");f+=parseInt(i,10),f+=parseInt(d[6],10)/1e3}else f+=parseInt(d[7],10),f+=parseInt(d[8],10)/1e3;return f}AblePlayer.prototype.parseWebVTT=function(a){a=a.replace(/(\r\n|\n|\r)/g,"\n");var b={text:a,error:null,metadata:{},cues:[],line:1,column:1};try{c(b,h)}catch(d){}return b}}(jQuery),function(a){AblePlayer.prototype.injectPlayerCode=function(){if(this.$mediaContainer=this.$media.wrap('
').parent(),this.$ableDiv=this.$mediaContainer.wrap('
').parent(),this.$mediaContainer.width(this.playerWidth),"video"==this.mediaType&&this.$mediaContainer.height(this.playerHeight),this.$ableDiv.width(this.playerWidth),this.injectOffscreenHeading(),"video"===this.mediaType&&"youtube"!==this.player){this.injectBigPlayButton();var b=a("
",{"class":"able-vidcap-container"});this.$vidcapContainer=this.$mediaContainer.wrap(b).parent()}this.injectPlayerControlArea(),this.injectTextDescriptionArea(),this.includeTranscript&&(this.injectTranscriptArea(),this.addTranscriptAreaEvents()),this.injectAlert(),this.injectPlaylist(),this.injectPrefsForm()},AblePlayer.prototype.injectOffscreenHeading=function(){var b,c=this.$ableDiv.parents();if(c.each(function(){var c=a(this),d=c.find("h1, h2, h3, h4, h5, h6"),e=d.length;return e?(b=d.eq(e-1).prop("tagName"),!1):void 0}),"undefined"==typeof b)var b="h1";else{var d=parseInt(b[1]);d+=1,d>6&&(d=6),b="h"+d.toString()}this.playerHeadingLevel=d,this.$headingDiv=a("<"+b+">"),this.$ableDiv.prepend(this.$headingDiv),this.$headingDiv.addClass("able-offscreen"),this.$headingDiv.text(this.tt.playerHeading)},AblePlayer.prototype.injectBigPlayButton=function(){this.$bigPlayButton=a(""),j.click(function(){k.hide()}),b.append(j),this.helpDialog=k},AblePlayer.prototype.calculateControlLayout=function(){var a={ul:["play","stop"],ur:[],bl:[],br:[]};this.useSlider&&(a.ur.push("rewind"),a.ur.push("seek"),a.ur.push("forward"));var b=[];this.browserSupportsVolume()&&(b.push("mute"),b.push("volume-up"),b.push("volume-down"));var c=[];return"video"===this.mediaType&&(this.hasCaptions&&c.push("captions"),this.hasSignLanguage&&c.push("sign"),(this.hasOpenDesc||this.hasClosedDesc)&&c.push("descriptions")),this.includeTranscript&&this.useTranscriptButton&&c.push("transcript"),this.isPlaybackRateSupported()&&(c.push("slower"),c.push("faster")),"video"===this.mediaType&&this.hasChapters&&c.push("chapters"),b.length>0&&c.length>0?(a.bl=b,a.bl.push("pipe"),a.bl=a.bl.concat(c)):a.bl=b.concat(c),a.br.push("preferences"),a.br.push("help"),"video"===this.mediaType&&"jw"!==this.player&&a.br.push("fullscreen"),a},AblePlayer.prototype.addControls=function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q=100,r=this.calculateControlLayout(),s={0:"ul",1:"ur",2:"bl",3:"br"};for(f=this.mediaId+"-tooltip",g=a("
",{id:f,"class":"able-tooltip"}),this.$controllerDiv.append(g),b=0;3>=b;b++){for(d=r[s[b]],e=b%2===0?a("",{"class":"able-left-controls"}):a("",{"class":"able-right-controls"}),this.$controllerDiv.append(e),c=0;c
');e.append(t),this.seekBar=new AccessibleSeekBar(t,q)}else if("pipe"===h){var u=a("",{tabindex:"-1","aria-hidden":"true"});if("font"===this.iconType)u.addClass("icon-pipe");else{var v=a("",{src:"../images/"+this.iconColor+"/pipe.png",alt:"",role:"presentation"});u.append(v)}e.append(u)}else{j="mute"===h?"../images/"+this.iconColor+"/volume-mute.png":"fullscreen"===h?"../images/"+this.iconColor+"/fullscreen-expand.png":"../images/"+this.iconColor+"/"+h+".png",k=this.getButtonTitle(h),l=a(""),k=a('");j.click(function(){var e=a("#"+c).val();e!==d&&(b.$activeWindow.css("width",e),b.$activeWindow.find("video").css({width:e+"px"})),b.resizeDialog.hide(),b.$windowPopup.hide(),b.$windowButton.show().focus()}),k.click(function(){dialog.hide()}),g.append(i,h),f.append(g),e.append(f,"
",j,k),a("body").append(e),this.resizeDialog=new AccessibleDialog(e,"alert",this.tt.windowResizeHeading,f,this.tt.closeButtonLabel,"20em")},AblePlayer.prototype.handleWindowButtonClick=function(a){return a.which>1&&32!==a.which&&13!==a.which?!1:this.hidingPopup?(this.hidingPopup=!1,!1):(this.$windowButton.hide(),this.$windowPopup.show(),this.$windowPopup.find("li").removeClass("able-focus"),this.$windowPopup.find("input:checked").val()?this.$windowPopup.find("input:checked").focus().parent().addClass("able-focus"):this.$windowPopup.find("input").first().focus().parent().addClass("able-focus"),void a.preventDefault())},AblePlayer.prototype.handleMenuChoice=function(a){var b=this;if("move"==a)this.showAlert(this.tt.windowMoveAlert,"sign"),b.startDrag(),this.$windowPopup.hide().parent().focus();else if("resize"==a)this.resizeDialog.show(),this.showAlert(this.tt.windowResizeAlert,"sign");else if("sendBack"==a){this.$activeWindow.css("z-index","0"),this.$windowPopup.css("z-index","4000").hide(),this.$windowButton.show().focus(),this.showAlert(this.tt.windowSendBackAlert,"sign");var c=this.$windowPopup.find("input:last");c.val("bringTop"),c.next("label").text(this.tt.windowBringTop)}else if("bringTop"==a){this.$activeWindow.css({"z-index":"4000"}),this.$windowPopup.hide(),this.$windowButton.show().focus(),this.showAlert(this.tt.windowBringTopAlert,"sign");var c=this.$windowPopup.find("input:last");c.val("sendBack"),c.next("label").text(this.tt.windowSendBack)}},AblePlayer.prototype.startDrag=function(){var b,c,d,e;return b=this,this.$activeWindow.addClass("able-drag").css({position:"absolute",top:this.dragStartY+"px",left:this.dragStartX+"px"}),c=this.$activeWindow.offset(),this.dragStartX=this.dXKeys=c.left,this.dragStartY=this.dYKeys=c.top,a(document).on("mousedown",function(a){b.dragging=!0,b.startMouseX=a.pageX,b.startMouseY=a.pageY,b.dragOffsetX=b.startMouseX-b.dragStartX,b.dragOffsetY=b.startMouseY-b.dragStartY}),a(document).on("mousemove",function(a){b.dragging&&(d=a.pageX-b.dragOffsetX,e=a.pageY-b.dragOffsetY,b.resetDraggedObject(d,e))}),a(document).on("mouseup",function(){b.dragging&&b.dragEnd()}),this.startingDrag=!0,this.$activeWindow.on("keydown",function(a){b.dragKeys(a)}),!1},AblePlayer.prototype.dragKeys=function(a){var b,c;if(this.startingDrag)return this.startingDrag=!1,!1;switch(b=a.which,c=10,b){case 37:case 63234:this.dXKeys-=c;break;case 38:case 63232:this.dYKeys-=c;break;case 39:case 63235:this.dXKeys+=c;break;case 40:case 63233:this.dYKeys+=c;break;case 13:case 27:return this.dragEnd(),!1;default:return!1}return this.resetDraggedObject(this.dXKeys,this.dYKeys),a.preventDefault&&a.preventDefault(),!1},AblePlayer.prototype.resetDraggedObject=function(a,b){this.$activeWindow.css({left:a+"px",top:b+"px"})},AblePlayer.prototype.dragEnd=function(){a(document).off("mousemove mouseup"),this.$activeWindow.off("keydown").removeClass("able-drag"),this.hidingPopup=!0,this.$windowPopup.hide(),this.$windowButton.show().focus(),this.dragging=!1}}(jQuery),function(a){AblePlayer.prototype.initSignLanguage=function(){"html5"===this.player&&this.prefSignLanguage&&(this.signFile=this.$sources.first().attr("data-sign-src"),this.signFile?(this.debug,this.hasSignLanguage=!0,this.injectSignPlayerCode()):this.hasSignLanguage=!1)},AblePlayer.prototype.injectSignPlayerCode=function(){var b,c,d,e,f,g;for(b=this,c=this.mediaId+"-sign",this.$signVideo=a("