PageSourceSearch

https://keepitdusty.com/wp-content/themes/muzak5/js/ci_audioplayer.js?ver=4.2

js keepitdusty.com collected 2026-10-07 23:22:58 UTC 5,401 bytes, 179 lines download raw bytes

1jQuery(document).ready(function($) {
2	"use strict";
3
4	var player       = $(".ci-soundplayer"),
5			tracklisting = $(".ci-soundplayer-tracklist"),
6			tracks       =  tracklisting.find('li');
7
8	soundManager.setup({
9		flashVersion: 9,
10		preferFlash: false,
11		onready: function() {
12
13			tracks.each(function() {
14				var that = $(this);
15
16				soundManager.createSound({
17					id: 'track_' + that.index(),
18					url: that.find('a').attr('href'),
19					onload: function() {
20
21					},
22					onplay: function() {
23						player.addClass('playing');
24						$('.track-title').text(that.text());
25
26						if ( player.hasClass('ci-current-track') && player.hasClass('ci-streaming') ) {
27							var uri = document.createElement('a');
28							uri.href = this.url;
29
30							$.SHOUTcast({
31								host : uri.hostname,
32								port : uri.port,
33								interval : 10000,
34								stats: function() {
35									$('.track-title').text(this.get('songtitle'));
36								}
37							}).startStats();
38						}
39					},
40					onresume: function() {
41						player.addClass('playing');
42					},
43					onpause: function() {
44						player.removeClass('playing');
45					},
46					onfinish: function() {
47						nextTrack();
48					},
49					whileplaying: function() {
50						$(".progress-bar").css('width', ((this.position/this.duration) * 100) + '%');
51						var trackTime = getTime(this.position, true);
52						$('.track-position').text(trackTime);
53					},
54					whileloading: function() {
55						//$(".load-bar").css('width', ((this.bytesLoaded / this.bytesTotal) * 100) + '%');
56					}
57				});
58			});
59
60			// ## GUI Actions
61
62			// Let's prevent default click action from all player links
63			player.find('a').on('click', function(e) {
64				e.preventDefault();
65			});
66
67			// Get the first track displayed in the track title
68			$('.track-title').text(tracklisting.find('> :first-child').text());
69
70			// Bind a click event to each track item in the list.
71			// This basically handles all the play functionality,
72			// the play button on the player controls actually triggers
73			// a click in that specific item.
74			tracks.on('click', function() {
75				// find out if it's already playing *(set to active)*
76
77				var that = $(this),
78						isTrackPlaying = that.is('.active');
79
80				if ( isTrackPlaying ) {
81					// If it is playing: pause it.
82					soundManager.pause('track_' + that.index());
83				} else {
84					// If it's not playing: stop all other sounds that might be playing and play the clicked sound.
85					if ( that.siblings('li').hasClass('active') ) {
86						soundManager.stopAll();
87					}
88
89					soundManager.play('track_' + that.index());
90				}
91
92				// Finally, toggle the *active* state of the clicked li and remove *active* from and other tracks.
93				that.toggleClass('active').siblings('li').removeClass('active');
94
95			});
96
97		// Bind a click event to the play / pause button.
98		$('.ci-soundplayer-play, .ci-soundplayer-pause').on('click', function() {
99
100			if ( tracks.hasClass('active') == true ) {
101
102				// If a track is active, play or pause it depending on current state.
103				soundManager.togglePause( 'track_' + $('.ci-soundplayer-tracklist li.active').index() );
104			} else {
105				// If no tracks are active, just play the first one.
106				tracklisting.find('li:first').click();
107			}
108		});
109
110			// Previous + Next Track functionality follows
111
112			$('.ci-soundplayer-next').on('click', function() {
113				nextTrack();
114			});
115
116			$('.ci-soundplayer-prev').on('click', function() {
117				prevTrack();
118			});
119
120			var nextTrack = function() {
121
122				// Stop all sounds
123				soundManager.stopAll();
124
125				// Click the next list item after the current active one.
126				// If it does not exist *(there is no next track)*, click the first list item.
127				if ( tracklisting.find('li.active').next().click().length == 0 ) {
128					tracklisting.find('li:first').click();
129				}
130			}; // nextTrack()
131
132			var prevTrack = function(){
133
134				// Stop all sounds
135				soundManager.stopAll();
136
137				// Click the previous list item after the current active one.
138				// If it does not exist *(there is no previous track)*, click the last list item.
139				if ( tracklisting.find('li.active').prev().click().length == 0 ) {
140					tracklisting.find('li:last').click();
141				}
142			}; // prevTrack()
143
144			// Progress Bar, make it clickable
145			$('.track-bar').on('click', function(e) {
146				var currentTrack = tracklisting.find('li.active');
147				if ( currentTrack.length ) {
148
149					// store the track
150					var currentTrackID = currentTrack.index(),
151							sound = soundManager.getSoundById('track_' + currentTrackID),
152							trackbarWidth = $(this).width();
153
154					// get X coordinates of where a user clicked
155					var posX = e.pageX - $(this).offset().left,
156							newPosition = ( posX / trackbarWidth );
157
158					// make the magic
159					if ( sound && sound.duration ) {
160						sound.setPosition(sound.duration * newPosition );
161					}
162
163				}
164			});
165
166			// Track position (time) display
167			function getTime(msec, useString) {
168		    // convert milliseconds to hh:mm:ss, return as object literal or string
169				var nSec = Math.floor(msec/1000),
170						hh = Math.floor(nSec/3600),
171						min = Math.floor(nSec/60) - Math.floor(hh * 60),
172						sec = Math.floor(nSec -(hh*3600) -(min*60));
173
174		    // if (min === 0 && sec === 0) return null; // return 0:00 as null
175		    return (useString ? ((hh ? hh + ':' : '') + (hh && min < 10 ? '0' + min : min) + ':' + ( sec < 10 ? '0' + sec : sec ) ) : { 'min': min, 'sec': sec });
176		  }
177		}
178	});
179});

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.