Created
September 5, 2009 21:52
-
-
Save keithnorm/181528 to your computer and use it in GitHub Desktop.
This file contains 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
(function() { | |
var DOM = tinymce.DOM; | |
var each = tinymce.each; | |
// Load plugin specific language pack | |
tinymce.PluginManager.requireLangPack('wordpress'); | |
tinymce.create('tinymce.plugins.WPAudio', { | |
init : function(ed, url) { | |
ed.onPostProcess.add(function(ed, o) { | |
if (o.get) | |
o.content = o.content.replace(/<a href=\"((http|https):\/\/([a-z0-9]+)[\-\.]?([a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?[\/\?][[\S]*]?)?)\">.+<\/a>/g, function(tag, url, protocol) { | |
if(url.match(/.+\.mp3$/)) | |
return '[wpaudio: url="' + url + '"]'; | |
return tag; | |
}); | |
}); | |
} | |
}); | |
tinymce.PluginManager.add('wp_audio', tinymce.plugins.WPAudio); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment