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.

Button on sceditor

View previous topic View next topic Go down

Solved Button on sceditor

Post by erchima on April 7th 2014, 12:00 pm

hello i was modified tutorial fromAnge Tuteurfrom herehttp://help.forumotion.com/t129493-table-widgets-in-quick-reply
I have modified the code from ange tuteur, but the image button not showing

the code is
Code:
jQuery(window).load(function() {
if (typeof _userdata === "undefined") return;
if ((_userdata['user_level'] == '0') || (_userdata['user_level'] == '1') || (_userdata["user_level"] == '2')) {
 jQuery('body').append('<div id="download" class="download" style="visibility:hidden;width:auto;text-align:center;"><div title="Download" style="cursor:pointer"class="button" id="download"><strong> Download </strong></div>');
 jQuery('.sceditor-group:last-child').after('<div style="cursor:pointer"class="sceditor-group" id="download"><a title="download" class="download" onclick="selectWysiwyg(this, \'download\');"><div style="background:url(http://i.imgur.com/ZL8pt2Q.png) no-repeat center;"></div></a></div>');
 jQuery('#download').click(function() { jQuery('#text_editor_textarea').sceditor('instance').insertText('<a href="','" target="blank"><button>Button Name</button></a>');});
 jQuery('.button').click(function() { jQuery('#fa_modtable').css('visibility','hidden'); });
 }
});
can someone help me?
Summon @Ange TuteurVery Happy
sorry I edit some code from you to experimentkiss


Last edited by erchima on April 7th 2014, 12:21 pm; edited 1 time in total

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

Solved Re: Button on sceditor

Post by Ange Tuteur on April 7th 2014, 12:16 pm

Hello erchima,

Try this :
Code:
$(window).load(function() {
  $('body').append(
  '<div id="fa_dropdown" class="select" style="visibility:hidden;width:auto;text-align:center;">'+
  '<style>.listItem { cursor:pointer;padding:3px;color:#333; } .listItem:hover { background:#EEE; }</style>'+
 
'<div class="listItem" id="download1">download1</div>'+
  '<div class="listItem" id="download2">download2</div>'+
  '<div class="listItem" id="download3">download3</div>'+
 
'</div>'
  );
  $('.sceditor-group:last').after('<div class="sceditor-group" id="fa_modtools"><a title="Button" class="sceditor-button" onclick="selectWysiwyg(this, \'fa_dropdown\');"><div style="background:url(http://i.imgur.com/ZL8pt2Q.png) no-repeat center;"></div></a></div>');
 
$('#download1').click(function() { $('#text_editor_textarea').sceditor('instance').insertText('[b]opening tag1','closing tag1[/b]') });
$('#download2').click(function() { $('#text_editor_textarea').sceditor('instance').insertText('[b]opening tag2','closing tag2[/b]') });
  $('#download3').click(function() { $('#text_editor_textarea').sceditor('instance').insertText('[b]opening tag3','closing tag3[/b]') });
 
  $('.listItem').click(function() { $('#fa_dropdown').css('visibility','hidden') });
});

Replace :
Code:
'[b]opening tag1','closing tag1[/b]'

With the text you want inserted into the editor on click.

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Button on sceditor

Post by erchima on April 7th 2014, 12:23 pm

thank you very much:wouhou:

how to make 1 button to 1 code selected?
i already make this work but the icon button does'nt show

Code:
jQuery(window).load(function() {
if (typeof _userdata === "undefined") return;
if ((_userdata['user_level'] == '0') || (_userdata['user_level'] == '1') || (_userdata["user_level"] == '2')) {
jQuery('body').append('<div id="download" class="download" style="visibility:hidden;width:auto;text-align:center;"><div title="Download" style="cursor:pointer"class="button" id="download"><strong> Download </strong></div>');
jQuery('.sceditor-group:last-child').after('<div style="cursor:pointer"class="sceditor-group" id="download"><a title="download" class="download" onclick="selectWysiwyg(this, \'download\');"><div style="background:url(http://i.imgur.com/ZL8pt2Q.png) no-repeat center;"></div></a></div>');
jQuery('#download').click(function() { jQuery('#text_editor_textarea').sceditor('instance').insertText('<a href="','" target="blank"><button>Button Name</button></a>');});
jQuery('.button').click(function() { jQuery('#fa_modtable').css('visibility','hidden'); });
}
});

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

Solved Re: Button on sceditor

Post by Ange Tuteur on April 7th 2014, 12:29 pm

