Hello Forumltion,
I come here with a probloem:I want to make a staff button on the text editor which shows a table like this:
The code I have is this:
EDIT:The table I want:
I come here with a probloem:I want to make a staff button on the text editor which shows a table like this:
- Code:
[table class="moderation-message" style="width: 100%;background: #3399CC;margin-top: 5px;margin-bottom: 5px;border-bottom: 3px solid #2579A2;padding: 5px;border-radius: 4px;font-weight: bold;color: #fff;font-size: 12px;text-shadow: 1px 1px 3px rgba(0,0,0,0.1);font-family: Trebuchet MS, Helvetica, Arial, sans-serif"][tr][td width="1%"][img]IMGLINK[/img][/td]
[td]Salut(Hello),
### Editable message 2 ###
[i]=> ####$Editable message 2###[/i][/td]
[/tr]
[/table]
The code I have is this:
- Code:
$(function() {
var settings = {
img : 'backgroud img for button',
title : 'title of button'
};
if (_userdata["user_level"] == '1' || _userdata["user_level"] == "2") {
$('.sceditor-group:last').after('<div class="sceditor-group"><a class="sceditor-button sceditor-button-message" title="'+settings["title"]+'"><div style="background:url('+settings["img"]+') no-repeat;"></div></a></div>');
$('body').append('<div id="messageList" style="z-index:15;display:none;position:absolute;background:#fff;border:1px solid #ccc;padding:3px;"><div id="M1" class="listItem" style="cursor:pointer;">Message 1</div><div id="M2" class="listItem" style="cursor:pointer;">Message 2</div><div id="M3" class="listItem" style="cursor:pointer;">Message 3</div></div>');
$('.sceditor-button-message').click(function() {
var display = $('#messageList').css('display');
if (display == 'none') {
var Y = $(this).offset().top;
var X = $(this).offset().left;
$('#messageList').show().offset({top:Y + 25,left:X});
}
else { $('#messageList').hide(); }
});
$('#M1').click(function() { $('#text_editor_textarea').sceditor('instance').insertText('Message 1',''); });
$('#M2').click(function() { $('#text_editor_textarea').sceditor('instance').insertText('Message 2',''); });
$('#M3').click(function() { $('#text_editor_textarea').sceditor('instance').insertText('Message 3',''); });
$('.listItem').click(function() { $(this).parent().hide(); });
}
});
EDIT:The table I want:
Last edited by m0bber on November 16th 2015, 3:05 pm; edited 3 times in total