Hello,
I am currently using this code in my Javascript for the Fast BBCode @Ange Tuteur gave me!
How can i make it appear as a button to the editor? A Simple button with a crown but be visible and usable only by the member as it is now?
Luffy
I am currently using this code in my Javascript for the Fast BBCode @Ange Tuteur gave me!
- Code:
$(function() {
if (!document.getElementById('text_editor_textarea')) return;
userTag(1,'Luffy', 'http://i39.servimg.com/u/f39/19/06/26/04/pcode210.png', '<div class="Luffy">', '</div>');
function userTag(id, tagname, image, htmlStart, htmlEnd) {
var breg = new RegExp('\\['+tagname+'\\](.+?)\\[\\/'+tagname+'\\]','gi');
if (_userdata.user_id === id) {
$("#text_editor_textarea").before("<img src='"+image+"'id='"+tagname+"-b'/>");
$('#'+tagname+'-b').click(function(){$('#text_editor_textarea').sceditor('instance').insertText('['+tagname+']','[/'+tagname+']')});
}
$('div.postbody div').each(function () {if ($(this).text().indexOf('['+tagname+']') != -1) $(this).html($(this).html().replace(breg, htmlStart + '$1' + htmlEnd))});
}
});
How can i make it appear as a button to the editor? A Simple button with a crown but be visible and usable only by the member as it is now?
Luffy