PageSourceSearch

http://www.baseballmusings.com/wp/wp-content/plugins/haiku-minimal…/js/haiku-player.js?ver=1.0.0

js baseballmusings.com collected 2026-09-24 18:58:59 UTC 5,934 bytes, 210 lines download raw bytes

1/**
2 *
3 *  Main Haiku js functions
4 *
5 */ 
6;(function($){
7
8
9
10    /**
11     *  Text players
12     */
13    $.fn.textPlayers = function() {
14
15        var player = $('div.haiku-text-player');
16
17        player.each(function(){
18
19            var $this, id, container, play, pause, stop,
20                loopPlayer, mp3File, ogaFile, selectors;
21
22            $this = $(this);
23            id = this.id.match(/haiku-text-player(\d+)/)[1];
24            container = $this.next('.haiku-container-' + id);
25
26            play  = container.find('#haiku-play-' + id);
27            pause = container.find('#haiku-pause-' + id);
28            stop  = container.find('#haiku-stop-' + id);
29
30            loopPlayer = false;
31
32            if(container.is('.haiku-loop'))
33                loopPlayer = true;
34
35            selectors = {
36                play: '#haiku-play-'  + id,
37                pause: '#haiku-pause-' + id,
38                stop: '#haiku-stop-'  + id,
39                duration: '#haiku-duration-' + id,
40                currentTime: '#haiku-current-time-' + id,
41                noSolution: '.haiku-no-solution'
42            };
43
44            mp3File = play.attr('href');
45
46            if( play.attr('data-haikuoga') ) {
47                
48                ogaFile = play.attr('data-haikuoga');
49
50                $this.jPlayer({
51                    ready: function () {
52                        $(this).jPlayer('setMedia', {
53                            mp3: mp3File,
54                            oga: ogaFile
55                        })
56                    },
57                    swfPath: haiku_jplayerswf_path,
58                    supplied: 'mp3, oga',
59                    solution: 'html, flash',
60                    cssSelectorAncestor: '.haiku-container-' + id,
61                    cssSelector: selectors,
62                    loop: loopPlayer
63                }); // this.jplayer
64
65            } else {
66
67                $this.jPlayer({
68                    ready: function () {
69                        $(this).jPlayer('setMedia', {
70                            mp3: mp3File
71                        })
72                    },
73                    swfPath: haiku_jplayerswf_path,
74                    supplied: 'mp3',
75                    solution: 'html, flash',
76                    cssSelectorAncestor: '.haiku-container-' + id,
77                    cssSelector: selectors,
78                    loop: loopPlayer
79                }); // this.jplayer
80
81            } // endif oga
82
83        }); // player.each
84    }
85
86
87
88    /**
89     *  Graphical players
90     */
91    $.fn.graphPlayers = function() {
92
93        var player = $('div.haiku-graphical-player')
94
95        player.each(function(){
96
97            var $this, id, container, play, pause, stop, 
98                mp3File, ogaFile, selectors, loopPlayer;
99
100            $this = $(this);
101            id = this.id.match(/haiku-graphical-player-(\d+)/)[1];
102            container = $this.next('.haiku-container-' + id);
103            parent = $(this).parent(player);
104
105            play  = container.find('#haiku-play-' + id);
106            pause = container.find('#haiku-pause-' + id);
107            stop  = container.find('#haiku-stop-' + id);
108
109            loopPlayer = false;
110
111
112            if(container.is('.haiku-loop'))
113                loopPlayer = true;
114
115            selectors = {
116                play: '#haiku-play-'  + id,
117                pause: '#haiku-pause-' + id,
118                stop: '#haiku-stop-'  + id,
119                seekBar: '#haiku-seek-bar-' + id,
120                playBar: '#haiku-play-bar-' + id,
121                duration: '#haiku-duration-' + id,
122                currentTime: '#haiku-current-time-' + id,
123                noSolution: '.haiku-no-solution'
124            };
125
126            mp3File = play.attr('href');
127
128            if( play.attr('data-haikuoga') ) {
129                
130                ogaFile = play.attr('data-haikuoga')
131
132                $this.jPlayer({
133                    ready: function () {
134                        $(this).jPlayer('setMedia', {
135                            mp3: mp3File,
136                            oga: ogaFile
137                        })
138                    },
139                    swfPath: haiku_jplayerswf_path,
140                    supplied: 'mp3, oga',
141                    solution: 'html, flash',
142                    cssSelectorAncestor: '.haiku-container-' + id,
143                    cssSelector: selectors,
144                    loop: loopPlayer
145                }); // this.jplayer
146
147            } else {
148
149                $this.jPlayer({
150                    ready: function () {
151                        $(this).jPlayer('setMedia', {
152                            mp3: mp3File
153                        })
154                    },
155                    swfPath: haiku_jplayerswf_path,
156                    supplied: 'mp3',
157                    solution: 'html, flash',
158                    cssSelectorAncestor: '.haiku-container-' + id,
159                    cssSelector: selectors,
160                    loop: loopPlayer
161                }); // this.jplayer
162
163            } // endif oga
164
165
166            // lil layout fix for some browsers
167            pause.hide().css('padding-right','0');
168
169            // play button
170            play.click(function(){
171
172                $(this).hide();
173                pause.fadeIn(100);
174                parent.jPlayer('play');
175
176                return false;
177            });
178
179            // pause button
180            pause.click(function(){
181
182                $(this).hide();
183                play.fadeIn(100).attr('title','Resume');
184                parent.jPlayer('pause');
185
186                return false;
187            });
188
189            // stop button
190            stop.click(function(){
191
192                pause.hide();
193                play.fadeIn(100);
194                parent.jPlayer('stop');
195
196                return false;
197            });
198
199        }); // player.each
200
201    }
202
203    $(window).load(function(){
204
205        $.fn.textPlayers();
206        $.fn.graphPlayers();
207
208    })
209
210})(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.