Basically what I'm trying to do is to add an audioplayer in the normal profile. To do this I've been trying to use the javascript Spetter gave me for this problem: https://help.forumotion.com/t146850-bbcode-html-in-rpg-profile
As you can see I tried to convert the html code for audioplayer into BBcode ([music]link mp3 file[/music]). It worked, but it only works in the rpg profile field, not in the normal profile (I'm guessing you need a different class for that one). Ofcourse I could just add it to the rpg profile field, but my problem is that I want the audio player to appear in the mini-profile next to posts. Forumotion has a limited number of rpg fields to be visible in posts (3), and all three of them are already in use on my website. The normal profile has no limit, that's why I want the audio player in there.
I hope someone can help me out here.
- Code:
$(function() {
var pathname = $(location).attr('pathname');
if (pathname.match("^/u") ) {
$("textarea").each(function(index, value) {
var obj = jQuery(value);
var tmp = obj.val().replace(/[\r\n]/g, "<br />");
$format_search = [
/\[b\](.*?)\[\/b\]/ig,
/\[i\](.*?)\[\/i\]/ig,
/\[u\](.*?)\[\/u\]/ig,
/\[img\](.*?)\[\/img\]/ig,
/\[center\](.*?)\[\/center\]/ig,
/\[left\](.*?)\[\/left\]/ig,
/\[right\](.*?)\[\/right\]/ig,
/\[music](.*?)\[\/music\]/ig
]; // note: NO comma after the last entry
// The matching array of strings to replace matches with
$format_replace = [
'<strong>$1</strong>',
'<em>$1</em>',
'<span style="text-decoration: underline;">$1</span>',
'<img class="rpgtext_img" src="$1" />',
'<center>$1</center>',
'<left>$1</left>',
'<right>$1</right>',
'<div class="mpmusic"><object type="application/x-shockwave-flash" data="http://flash-mp3-player.net/medias/player_mp3_mini.swf" width="250" height="20"><param name="movie" value="http://flash-mp3-player.net/medias/player_mp3_mini.swf"><param name="bgcolor" value="#393939"><param name="FlashVars" value="mp3=$1"></object></div>'
];
// Perform the actual conversion
for (var i =0;i<$format_search.length;i++) {
var tmp = tmp.replace($format_search[i], $format_replace[i]);
}
var newTag = jQuery("<div></div>").html(tmp);
newTag.addClass("mpbg");
obj.replaceWith(newTag);
});
}
});
As you can see I tried to convert the html code for audioplayer into BBcode ([music]link mp3 file[/music]). It worked, but it only works in the rpg profile field, not in the normal profile (I'm guessing you need a different class for that one). Ofcourse I could just add it to the rpg profile field, but my problem is that I want the audio player to appear in the mini-profile next to posts. Forumotion has a limited number of rpg fields to be visible in posts (3), and all three of them are already in use on my website. The normal profile has no limit, that's why I want the audio player in there.
I hope someone can help me out here.