1// ------------------------------------------------------------------------------------------- 2// 3// AVIA Player 4// 5// ------------------------------------------------------------------------------------------- 6(function($) 7{ 8 "use strict"; 9 10 var autostarted = false, 11 container = null, 12 13 monitorStart = function( container ) 14 { 15 var play_pause = container.find('.av-player-player-container .mejs-playpause-button'); 16 17 if( play_pause.length == 0 ) 18 { 19 setTimeout( function(){ 20 monitorStart( container ); 21 }, 200 ); 22 } 23 24 if( ! play_pause.hasClass('mejs-pause') ) 25 { 26 play_pause.trigger( 'click' ); 27 } 28 29 }; 30 31 $.fn.aviaPlayer = function( options ) 32 { 33 if( ! this.length ) return; 34 35 return this.each(function() 36 { 37 var _self = {}; 38 39 _self.container = $( this ); 40 _self.stopLoop = false; 41 42 _self.container.find('audio').on('play', function() { 43 if( _self.stopLoop ) 44 { 45 this.pause(); 46 _self.stopLoop = false; 47 } 48 49 }); 50 51 if( _self.container.hasClass( 'avia-playlist-no-loop' ) ) 52 { 53 _self.container.find('audio').on('ended', function() { 54 // find the last track in the playlist so that when the last track ends we can pause the audio object 55 var lastTrack = _self.container.find('.wp-playlist-tracks .wp-playlist-item:last a'); 56 57 if ( this.currentSrc === lastTrack.attr('href') ) { 58 _self.stopLoop = true; 59 } 60 61 }); 62 } 63 64 /** 65 * Limit autostart to the first player with this option set only 66 * 67 * DOM is not loaded completely and we have no event when player is loaded. 68 * We check for play button and perform a click 69 */ 70 if( _self.container.hasClass( 'avia-playlist-autoplay' ) && ! autostarted ) 71 { 72 if( ( _self.container.css('display') == 'none') || ( _self.container.css("visibility") == "hidden" ) ) 73 { 74 return; 75 } 76 77 autostarted = true; 78 setTimeout( function(){ 79 monitorStart( _self.container, _self ); 80 }, 200 ); 81 } 82 83 }); 84 }; 85}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.