Difference between revisions of "User:King of Herdaz/Toolbar customization"

adding section about adding new sections
m (tweaks)
(adding section about adding new sections)
To create your own button paste the code at the end of this section into your <code>/common.js</code> page between the two [[#Basic]] sections and change the following things:
 
* Replace <code>AAAA</code> with the name of the section you would like to put the button. Unless you are adding new [[#Sections|#sections]] to the toolbar this should be either <code>main</code> or <code>advanced</code>.
* Replace <code>BBBB</code> with the name of the part of that section where you would like your button to go. If it will be in the <code>main</code> section this should be <code>format</code> (though <code>insert</code> can also work). If it will be in the <code>advanced</code> section then this can be either <code>heading</code>, <code>format</code> (this will work best and is recommended), <code>size</code>, or <code>insert</code>.
* Replace <code>CCCC</code> with what the internal name for this button.
=== Creating Your Own Dropdowns ===
To start add this code into your <code>/common.js</code> page between the two [[#Basic]] sections and change the following things:
* If you have created a new [[#Adding Sections|#section]] in your toolbar and want to put your dropdown to go there then change <code>AAAA</code> to the name of your section, otherwise replace it with <code>advanced</code>.
* Replace <code>BBBB</code> with the internal name for the dropdown.
* Replace <code>CCCC</code> with the label for the dropdown that will be displayed on the page.
}
}
</pre>
 
{{anchor|section}}{{anchor|sections}}
=== Adding New Sections ===
There are two types of <code>section</code>s in the toolbar, <code>toolbar</code> sections and <code>booklet</code> sections. Booklet sections contain pages of characters and will be explained below. Toolbar sections contain dropdowns and <code>group</code>s of buttons.
 
The code adding a new section to your toolbar must be placed before the code for all items that will go within it.
 
To add a new section to your toolbar insert the following code into your <code>/common.js</code> page between the two [[#Basic]] sections and change the following things:
* Replace <code>AAAA</code> with the internal name for the section that will used to assign buttons and dropdowns to it.
* Replace <code>BBBB</code> with the label for the section.
 
<pre>
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'AAAA': {
'type': 'toolbar',
'label': 'BBBB'
}
}
} );
</pre>
 
To add a new group to a section (whether a section you added or to a default section) within your toolbar insert the following code into your <code>/common.js</code> page, between the code that added the section and the code for the buttons that will go within it, and make the following changes:
* Replace <code>CCCC</code> with the internal name of the section that will contain this group.
* Replace <code>DDDD</code> with the internal name for the group.
* Replace <code>EEEE</code> with the label for the group.
 
<pre>
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'CCCC',
'groups': {
'DDDD': {
'label': 'EEEE'
}
}
} );
</pre>
 
Autopatrolled, Editors
8,718

edits