The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Add button on SC Editor

View previous topic View next topic Go down

In progress Add button on SC Editor

Post by erchima on May 4th 2014, 6:52 pm

How to Add button on SC Editor Like this
when pressing the button will display a popup input text like this

erchima
Forumember

Female Posts : 629
Reputation : 15
Language : INDONESIAN | Lua Script | Visual Basic | and Coding
Location : Under your bed xD

http://erchimacute.forumid.net

Back to top Go down

In progress Re: Add button on SC Editor

Post by Ange Tuteur on May 5th 2014, 9:05 am

Hello erchima,

You would need to create a new button and an element to serve as your popup which will be hidden.

You can use this example that I have wrote up :
Code:
$(window).load(function() {
  $('.sceditor-group:last').append('<a class="sceditor-button sceditor-button-new"><div></div></a>');
  $('body').append('<div id="newPop" style="display:none;position:absolute;z-index:50000;"><input id="inputField" type="text"><br><input id="enterContent" type="submit" value="enter"></div>');
 
  $('.sceditor-button-new').click(function() {
  if ($('#newPop').css('display') == 'none') {
  var y = $('.sceditor-button-new').offset().top +25;
  var x = $('.sceditor-button-new').offset().left;
  $('#newPop').show().css('top',y + 'px').css('left',x + 'px');
  }
  else $('#newPop').hide();
  });
 
  $('#enterContent').click(function() {
  if ($('#inputField').val().length > 0) $('#text_editor_textarea').sceditor('instance').insertText('[mytag]' + $('#inputField').val(),'[/mytag]');
  else $('#text_editor_textarea').sceditor('instance').insertText('[mytag]','[/mytag]');
  $('#inputField').val('');
  $('#newPop').hide();
  });
 
  $('.sceditor-button:not(.sceditor-button-new), .sceditor-container textarea, .sceditor-container iframe').click(function() { $('#newPop').hide() });
});

You'll of course need to edit the style with CSS as it is bare boned. Wink

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Add button on SC Editor

Post by erchima on May 5th 2014, 12:23 pm

can you help me with this button to see button like it?
Code:
jQuery(window).load(function() {
if (typeof _userdata === "undefined") return;
if ((_userdata['user_level'] == '1') || (_userdata["user_level"] == '2')) {
jQuery('.sceditor-group:last-child').after('<div style="cursor:pointer"class="sceditor-group" id="warning"><a title="Warning" class="warning sceditor-button"><div style="background:url(http://i.imgur.com/MQZO5SY.png) no-repeat center;"></div></a></div>');
jQuery('#warning').click(function() { jQuery('#text_editor_textarea').sceditor('instance').insertText('[table class="alert-x warningbox"][tr][td class="alert-y"][b]','[/b][/td][/tr][/table]');});
jQuery('.button').click(function() { jQuery('#fa_modtable').css('visibility','hidden'); });
}
});
help me pls to make button and showing popup with this code

erchima
Forumember

Female Posts : 629
Reputation : 15
Language : INDONESIAN | Lua Script | Visual Basic | and Coding
Location : Under your bed xD

http://erchimacute.forumid.net

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum