FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Fri 08 Jun 2018, 11:02

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums -
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

» Numbering of messages in the topic
by SLGray Mon 04 Dec 2017, 22:40

Recent Tutorials
Top posting users this month

Who is online?
In total there are 4 users online :: 0 Registered, 0 Hidden and 4 Guests :: 1 Bot


[ View the whole list ]

Most users ever online was 172 on Fri 19 Feb 2016, 05:17

FMD Shoutbox : Create custom buttons

View previous topic View next topic Go down

Ange Tuteur
Gender : Male
Age : 22
Posts : 4733
Points : 9873
Reputation : 2366
Location : Macungie, PA
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
View user profile

PostAnge Tuteur on Mon 16 Feb 2015, 23:39

This topic will explain the basics for creating two types of buttons for the shoutbox; Format and Advanced.


Format buttons are buttons which can be toggled on and off. They make use of a CSS style string to show the result in the input box. The CSS property value is used to apply the format on submission and change the state of the button.

This is an example of a format button :
  name : 'bold',
  text : 'B',
  css : 'font-weight:bold',
  tags : ['[b]','[/b]'],
  where : actions

name : The name of your format button. This is used as the title and cookie name.

text : The text that displays inside the button.

css : A CSS style string that should consist of a single property and value without spaces and semi-colons ! This is used to add a "WYSIWYG" feel to the message box, but also to identify if the custom format is enabled. For content you don't want to see the changes of, but have enabled, you should use the content property. For example :
css : 'content:"myCustomFormat"'

This allows you to create a majority of formats by using a simple string. i.e. "myCustomFormat"

tags : These are the beginning and end tags that will be applied to your message when it's sent. The first tag is the opening tag and the second tag is the closing tag. Not all tags will be supported for the style you want, so I've added a custom tag. Here's an example :
tags : ['[custom style="text-shadow: 1px 1px 1px"]','[/custom]']

This custom tag will be formatted as a <SPAN> tag. You can use the style attribute, classnames, etc.. to create a majority of format styles.

where : This is where your custom button will appear. Currently there are two options : actions and options. A button appended to actions will display in the footer of the shoutbox, whereas a button appended to options will display in the header of the shoutbox.

style : Not used in the example, but takes a string of CSS properties and values. This is used to add a custom style to your button, such as a color, background, border...
style : 'color:red;background:blue;border-color:green'


Advanced buttons go past the simple formatting and allow you to use JavaScript to achieve what you desire.

This is an example of an advanced button :
  name : 'refresh messages',
  text : 'Refresh',
  where : options,
  advanced : function(b) {
    b.onclick = function() {
      idle = 0;
        apply : function() { = 0.3 },
        callback : function() {
 = '';

The name property is used only for titles when the tags property is omitted.

advanced : Contains JavaScript code that you want to execute. It should be set like so :
advanced : function (b) {
  // do something here
  b.onclick = function() { alert('You clicked me !') }

The argument in the function "b" refers to the button you created. You can bind events, such as onclick to execute code when you click the button. You can also use jQuery if that's your style. Wink
advanced : function (b) {
  // do something here
  $(b).click(function() { alert('You clicked me !') });

The advanced function can also be applied to format buttons too, depending on how creative you want to get. Smile

Installing custom buttons

For ease of use, I've added a "plugins" function to the config. This allows you to insert custom buttons, popups, etc.. into the shoutbox with ease. Simply copy the code you want to install and paste it inside plugins :

If you understand JavaScript, then you can add your custom code wherever.. Wink

Example snippets

To get you thinking and give you examples, here are some custom buttons for you to play with.

Glow :
Applies a glow to your text. The color is influenced by your text color.
  name : 'glow',
  text : 'G',
  css : 'text-shadow:1px 1px 1px',
  tags : ['[custom style="text-shadow: 1px 1px 1px"]','[/custom]'],
  where : actions

Table :
An example of utilizing a classname to make a custom format.
  name : 'tableA',
  text : 'table',
  css : 'content:"customTable"',
  tags : ['[custom class="tableA"]','[/custom]'],
  where : actions

You can then style the table above with CSS :
.tableA {
  text-shadow:1px 1px 1px #FFF;
  border:1px solid #CCC;

The red button
A silly joke that emerged during development. Clicking the button flips the shoutbox upside down and sends a message saying the member pressed it.
  name : 'Don\'t click the red button !',
  text : 'Click me',
  style : 'background:#F66;color:#633;border-color:#C66;text-shadow:none',
  where : actions,
  advanced : function(b) {
    b.onclick = function() { ? = '' : = 'rotate(180deg)';
      message.value = '[color=#ff0000][b]'+_userdata.username+' clicked the red button ![/b][/color]';


Ange Tuteur
Tips and TricksContact Me

Gender : Male
Age : 20
Posts : 170
Points : 2041
Reputation : 48
Location : Croatia
Language : English || Croatian
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
View user profile

PostIkerepc on Tue 24 Feb 2015, 11:20

Awesome, now I have chatbox with red button! Love your work @Ange Tuteur Smile

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!

Create a new account

Log in

Already have an account? No problem, log in here.

Log in

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