You removed sceditor-button classname.

Try now :
Code:
jQuery(window).load(function() {
if (typeof _userdata === "undefined") return;
if ((_userdata['user_level'] == '0') || (_userdata['user_level'] == '1') || (_userdata["user_level"] == '2')) {
 jQuery('body').append('<div id="download" class="download" style="visibility:hidden;width:auto;text-align:center;"><div title="Download" style="cursor:pointer"class="button" id="download"><strong> Download </strong></div>');
 jQuery('.sceditor-group:last-child').after('<div style="cursor:pointer"class="sceditor-group" id="download"><a title="download" class="download sceditor-button" onclick="selectWysiwyg(this, \'download\');"><div style="background:url(http://i.imgur.com/ZL8pt2Q.png) no-repeat center;"></div></a></div>');
 jQuery('#download').click(function() { jQuery('#text_editor_textarea').sceditor('instance').insertText('<a href="','" target="blank"><button>Button Name</button></a>');});
 jQuery('.button').click(function() { jQuery('#fa_modtable').css('visibility','hidden'); });
 }
});

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Button on sceditor

Post by erchima on April 7th 2014, 12:39 pm

@Ange Tuteur wrote:You removed sceditor-button classname.

Try now :
Code:
jQuery(window).load(function() {
if (typeof _userdata === "undefined") return;
if ((_userdata['user_level'] == '0') || (_userdata['user_level'] == '1') || (_userdata["user_level"] == '2')) {
 jQuery('body').append('<div id="download" class="download" style="visibility:hidden;width:auto;text-align:center;"><div title="Download" style="cursor:pointer"class="button" id="download"><strong> Download </strong></div>');
 jQuery('.sceditor-group:last-child').after('<div style="cursor:pointer"class="sceditor-group" id="download"><a title="download" class="download sceditor-button" onclick="selectWysiwyg(this, \'download\');"><div style="background:url(http://i.imgur.com/ZL8pt2Q.png) no-repeat center;"></div></a></div>');
 jQuery('#download').click(function() { jQuery('#text_editor_textarea').sceditor('instance').insertText('<a href="','" target="blank"><button>Button Name</button></a>');});
 jQuery('.button').click(function() { jQuery('#fa_modtable').css('visibility','hidden'); });
 }
});
it's work
but
before:

After Click:

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

Solved Re: Button on sceditor

Post by Ange Tuteur on April 7th 2014, 1:06 pm

Try this :
Code:
jQuery(window).load(function() {
if (typeof _userdata === "undefined") return;
if ((_userdata['user_level'] == '0') || (_userdata['user_level'] == '1') || (_userdata["user_level"] == '2')) {
 jQuery('.sceditor-group:last-child').after('<div style="cursor:pointer"class="sceditor-group" id="download"><a title="download" class="download sceditor-button"><div style="background:url(http://i.imgur.com/ZL8pt2Q.png) no-repeat center;"></div></a></div>');
 jQuery('#download').click(function() { jQuery('#text_editor_textarea').sceditor('instance').insertText('<a href="','" target="blank"><button>Button Name</button></a>');});
 jQuery('.button').click(function() { jQuery('#fa_modtable').css('visibility','hidden'); });
 }
});

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Button on sceditor

Post by erchima on April 7th 2014, 1:14 pm

@Ange Tuteur wrote:Try this :
Code:
jQuery(window).load(function() {
if (typeof _userdata === "undefined") return;
if ((_userdata['user_level'] == '0') || (_userdata['user_level'] == '1') || (_userdata["user_level"] == '2')) {
 jQuery('.sceditor-group:last-child').after('<div style="cursor:pointer"class="sceditor-group" id="download"><a title="download" class="download sceditor-button"><div style="background:url(http://i.imgur.com/ZL8pt2Q.png) no-repeat center;"></div></a></div>');
 jQuery('#download').click(function() { jQuery('#text_editor_textarea').sceditor('instance').insertText('<a href="','" target="blank"><button>Button Name</button></a>');});
 jQuery('.button').click(function() { jQuery('#fa_modtable').css('visibility','hidden'); });
 }
});
wohohoho It's WORK! thank you very much:wouhou:
Your the best Very Happykissluv

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

Solved Re: Button on sceditor

Post by Ange Tuteur on April 7th 2014, 1:19 pm

You're welcome :rose:

Topic solved and archived

Ange Tuteur
Forumaster

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

http://fmdesign.forumotion.com

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