1- /*! ableplayer V4.7.0-beta1 with DOMPurify included */
1+ /*! ableplayer V4.7.0 with DOMPurify included */
22/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
33
44( function ( global , factory ) {
@@ -1486,7 +1486,7 @@ var AblePlayerInstances = [];
14861486 break ;
14871487
14881488 case 'slower' :
1489- svg [ 0 ] = '0 0 20 20' ;
1489+ svg [ 0 ] = '0 0 11 20' ;
14901490 svg [ 1 ] = 'M0 7.321q0-0.29 0.212-0.502t0.502-0.212h10q0.29 0 0.502 0.212t0.212 0.502-0.212 0.502l-5 5q-0.212 0.212-0.502 0.212t-0.502-0.212l-5-5q-0.212-0.212-0.212-0.502z' ;
14911491 svg [ 2 ] = 'icon-slower' ;
14921492 svg [ 3 ] = this . slowerButtonImg ;
@@ -3694,7 +3694,7 @@ var AblePlayerInstances = [];
36943694
36953695 AblePlayer . prototype . injectBigPlayButton = function ( ) {
36963696
3697- var thisObj , svgData , buttonIcon , svgPath ;
3697+ var thisObj ;
36983698
36993699 thisObj = this ;
37003700
@@ -5012,7 +5012,7 @@ var postProcessing = {
50125012 return vttContent . replace (
50135013 / < c c l a s s = " ( [ \w \s ] + ) " > / g,
50145014 function ( _ , classNames ) {
5015- var classes = classNames . replace ( / \. / g, " " ) ;
5015+ var classes = classNames . replace ( / / g, ". " ) ;
50165016 return "<c." + classes + ">" ;
50175017 }
50185018 ) ;
@@ -6450,8 +6450,12 @@ if (typeof module !== "undefined" && module.exports) {
64506450 modal . attr ( {
64516451 'aria-labelledby' : 'modalTitle-' + this . baseId ,
64526452 } ) ;
6453- modal . prepend ( titleH1 ) ;
6454- modal . prepend ( closeButton ) ;
6453+ var modalHeader = $ ( '<div>' , {
6454+ 'class' : 'able-modal-header'
6455+ } ) ;
6456+ modalHeader . prepend ( titleH1 ) ;
6457+ modalHeader . prepend ( closeButton ) ;
6458+ modal . prepend ( modalHeader ) ;
64556459 }
64566460
64576461 modal . attr ( {
@@ -7539,6 +7543,11 @@ if (typeof module !== "undefined" && module.exports) {
75397543 this . youTubeSignPlayer . playVideo ( ) ;
75407544 }
75417545 }
7546+ if ( options && typeof options . volume !== 'undefined' ) {
7547+ if ( this . signVideo ) {
7548+ this . signVideo . volume = 0 ;
7549+ }
7550+ }
75427551 }
75437552 } ;
75447553
@@ -7722,7 +7731,7 @@ if (typeof module !== "undefined" && module.exports) {
77227731 }
77237732 }
77247733
7725- if ( context === 'descriptions' || context == 'init' ) {
7734+ if ( context === 'descriptions' || context == 'init' ) {
77267735 if ( this . $descButton ) {
77277736 this . toggleButtonState (
77287737 this . $descButton ,
@@ -7777,14 +7786,6 @@ if (typeof module !== "undefined" && module.exports) {
77777786 if ( ! this . hideBigPlayButton ) {
77787787 this . $bigPlayButton . show ( ) ;
77797788 this . $bigPlayButton . attr ( 'aria-hidden' , 'false' ) ;
7780-
7781- }
7782- if ( this . fullscreen ) {
7783- this . $bigPlayButton . width ( $ ( window ) . width ( ) ) ;
7784- this . $bigPlayButton . height ( $ ( window ) . height ( ) ) ;
7785- } else {
7786- this . $bigPlayButton . width ( this . $mediaContainer . width ( ) ) ;
7787- this . $bigPlayButton . height ( this . $mediaContainer . height ( ) ) ;
77887789 }
77897790 } else {
77907791 this . $bigPlayButton . hide ( ) ;
@@ -7908,7 +7909,6 @@ if (typeof module !== "undefined" && module.exports) {
79087909 } ;
79097910
79107911 AblePlayer . prototype . handlePlay = function ( e ) {
7911-
79127912 if ( this . paused ) {
79137913 this . okToPlay = true ;
79147914 this . playMedia ( ) ;
@@ -8031,7 +8031,7 @@ if (typeof module !== "undefined" && module.exports) {
80318031 AblePlayer . prototype . handleCaptionToggle = function ( ) {
80328032
80338033 var thisObj = this ;
8034- var captions ;
8034+ var captions , ariaPressed ;
80358035 if ( this . hidingPopup ) {
80368036 this . hidingPopup = false ;
80378037 return false ;
@@ -8042,7 +8042,7 @@ if (typeof module !== "undefined" && module.exports) {
80428042 if ( this . captionsOn === true ) {
80438043 this . captionsOn = false ;
80448044 this . prefCaptions = 0 ;
8045- this . $ccButton . attr ( 'aria-pressed' , ' false' ) ;
8045+ ariaPressed = false ;
80468046 this . updateCookie ( 'prefCaptions' ) ;
80478047 if ( this . usingYouTubeCaptions ) {
80488048 this . youTubePlayer . unloadModule ( 'captions' ) ;
@@ -8054,7 +8054,7 @@ if (typeof module !== "undefined" && module.exports) {
80548054 } else {
80558055 this . captionsOn = true ;
80568056 this . prefCaptions = 1 ;
8057- this . $ccButton . attr ( 'aria-pressed' , ' true' ) ;
8057+ ariaPressed = true ;
80588058 this . updateCookie ( 'prefCaptions' ) ;
80598059 if ( this . usingYouTubeCaptions ) {
80608060 this . youTubePlayer . loadModule ( 'captions' ) ;
@@ -8086,7 +8086,6 @@ if (typeof module !== "undefined" && module.exports) {
80868086 this . selectedDescriptions = this . descriptions [ 0 ] ;
80878087 }
80888088 }
8089- this . refreshControls ( 'captions' ) ;
80908089 } else {
80918090 if ( this . captionsPopup && this . captionsPopup . is ( ':visible' ) ) {
80928091 this . captionsPopup . hide ( ) ;
@@ -8108,6 +8107,16 @@ if (typeof module !== "undefined" && module.exports) {
81088107 }
81098108 }
81108109 }
8110+ var ariaLabelOn = ( captions . length > 1 ) ? this . tt . captions : this . tt . showCaptions ;
8111+ var ariaLabelOff = ( captions . length > 1 ) ? this . tt . captions : this . tt . hideCaptions ;
8112+
8113+ this . toggleButtonState (
8114+ this . $ccButton ,
8115+ this . captionsOn ,
8116+ ariaLabelOff ,
8117+ ariaLabelOn ,
8118+ ariaPressed
8119+ ) ;
81118120 } ;
81128121
81138122 AblePlayer . prototype . waitThenFocus = function ( $el , timeout ) {
@@ -8206,12 +8215,11 @@ if (typeof module !== "undefined" && module.exports) {
82068215 } ;
82078216
82088217 AblePlayer . prototype . handleTranscriptToggle = function ( ) {
8209-
82108218 var thisObj = this ;
82118219 var visible = this . $transcriptDiv . is ( ':visible' ) ;
82128220 if ( visible ) {
82138221 this . $transcriptArea . hide ( ) ;
8214- this . toggleButtonState ( this . $transcriptButton , visible , this . tt . hideTranscript , this . tt . showTranscript ) ;
8222+ this . toggleButtonState ( this . $transcriptButton , ! visible , this . tt . hideTranscript , this . tt . showTranscript ) ;
82158223 this . prefTranscript = 0 ;
82168224 if ( this . transcriptType === 'popup' ) {
82178225 this . $transcriptButton . trigger ( 'focus' ) . addClass ( 'able-focus' ) ;
@@ -8224,15 +8232,15 @@ if (typeof module !== "undefined" && module.exports) {
82248232 this . positionDraggableWindow ( 'transcript' ) ;
82258233 this . $transcriptArea . show ( ) ;
82268234 this . $transcriptPopup . hide ( ) ;
8227- this . toggleButtonState ( this . $transcriptButton , visible , this . tt . hideTranscript , this . tt . showTranscript ) ;
8235+ this . toggleButtonState ( this . $transcriptButton , ! visible , this . tt . hideTranscript , this . tt . showTranscript ) ;
82288236 this . prefTranscript = 1 ;
82298237 this . focusNotClick = true ;
82308238 this . $transcriptArea . find ( 'button' ) . first ( ) . trigger ( 'focus' ) ;
82318239 setTimeout ( function ( ) {
82328240 thisObj . focusNotClick = false ;
82338241 } , 100 ) ;
82348242 } else {
8235- this . toggleButtonState ( this . $transcriptButton , visible , this . tt . hideTranscript , this . tt . showTranscript ) ;
8243+ this . toggleButtonState ( this . $transcriptButton , ! visible , this . tt . hideTranscript , this . tt . showTranscript ) ;
82368244 this . $transcriptArea . show ( ) ;
82378245 }
82388246 }
@@ -8245,7 +8253,7 @@ if (typeof module !== "undefined" && module.exports) {
82458253 var visible = this . $signWindow . is ( ':visible' ) ;
82468254 if ( visible ) {
82478255 this . $signWindow . hide ( ) ;
8248- this . toggleButtonState ( this . $signButton , visible , this . tt . hideSign , this . tt . showSign ) ;
8256+ this . toggleButtonState ( this . $signButton , ! visible , this . tt . hideSign , this . tt . showSign ) ;
82498257 this . prefSign = 0 ;
82508258 this . $signButton . trigger ( 'focus' ) . addClass ( 'able-focus' ) ;
82518259 setTimeout ( function ( ) {
@@ -8255,7 +8263,7 @@ if (typeof module !== "undefined" && module.exports) {
82558263 this . positionDraggableWindow ( 'sign' ) ;
82568264 this . $signWindow . show ( ) ;
82578265 this . $signPopup . hide ( ) ;
8258- this . toggleButtonState ( this . $signButton , visible , this . tt . hideSign , this . tt . showSign ) ;
8266+ this . toggleButtonState ( this . $signButton , ! visible , this . tt . hideSign , this . tt . showSign ) ;
82598267 this . prefSign = 1 ;
82608268 this . focusNotClick = true ;
82618269 this . $signWindow . find ( 'button' ) . first ( ) . trigger ( 'focus' ) ;
@@ -8453,24 +8461,28 @@ if (typeof module !== "undefined" && module.exports) {
84538461 $button . append ( $buttonLabel ) ;
84548462 } ;
84558463
8456- AblePlayer . prototype . toggleButtonState = function ( $button , isOn , onLabel , offLabel , offClass = 'buttonOff' , ariaPressed = false , ariaExpanded = false ) {
8457- if ( isOn ) {
8458- $button . removeClass ( offClass ) . attr ( 'aria-label' , onLabel ) ;
8459- $button . find ( 'span.able-clipped' ) . text ( onLabel ) ;
8464+ AblePlayer . prototype . toggleButtonState = function ( $button , isOn , onLabel , offLabel , ariaPressed = false , ariaExpanded = false ) {
8465+ let buttonOff = ( $button . hasClass ( 'buttonOff' ) ) ? true : false ;
8466+ if ( buttonOff && ! isOn || ! buttonOff && isOn ) {
8467+ return ;
8468+ }
8469+ if ( ! isOn ) {
8470+ $button . addClass ( 'buttonOff' ) . attr ( 'aria-label' , offLabel ) ;
8471+ $button . find ( 'span.able-clipped' ) . text ( offLabel ) ;
84608472 if ( ariaPressed ) {
8461- $button . attr ( 'aria-pressed' , 'true ' ) ;
8473+ $button . attr ( 'aria-pressed' , 'false ' ) ;
84628474 }
84638475 if ( ariaExpanded ) {
8464- $button . attr ( 'aria-expanded' , 'true ' ) ;
8476+ $button . attr ( 'aria-expanded' , 'false ' ) ;
84658477 }
84668478 } else {
8467- $button . addClass ( offClass ) . attr ( 'aria-label' , offLabel ) ;
8468- $button . find ( 'span.able-clipped' ) . text ( offLabel ) ;
8479+ $button . removeClass ( 'buttonOff' ) . attr ( 'aria-label' , onLabel ) ;
8480+ $button . find ( 'span.able-clipped' ) . text ( onLabel ) ;
84698481 if ( ariaPressed ) {
8470- $button . attr ( 'aria-pressed' , 'false ' ) ;
8482+ $button . attr ( 'aria-pressed' , 'true ' ) ;
84718483 }
84728484 if ( ariaExpanded ) {
8473- $button . attr ( 'aria-expanded' , 'false ' ) ;
8485+ $button . attr ( 'aria-expanded' , 'true ' ) ;
84748486 }
84758487 }
84768488 } ;
@@ -10612,9 +10624,7 @@ if (typeof module !== "undefined" && module.exports) {
1061210624 } ;
1061310625
1061410626 AblePlayer . prototype . onClickPlayerButton = function ( el ) {
10615-
1061610627 var whichButton , prefsPopup ;
10617-
1061810628 whichButton = this . getButtonNameFromClass ( $ ( el ) . attr ( 'class' ) ) ;
1061910629 switch ( whichButton ) {
1062010630 case 'play' :
@@ -10845,17 +10855,13 @@ if (typeof module !== "undefined" && module.exports) {
1084510855 } )
1084610856 . on ( 'loadedmetadata' , function ( ) {
1084710857 thisObj . duration = thisObj . media . duration ;
10848- var x = 50.5 ;
10849- var y = 51.9 ;
10850- var diff = Math . abs ( Math . round ( x ) - Math . round ( y ) ) ;
1085110858 } )
1085210859 . on ( 'canplay' , function ( ) {
1085310860 } )
1085410861 . on ( 'canplaythrough' , function ( ) {
10855- thisObj . onMediaNewSourceLoad ( ) ;
10862+ thisObj . onMediaNewSourceLoad ( ) ;
1085610863 } )
1085710864 . on ( 'play' , function ( ) {
10858- thisObj . refreshControls ( 'playpause' ) ;
1085910865 } )
1086010866 . on ( 'playing' , function ( ) {
1086110867 thisObj . playing = true ;
@@ -10977,7 +10983,6 @@ if (typeof module !== "undefined" && module.exports) {
1097710983 } ;
1097810984
1097910985 AblePlayer . prototype . addEventListeners = function ( ) {
10980-
1098110986 var thisObj = this ;
1098210987
1098310988 $ ( window ) . on ( 'resize' , function ( ) {
@@ -11018,7 +11023,7 @@ if (typeof module !== "undefined" && module.exports) {
1101811023 if ( e . button !== 0 ) {
1101911024 return false ;
1102011025 }
11021- if ( $ ( '.able-popup:visible' ) . length || $ ( '.able-volume-popup :visible' ) ) {
11026+ if ( $ ( '.able-popup:visible' ) . length || $ ( '.able-volume-slider :visible' ) . length ) {
1102211027 thisObj . closePopups ( ) ;
1102311028 }
1102411029 if ( e . target . tagName === 'VIDEO' ) {
@@ -11771,23 +11776,22 @@ if (typeof module !== "undefined" && module.exports) {
1177111776
1177211777( function ( $ ) {
1177311778 AblePlayer . prototype . initSignLanguage = function ( ) {
11774-
11775- var hasLocalSrc = ( this . $media . data ( ' sign-src') !== undefined && this . $media . data ( ' sign-src') !== "" ) ;
11779+ this . hasSignLanguage = false ;
11780+ var hasLocalSrc = ( this . $sources . first ( ) . attr ( 'data- sign-src') !== undefined && this . $sources . first ( ) . attr ( 'data- sign-src') !== "" ) ;
1177611781 var hasRemoteSrc = ( this . $media . data ( 'youtube-sign-src' ) !== undefined && this . $media . data ( 'youtube-sign-src' ) !== "" ) ;
11777- if ( ! this . isIOS ( ) && ( hasLocalSrc || hasRemoteSrc ) ) {
11778- this . hasSignLanguage = true ;
11782+ var hasRemoteSource = ( this . $sources . first ( ) . attr ( 'data-youtube-sign-src' ) !== undefined && this . $sources . first ( ) . attr ( 'data-youtube-sign-src' ) !== '' ) ;
11783+ if ( ! this . isIOS ( ) && ( hasLocalSrc || hasRemoteSrc || hasRemoteSource ) && ( this . player === 'html5' || this . player === 'youtube' ) ) {
11784+ let ytSignSrc = this . youTubeSignId ?? DOMPurify . sanitize ( this . $sources . first ( ) . attr ( 'data-youtube-sign-src' ) ) ;
11785+ let signSrc = DOMPurify . sanitize ( this . $sources . first ( ) . attr ( 'data-sign-src' ) ) ;
11786+ let signVideo = DOMPurify . sanitize ( this . $media . data ( 'youtube-sign-src' ) ) ;
11787+ this . signFile = ( hasLocalSrc ) ? signSrc : false ;
1177911788 if ( hasRemoteSrc ) {
11780- this . signYoutubeId = this . youTubeSignId ;
11789+ this . signYoutubeId = signVideo ;
11790+ } else if ( hasRemoteSource ) {
11791+ this . signYoutubeId = ytSignSrc ;
1178111792 }
11782- this . injectSignPlayerCode ( ) ;
11783- return ;
11784- }
11785- if ( this . player === 'html5' ) {
11786- this . signYoutubeId = this . youTubeSignId ?? DOMPurify . sanitize ( this . $sources . first ( ) . attr ( 'data-youtube-sign-src' ) ) ;
11787- this . signFile = DOMPurify . sanitize ( this . $sources . first ( ) . attr ( 'data-sign-src' ) ) ;
11788- if ( this . signFile || this . signYoutubeId ) {
11793+ if ( this . signFile || this . signYoutubeId ) {
1178911794 if ( this . isIOS ( ) ) {
11790- this . hasSignLanguage = false ;
1179111795 if ( this . debug ) {
1179211796
1179311797 }
@@ -11798,11 +11802,7 @@ if (typeof module !== "undefined" && module.exports) {
1179811802 this . hasSignLanguage = true ;
1179911803 this . injectSignPlayerCode ( ) ;
1180011804 }
11801- } else {
11802- this . hasSignLanguage = false ;
1180311805 }
11804- } else {
11805- this . hasSignLanguage = false ;
1180611806 }
1180711807 } ;
1180811808
@@ -13019,8 +13019,16 @@ if (typeof module !== "undefined" && module.exports) {
1301913019 } )
1302013020 . fail ( function ( ) {
1302113021
13022- thisObj . provideFallback ( ) ;
13023- deferred . fail ( ) ;
13022+ translationFile = thisObj . rootPath + 'translations/' + thisObj . lang + '.js' ;
13023+ $ . getJSON ( translationFile , function ( data ) {
13024+ thisObj . tt = data ;
13025+ deferred . resolve ( ) ;
13026+ } )
13027+ . fail ( function ( ) {
13028+
13029+ thisObj . provideFallback ( ) ;
13030+ deferred . fail ( ) ;
13031+ } ) ;
1302413032 } )
1302513033 return deferred . promise ( ) ;
1302613034 } ;
0 commit comments