Created
December 18, 2009 02:18
-
-
Save johnholdun/259232 to your computer and use it in GitHub Desktop.
A simple bit of code that automatically prepends an AudioPlayer instance (http://wpaudioplayer.com) before the paragraph of any link to an MP3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* * * | |
A simple bit of code that automatically prepends an AudioPlayer instance | |
(http://wpaudioplayer.com) before the paragraph of any link to an MP3. | |
Depends on jQuery and AudioPlayer. | |
* * */ | |
$(function() { | |
var audio_count = 1; | |
$("a[href$=.mp3]").each(function() { | |
var $anchor = $(this), | |
$player = $anchor.parent("p").before('<div id="audio-player-' + audio_count + '"></div>'); | |
AudioPlayer.embed("audio-player-" + audio_count, { soundFile:$anchor.attr("href") }); | |
audio_count++; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment