PageSourceSearch

https://www.tattvagyan.com/wp-content/plugins/haiku-minimalist-audio-player/js/haiku-player.js

js tattvagyan.com collected 2026-10-02 13:49:52 UTC 4,176 bytes, 152 lines download raw bytes

1jQuery(document).ready(function($) {
2 
3 $(window).load(function() {	
4	$('.player-container').css('visibility', 'visible').show();
5 
6
7	 /*Text Version*/
8	 
9	  	$("div[id^=haiku-text-player]").each(function() {
10			var num = this.id.match(/haiku-text-player(\d+)/)[1];
11			var ctrlId = "div#text-player-container" + num + " ul#player-buttons" + num;
12			var audioFile = $(ctrlId + " li.play a").attr("href");
13			 $(this).jPlayer({
14				ready: function () {
15					this.element.jPlayer("setFile", audioFile);
16				},
17				customCssIds: true,
18				swfPath: jplayerswf,
19				errorAlerts:true,
20				nativeSuport:false
21			})
22			$(ctrlId + " li.play").click(function() {
23				stopAllPlayers();
24				$("div#haiku-text-player" + num).jPlayer("play");
25				showStopBtn();
26				return false;
27			});
28			$(ctrlId + " li.stop").click(function() {
29				$("div#haiku-text-player" + num).jPlayer("stop");
30				showPlayBtn();
31				return false;
32			});
33			function stopAllPlayers() {
34				$("div.haiku-text-player").jPlayer("stop");
35				$("div.text-player-container ul.player-buttons li.stop").hide();					$("div.text-player-container ul.player-buttons li.play").show();
36			}
37			function showStopBtn() {
38				$(ctrlId + " li.play").fadeOut(100, function(){
39					$(ctrlId + " li.stop").css("display","inline").fadeIn(100);});
40			}
41			function showPlayBtn() {
42				$(ctrlId + " li.stop").fadeOut(100, function(){
43					$(ctrlId + " li.play").fadeIn(10);});
44			}
45
46		});
47
48	/*Graphical version*/
49
50		$("div[id^=haiku-player]").each(function() {
51		
52			var num = this.id.match(/haiku-player(\d+)/)[1];
53			var buttonId = "div#haiku-button" + num;
54			var jpPlayTime = $("#jplayer_play_time" + num);
55			var jpTotalTime = $("#jplayer_total_time" + num);
56			var audioFile = $(buttonId + " a").attr("href");
57			currentPlayer = 0;
58			
59			$(this).jPlayer({
60				ready: function () {
61					this.element.jPlayer("setFile", audioFile);
62				},
63				customCssIds: true,
64				swfPath: jplayerswf,
65				errorAlerts:true,
66				nativeSuport:false
67			})
68			
69			.jPlayer("onSoundComplete", function() {
70			stopPreviousPlayer();
71			})
72			
73			.jPlayer("onProgressChange", function(lp,ppr,ppa,pt,tt) {
74	 		var lpInt = parseInt(lp);
75	 		var ppaInt = parseInt(ppa);
76	 		global_lp = lpInt;
77	 		jpPlayTime.text($.jPlayer.convertTime(pt) + " / ");
78			jpTotalTime.text($.jPlayer.convertTime(tt));
79
80	 		$('#sliderPlayback' + num).slider('option', 'value', ppaInt);
81			});
82	 
83			// Slider
84			$('#sliderPlayback' + num).slider({
85				max: 100,
86				range: 'min',
87				animate: true,
88				slide: function(event, ui) {
89					$('#haiku-player' + num).jPlayer("playHead", ui.value*(100.0/global_lp));
90					$(buttonId + " li.play").hide();
91					$(buttonId + " li.pause").fadeIn(10);
92				}
93			});
94		
95			$(buttonId + " a.play").click(function() {
96				stopPreviousPlayer();
97				$(buttonId + " a img.listen").hide();
98				$(buttonId + " li.play").hide();
99				$("ul#controls" + num).fadeIn('fast');
100				$("ul#info" + num).fadeIn('fast');
101				$("div#haiku-player" + num).jPlayer("play");
102				currentPlayer = num;
103				return false;
104			});	
105		
106			$(buttonId + " li.pause").click(function() {
107				$("div#haiku-player" + num).jPlayer("pause");
108				showPlayBtn();
109				return false;
110			});
111			
112			$(buttonId + " li.play").click(function() {
113				$("div#haiku-player" + num).jPlayer("play");
114				showPauseBtn();
115				return false;
116			});
117			
118			$(buttonId + " li.stop").click(function() {
119				$("div#haiku-player" + num).jPlayer("stop");
120				showDefault();
121				return false;
122			});
123			
124			function stopPreviousPlayer() {
125				$("div#haiku-player" + currentPlayer).jPlayer("stop");
126				showPauseBtn();
127				$("ul#controls" + currentPlayer).hide();	
128				$("ul#info" + currentPlayer).hide();	
129				$("div#haiku-button" + currentPlayer + " a img.listen").fadeIn('fast');
130			}
131			
132			function showPlayBtn() {
133			$(buttonId + " li.pause").hide();
134			$(buttonId + " li.play").fadeIn(10);
135			}
136			
137			function showPauseBtn() {
138			$(buttonId + " li.play").hide();
139			$(buttonId + " li.pause").fadeIn(10);
140			}
141				
142			function showDefault() {
143				$("ul#controls" + num).hide();
144				$("ul#info" + num).hide();
145				showPauseBtn();
146				$(buttonId + " a img.listen").fadeIn(10);
147			}
148			
149		});
150	});	
151});
152 

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.