How do you add a custom button for staff only to the message editor?
Last edited by ddoesmc on March 6th 2014, 9:39 pm; edited 1 time in total
This is a Hitskin.com skin preview
Install the skin • Return to the skin page
$(window).load(function() {
var settings = {
img : 'backgroud img for button',
title : 'title of button',
message : 'moderation message'
};
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>');
$('.sceditor-button-message').click(function() {
$('#text_editor_textarea').sceditor('instance').insertText(settings["message"],'');
});
}
});
var settings = {
img : 'backgroud img for button',
title : 'title of button',
message : 'moderation message'
};
$(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(); });
}
});
I did not comprehend.ddoesmc wrote:I will try this
Edit: I just want text no background
$(window).load(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(); });
}
});