PageSourceSearch

https://heritage.edu/wp-content/themes/enfold/config-templatebuild…/audio-player/audio-player.js?ver=5.6.12

js heritage.edu collected 2026-09-24 09:38:10 UTC 2,360 bytes, 101 lines download raw bytes

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 ) 
34		{
35			return;
36		} 
37
38		return this.each(function()
39		{
40			var _self 			= {};
41			
42			_self.container = $( this );
43			_self.stopLoop = false;
44			
45			_self.container.find('audio').on( 'play', function() 
46			{
47					if( _self.stopLoop )
48					{
49						this.pause();
50						_self.stopLoop = false;
51					}
52			});
53			
54			if( _self.container.hasClass( 'avia-playlist-no-loop' ) )
55			{
56				_self.container.find('audio').on( 'ended', function() 
57				{
58					//	find the last track in the playlist so that when the last track ends we can pause the audio object
59					var lastTrack = _self.container.find('.wp-playlist-tracks .wp-playlist-item').last().find( 'a' );
60
61					//	fix for non ascii characters in URL
62					try
63					{
64						var lastURI = decodeURI( lastTrack.attr('href') );
65						var currentURI = decodeURI( this.currentSrc );
66						
67						if ( currentURI === lastURI ) 
68						{
69							_self.stopLoop = true;
70						}
71					}
72					catch( e )
73					{
74						//	in case of a malformed URI continue
75						_self.stopLoop = false;
76					}
77				});
78			}
79			
80			/**
81			 * Limit autostart to the first player with this option set only
82			 * 
83			 * DOM is not loaded completely and we have no event when player is loaded.
84			 * We check for play button and perform a click
85			 */
86			if( _self.container.hasClass( 'avia-playlist-autoplay' ) && ! autostarted )
87			{
88				if( ( _self.container.css('display') == 'none') || ( _self.container.css("visibility") == "hidden" ) )
89				{
90					return;
91				}
92				
93				autostarted = true;
94				setTimeout( function(){
95							monitorStart( _self.container, _self );
96						}, 200 );
97			}
98			
99		});
100	};
101}(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.