Editing User:King of Herdaz/Toolbar customization

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
 
The editing toolbar is a versatile and very useful tool that can be used to make working on the wiki much easier. While the basic version (which is an option in your [[Special:Preferences#mw-prefsection-editing|preferences]]) has some use, the main benefit comes when you customize your toolbar. In this guide there are tested premade elements that you can use as well as guides to creating and modifying your own buttons, booklets, and dropdowns.
 
The editing toolbar is a versatile and very useful tool that can be used to make working on the wiki much easier. While the basic version (which is an option in your [[Special:Preferences#mw-prefsection-editing|preferences]]) has some use, the main benefit comes when you customize your toolbar. In this guide there are tested premade elements that you can use as well as guides to creating and modifying your own buttons, booklets, and dropdowns.
   
  +
While modifying your toolbar can seem scary, once you get the hang of it, it really isn't a big deal. Also, anything you do can be easily undone so feel free to play around and experiment with different things. You do not need any knowledge of how the system works to use the premade elements on this page, simply copy-paste them into your toolbar and you are good to go.
All modifications to the toolbar are made on your common.js subpage. To find your common.js page click on this link [[Special:MyPage/common.js]] and create the page (if you have not already done so).
 
 
While modifying your toolbar can seem scary, once you get the hang of it, it really isn't a big deal. Anything you do can be easily undone so feel free to play around and experiment with different things.
 
 
You do not need any knowledge of how the system works to use the premade elements on this page, simply copy-paste them into your toolbar as directed and you are good to go.
 
 
Changes you make to your [[Special:MyPage/common.js|common.js]] page only take effect after you save the page, so to check that the changes you have made worked you should save your [[Special:MyPage/common.js|common.js]] page and try to edit some other wiki page. If you see the default toolbar when you edit a page that means that your edits "broke" your toolbar. Consult the [[#General Guidelines|#general guidelines]] for help debugging your code.
 
 
If the changes you made are not working, or if you would like assistance creating your own toolbar you can DM <code>kingofherdaz</code> on Discord for help.
 
   
 
== Basic ==
 
== Basic ==
 
Before you can customize your toolbar you need to have the "Enable the editing toolbar" option in your [[Special:Preferences#mw-prefsection-editing|preferences]] enabled. Once you have done this you are ready to begin.
 
Before you can customize your toolbar you need to have the "Enable the editing toolbar" option in your [[Special:Preferences#mw-prefsection-editing|preferences]] enabled. Once you have done this you are ready to begin.
   
First, add the following to your [[Special:MyPage/common.js|common.js]] page:
+
First, add the following to your <code>/common.js</code> page:
   
 
<pre>
 
<pre>
Line 45: Line 37:
   
 
== Premade Elements ==
 
== Premade Elements ==
All of the pieces of code in this section have been tested extensively and are ready to be used as presented here. If you want to add one of these items simply copy-paste the code for that item into your [[Special:MyPage/common.js|common.js]] page between the two [[#Basic]] sections to add it to your toolbar.
+
All of the pieces of code in this section have been tested extensively and are ready to be used as presented here. If you want to add one of these items simply copy-paste the code for that item into your <code>/common.js</code> page between the two [[#Basic]] sections to add it to your toolbar.
   
 
To learn how the syntax works and how you can modify and create your own code for your toolbar see [[#Customization]].
 
To learn how the syntax works and how you can modify and create your own code for your toolbar see [[#Customization]].
   
 
=== Premade Buttons ===
 
=== Premade Buttons ===
Buttons are the simplest type of element in the toolbar. Buttons appear in the toolbar as icons and execute one [[#action]] when they are clicked. Examples of buttons in the default toolbar configuration include the Bold button and the Italics button.
+
Buttons are the simplest type of element in the toolbar. Buttons appear in the toolbar as icons that will perform one [[#Actions|action]] when it is clicked. Examples of buttons in the default toolbar configuration include the Bold button and the Italics button.
   
 
The buttons presented here will be added to the left side of the <code>main</code> section of your toolbar (which is the top row that is always showing).
 
The buttons presented here will be added to the left side of the <code>main</code> section of your toolbar (which is the top row that is always showing).
   
==== Art Infobox ====
+
==== Image template ====
This button pastes the {{t|art}} infobox into the page leaving your cursor after <code>|#artist=</code>. This can make file uploads an easier process since you no longer have to copy and paste the infobox every time you upload a file.
+
Clicking this button will paste the {{t|image}} template onto the page, encapsulating your cursor or whatever you have highlighted.
   
  +
For example, if you have <code><nowiki>Shallan.jpg</nowiki></code> highlighted when you press the button it will result in this: <code><nowiki>{{image|Shallan.jpg|side=|width=|caption}}</nowiki></code>
{| class="mw-collapsible mw-collapsed" width=100%
 
|-
 
|
 
|-
 
|
 
<pre>
 
// Adding an art infobox button to the "main" section
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
section: 'main',
 
group: 'insert',
 
tools: {
 
code: {
 
label: 'Art infobox',
 
type: 'button',
 
icon: '//upload.wikimedia.org/wikipedia/commons/5/5a/Vector_toolbar_insert_picture_gallery_button.png',
 
action: {
 
type: 'encapsulate',
 
options: {
 
pre: '{' + '{art' + '\n' + '|#artist=' + '\n' + '|series=' + '\n' + '|#source=',
 
post: '\n' + '|type=' + '\n' + '}}'
 
}
 
}
 
}
 
}
 
});
 
</pre>
 
|}
 
 
==== Artist Attribution ====
 
This button encapsulates the highlighted text or your cursor between <code><nowiki>| <small><center>by {{a|</nowiki></code> and <code><nowiki>}}</center></small></nowiki></code>. This makes it easier to add artist attributions to images in galleries. After you paste the filename on a new line in the gallery simply click this button and type the name of the artist.
 
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 94: Line 57:
 
|
 
|
 
<pre>
 
<pre>
// Adding artist attribution button for galleries to the "main" section
+
// Adding image template button to the "main" section
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
section: 'main',
 
section: 'main',
 
group: 'insert',
 
group: 'insert',
 
tools: {
 
tools: {
artistAttribution: {
+
"image": {
label: 'Artist Attribution',
+
label: 'Image template',
 
type: 'button',
 
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_miss_signature.png',
+
icon: '//upload.wikimedia.org/wikipedia/commons/d/d8/Vector_toolbar_insert_image_button.png',
 
action: {
 
action: {
 
type: 'encapsulate',
 
type: 'encapsulate',
 
options: {
 
options: {
pre: '| <small><center>by {' + '{a|',
+
pre: '{' + '{image|',
post: '}}</center></small>'
+
post: '|side=|width=|caption}}'
 
}
 
}
 
}
 
}
Line 116: Line 79:
 
|}
 
|}
   
==== Artist Page ====
+
==== Category ====
  +
This button will paste <code><nowiki>[[Category:</nowiki></code> and <code><nowiki>]]</nowiki></code> around your highlighted text.
This button inserts the {{t|artist}} infobox (with all possible parameters) into the page followed by the rest of the things that should go on an artist page with the proper formatting and spacing.
 
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 125: Line 88:
 
|
 
|
 
<pre>
 
<pre>
// Adding artist page button to the "main" section
+
// Adding category button to the "main" section
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
section: 'main',
 
section: 'main',
 
group: 'insert',
 
group: 'insert',
 
tools: {
 
tools: {
artistPage: {
+
"category": {
label: 'Artist Page',
+
label: 'Category',
 
type: 'button',
 
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/7/76/Button_atelier_graphique.PNG',
+
icon: '//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png',
 
action: {
 
action: {
 
type: 'encapsulate',
 
type: 'encapsulate',
 
options: {
 
options: {
  +
pre: "[[Category: ",
pre: '{'+'{artist' + '\n' + '|image=' + '\n' + '|alias=' + '\n' + '|fb=' + '\n' + '|reddit=' + '\n' + '|behance=' + '\n' + '|da=' + '\n' + '|ig=' + '\n' + '|as=' + '\n' + '|tumblr=' + '\n' + '|twitter=' + '\n' + '|site=' + '\n' + '|license=all|some|none|official' + '\n' + '|contact=' + '\n' + '|type=fan|interior|cover|multimedia' + '\n' + '|no-notify=y' + '\n' + '}}' + '\n\n' + '<' + 'br style="clear:right;"/>' + '\n' + '== Gallery ==' + '\n' + '<' + 'gallery caption="Gallery" mode="packed" heights=200px>' + '\n\n' + '<' + '/gallery>' + '\n' + '{' + '{meta/done}}'
 
  +
post: "]]"
 
}
 
}
 
}
 
}
Line 146: Line 110:
 
|}
 
|}
   
==== Break Tag ====
+
==== Wikipedia Link ====
  +
This button will paste <code><nowiki>[[Wikipedia: </nowiki></code> and <code><nowiki>|]]</nowiki></code> around your highlighted text. This generates a link to that Wikipedia page and hides the prefix. For example, if you highlight <code>Brandon Sanderson</code> and click this button it will generate this: <code><nowiki>[[Wikipedia: Brandon Sanderson|]]</nowiki></code> which produces [[Wikipedia: Brandon Sanderson| Brandon Sanderson]] on the page.
Inserts <code><nowiki><br /></nowiki></code> into the page which is the preferred syntax on the Coppermind for creating line breaks.
 
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 155: Line 119:
 
|
 
|
 
<pre>
 
<pre>
// Adding <br/> button to the "main" section
+
// Adding Wikipedia link button to the "main" section
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
section: 'main',
 
section: 'main',
 
group: 'insert',
 
group: 'insert',
 
tools: {
 
tools: {
break: {
+
"wikipedia": {
label: 'Break tag',
+
label: 'Wikipedia',
 
type: 'button',
 
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/13/Button_enter.png',
+
icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png',
 
action: {
 
action: {
 
type: 'encapsulate',
 
type: 'encapsulate',
 
options: {
 
options: {
pre: '<' + 'br />',
+
pre: "[[Wikipedia: ",
  +
post: "|]]"
 
}
 
}
 
}
 
}
Line 176: Line 141:
 
|}
 
|}
   
==== Category ====
+
==== Break Tag ====
Pastes <code><nowiki>[[Category:</nowiki></code> and <code><nowiki>]]</nowiki></code> around your highlighted text.
+
Inserts <code><nowiki><br /></nowiki></code> into the page which is the preferred syntax on the Coppermind for creating line breaks.
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 185: Line 150:
 
|
 
|
 
<pre>
 
<pre>
// Adding category button to the "main" section
+
// Adding <br/> button to the "main" section
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
section: 'main',
 
section: 'main',
 
group: 'insert',
 
group: 'insert',
 
tools: {
 
tools: {
category: {
+
"break": {
label: 'Category',
+
label: 'Break tag',
 
type: 'button',
 
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/2d/Button_clipboard_category.png',
+
icon: '//upload.wikimedia.org/wikipedia/commons/1/13/Button_enter.png',
 
action: {
 
action: {
 
type: 'encapsulate',
 
type: 'encapsulate',
 
options: {
 
options: {
pre: "[[Category: ",
+
pre: '<' + 'br />',
post: "]]"
 
 
}
 
}
 
}
 
}
Line 207: Line 171:
 
|}
 
|}
   
==== <nowiki><code></nowiki> ====
+
==== Simple Link ====
Encases your highlighted text between <code><nowiki><code></nowiki></code> and <code><nowiki></code></nowiki></code>.
+
Simply encases the highlighted text within <code><nowiki>[[</nowiki></code> and <code><nowiki>]]</nowiki></code> to generate a normal link.
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 216: Line 180:
 
|
 
|
 
<pre>
 
<pre>
// Adding a <code> button to the "main" section
+
// Adding link button to the "main" section
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
section: 'main',
 
section: 'main',
 
group: 'insert',
 
group: 'insert',
 
tools: {
 
tools: {
code: {
+
"link": {
label: 'Code',
+
label: 'Link',
 
type: 'button',
 
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png',
+
icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png',
 
action: {
 
action: {
 
type: 'encapsulate',
 
type: 'encapsulate',
 
options: {
 
options: {
pre: '<' + 'code>',
+
pre: "[[",
post: '</' + 'code>'
+
post: "]]"
 
}
 
}
 
}
 
}
Line 238: Line 202:
 
|}
 
|}
   
==== Columns ====
+
==== Hidden Text ====
Encases your text, which should a bulleted (<code><nowiki>*</nowiki></code>) or numbered (<code><nowiki>#</nowiki></code>) list, inside of the {{t|columns}} template to columnize the list.
+
Encases the highlighted text between <code><nowiki><!--</nowiki></code> and <code><nowiki>--></nowiki></code> to prevent it from appearing in the viewable page.
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 247: Line 211:
 
|
 
|
 
<pre>
 
<pre>
// Adding columns button to the "main" section
+
// Adding hidden text button to the "main" section
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
section: 'main',
 
section: 'main',
 
group: 'insert',
 
group: 'insert',
 
tools: {
 
tools: {
columns: {
+
"hidden": {
label: 'Columns',
+
label: 'Hidden text',
 
type: 'button',
 
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/25/Vector_toolbar_bulleted_list_button.png',
+
icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_hide_wiki_tag.png',
 
action: {
 
action: {
 
type: 'encapsulate',
 
type: 'encapsulate',
 
options: {
 
options: {
pre: '{' + '{columns|' + '\n',
+
pre: "<!--",
post: '\n' + '}}'
+
post: "-->"
 
}
 
}
 
}
 
}
Line 269: Line 233:
 
|}
 
|}
   
==== Hidden Text ====
+
==== Columns ====
Encases the highlighted text between <code><nowiki><!--</nowiki></code> and <code><nowiki>--></nowiki></code> to prevent it from appearing in the viewable page.
+
Encases your text, which should a bulleted (<code><nowiki>*</nowiki></code>) or numbered (<code><nowiki>#</nowiki></code>) list, inside of the {{t|columns}} template to columnize the list.
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 278: Line 242:
 
|
 
|
 
<pre>
 
<pre>
// Adding hidden text button to the "main" section
+
// Adding columns button to the "main" section
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
section: 'main',
 
section: 'main',
 
group: 'insert',
 
group: 'insert',
 
tools: {
 
tools: {
hidden: {
+
"columns": {
label: 'Hidden text',
+
label: 'Columns',
 
type: 'button',
 
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/1b/Button_hide_wiki_tag.png',
+
icon: '//upload.wikimedia.org/wikipedia/commons/2/25/Vector_toolbar_bulleted_list_button.png',
 
action: {
 
action: {
 
type: 'encapsulate',
 
type: 'encapsulate',
 
options: {
 
options: {
pre: "<!--",
+
pre: '{' + '{columns|' + '\n',
post: "-->"
+
post: '\n' + '}}'
 
}
 
}
 
}
 
}
Line 300: Line 264:
 
|}
 
|}
   
==== Image template ====
+
==== <nowiki><code></nowiki> ====
  +
Encases your highlighted text between <code><nowiki><code></nowiki></code> and <code><nowiki></code></nowiki></code>.
Pastes the {{t|image}} template onto the page, encapsulating your cursor or whatever you have highlighted.
 
 
For example, if you have <code><nowiki>Shallan.jpg</nowiki></code> highlighted when you press the button it will result in this: <code><nowiki>{{image|Shallan.jpg|side=|width=|caption}}</nowiki></code>
 
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 311: Line 273:
 
|
 
|
 
<pre>
 
<pre>
// Adding image template button to the "main" section
+
// Adding a <code> button to the "main" section
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
section: 'main',
 
group: 'insert',
 
tools: {
 
image: {
 
label: 'Image template',
 
type: 'button',
 
icon: '//upload.wikimedia.org/wikipedia/commons/d/d8/Vector_toolbar_insert_image_button.png',
 
action: {
 
type: 'encapsulate',
 
options: {
 
pre: '{' + '{image|',
 
post: '|side=|width=|caption}}'
 
}
 
}
 
}
 
}
 
});
 
</pre>
 
|}
 
 
==== Simple Link ====
 
Simply encases the highlighted text within <code><nowiki>[[</nowiki></code> and <code><nowiki>]]</nowiki></code> to generate a normal link.
 
 
{| class="mw-collapsible mw-collapsed" width=100%
 
|-
 
|
 
|-
 
|
 
<pre>
 
// Adding link button to the "main" section
 
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
$('#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
section: 'main',
 
section: 'main',
 
group: 'insert',
 
group: 'insert',
 
tools: {
 
tools: {
link: {
+
"code": {
label: 'Link',
+
label: 'Code',
 
type: 'button',
 
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/9/97/Button_int_link.png',
+
icon: '//upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png',
 
action: {
 
action: {
 
type: 'encapsulate',
 
type: 'encapsulate',
 
options: {
 
options: {
pre: "[[",
+
pre: '<' + 'code>',
post: "]]"
+
post: '</' + 'code>'
 
}
 
}
 
}
 
}
}
 
}
 
});
 
</pre>
 
|}
 
 
==== Wikipedia Link ====
 
Pastes <code><nowiki>[[Wikipedia:</nowiki></code> and <code><nowiki>|]]</nowiki></code> around your highlighted text. This generates a link to that Wikipedia page and hides the prefix. For example, if you highlight <code>Brandon Sanderson</code> and click this button it will generate this: <code><nowiki>[[Wikipedia:Brandon Sanderson|]]</nowiki></code> which produces [[Wikipedia:Brandon Sanderson|Brandon Sanderson]] on the page.
 
 
{| class="mw-collapsible mw-collapsed" width=100%
 
|-
 
|
 
|-
 
|
 
<pre>
 
// Adding Wikipedia link button to the "main" section
 
$('#wpTextbox1').wikiEditor('addToToolbar', {
 
section: 'main',
 
group: 'insert',
 
tools: {
 
wikipedia: {
 
label: 'Wikipedia',
 
type: 'button',
 
icon: '//upload.wikimedia.org/wikipedia/commons/c/cb/Button_wikipedia.png',
 
action: {
 
type: 'encapsulate',
 
options: {
 
pre: "[[Wikipedia:",
 
post: "|]]"
 
}
 
}
 
 
}
 
}
 
}
 
}
Line 396: Line 296:
   
 
=== Premade Dropdowns ===
 
=== Premade Dropdowns ===
Dropdowns are lists of options that drop down (hence the name) from the toolbar when your cursor passes over its spot on the toolbar. Each option, when clicked, performs an [[#action]] the same way buttons do. The list of headings on the left side of the default toolbar is an example of a dropdown.
+
Dropdowns are lists of options that drop down (hence the name) from the toolbar when your cursor passes over its spot on the toolbar. Each option, when clicked, performs an [[#Actions|action]] the same way buttons do. The list of headings on the left side of the default toolbar is an example of a dropdown.
   
 
The dropdowns presented here will be added to the <code>advanced</code> section of your toolbar on the right hand side.
 
The dropdowns presented here will be added to the <code>advanced</code> section of your toolbar on the right hand side.
Line 409: Line 309:
 
|
 
|
 
<pre>
 
<pre>
//Add new references dropdown to the "advanced" section
+
//Add new references dropdown to the "advanced" section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
+
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
+
section: 'advanced',
groups: {
+
groups: {
list: {
+
list: {
tools: {
+
tools: {
references: {
+
references: {
label: 'refs',
+
label: 'references',
type: 'select',
+
type: 'select',
list: {
+
list: {
'book': {
+
'book-ref': {
label: '{' + '{book ref}}',
+
label: '{' + '{book ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{book ref|',
+
pre: '{' + '{book ref|',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'wob': {
+
'wob-ref': {
label: '{' + '{wob ref}}',
+
label: '{' + '{wob ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{wob ref|',
+
pre: '{' + '{wob ref|',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'ref': {
+
'ref-plaintext': {
label: '{' + '{ref}}',
+
label: '{' + '{ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{ref|text=',
+
pre: '{' + '{ref|text=',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'epigraph': {
+
'epigraph-ref': {
label: '{' + '{epigraph ref}}',
+
label: '{' + '{epigraph ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{epigraph ref|',
+
pre: '{' + '{epigraph ref|',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'au': {
+
'au-ref': {
label: '{' + '{au ref}}',
+
label: '{' + '{au ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{au ref|',
+
pre: '{' + '{au ref|',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'msh': {
+
'msh-ref': {
label: '{' + '{msh ref}}',
+
label: '{' + '{msh ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{msh ref|',
+
pre: '{' + '{msh ref|',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'tes': {
+
'tes-ref': {
label: '{' + '{tes ref}}',
+
label: '{' + '{tes ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{tes ref|',
+
pre: '{' + '{tes ref|',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'file': {
+
'file-ref': {
label: '{' + '{file ref}}',
+
label: '{' + '{file ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{file ref|',
+
pre: '{' + '{file ref|',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'mapref': {
+
'map-ref': {
label: '{' + '{map ref}}',
+
label: '{' + '{map ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{map ref|',
+
pre: '{' + '{map ref|',
post: '}}'
+
post: '}}'
}
+
}
}
+
}
},
+
},
'url': {
+
'url-ref': {
label: '{' + '{url ref}}',
+
label: '{' + '{url ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{url ref|url=',
+
pre: '{' + '{url ref|url=',
post: '|text=|date=|site=}}'
+
post: '|text=|date=|site=}}'
}
+
}
}
+
}
},
+
},
'17s': {
+
'17s-ref': {
label: '{' + '{17s ref}}',
+
label: '{' + '{17s ref}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{17s ref|topic/news/post',
+
pre: '{' + '{17s ref|topic/news/post',
post: '|id#|description|date=}}'
+
post: '|id#|description|date=}}'
}
+
}
}
+
}
}
+
}
}
+
}
}
+
}
}
+
}
}
+
}
}
+
}
} );
+
} );
 
</pre>
 
</pre>
 
|}
 
|}
Line 549: Line 449:
 
|
 
|
 
<pre>
 
<pre>
//Add new build-a-box dropdown to the "advanced" section
+
//Add new build-a-box dropdown to the "advanced" section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
+
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
+
section: 'advanced',
groups: {
+
groups: {
list: {
+
list: {
tools: {
+
tools: {
simplecharacterinfobox: {
+
simplecharacterinfobox: {
label: 'build-a-box',
+
label: 'build-a-box',
type: 'select',
+
type: 'select',
list: {
+
list: {
'start': {
+
'start': {
label: '{' + '{character',
+
label: '{' + '{character',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '{' + '{character'
+
pre: '{' + '{character'
}
+
}
}
+
}
},
+
},
'residence': {
+
'residence': {
label: '|residence=',
+
label: '|residence=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|residence='
+
pre: '\n' + '|residence='
}
+
}
}
+
}
},
+
},
'imageparam': {
+
'imageparam': {
label: '|image=',
+
label: '|image=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|image='
+
pre: '\n' + '|image='
}
+
}
}
+
}
},
+
},
'profession': {
+
'profession': {
label: '|profession=',
+
label: '|profession=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|profession='
+
pre: '\n' + '|profession='
}
+
}
}
+
}
},
+
},
'#profession': {
+
'#profession': {
label: '|#profession=',
+
label: '|#profession=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|#profession='
+
pre: '\n' + '|#profession='
}
+
}
}
+
}
},
+
},
'skills': {
+
'skills': {
label: '|skills=',
+
label: '|skills=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|skills='
+
pre: '\n' + '|skills='
}
+
}
}
+
}
},
+
},
'species': {
+
'species': {
label: '|species=',
+
label: '|species=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|species='
+
pre: '\n' + '|species='
}
+
}
}
+
}
},
+
},
'abilities': {
+
'abilities': {
label: '|abilities=',
+
label: '|abilities=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|abilities='
+
pre: '\n' + '|abilities='
}
+
}
}
+
}
},
+
},
'ethnicity': {
+
'ethnicity': {
label: '|ethnicity=',
+
label: '|ethnicity=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|ethnicity='
+
pre: '\n' + '|ethnicity='
}
+
}
}
+
}
},
+
},
'born': {
+
'born': {
label: '|born=',
+
label: '|born=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|born='
+
pre: '\n' + '|born='
}
+
}
}
+
}
},
+
},
'died': {
+
'died': {
label: '|died=',
+
label: '|died=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|died='
+
pre: '\n' + '|died='
}
+
}
}
+
}
},
+
},
'nationality': {
+
'nationality': {
label: '|nationality=',
+
label: '|nationality=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|nationality='
+
pre: '\n' + '|nationality='
}
+
}
}
+
}
},
+
},
'bonded': {
+
'bonded': {
label: '|bonded=',
+
label: '|bonded=',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|bonded='
+
pre: '\n' + '|bonded='
}
+
}
}
+
}
}
+
}
}
+
}
}
+
}
}
+
}
}
+
}
}
+
}
} );
+
} );
 
</pre>
 
</pre>
 
|}
 
|}
Line 696: Line 596:
 
|
 
|
 
<pre>
 
<pre>
//Add new infobox endings dropdown to the "advanced" section
+
//Add new infobox endings dropdown to the "advanced" section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
+
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
+
section: 'advanced',
groups: {
+
groups: {
list: {
+
list: {
tools: {
+
tools: {
endings: {
+
endings: {
label: 'ends',
+
label: 'ends',
type: 'select',
+
type: 'select',
list: {
+
list: {
'sa': {
+
'sa': {
label: 'Stormlight',
+
label: 'Stormlight',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|world=Roshar' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[The Stormlight Archive]]' + '\n' + '}}'
+
pre: '\n' + '|world=Roshar' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[The Stormlight Archive]]' + '\n' + '}}'
}
+
}
}
+
}
},
+
},
'mbe1': {
+
'mbe1': {
label: 'MB Era 1',
+
label: 'MB Era 1',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 1]]' + '\n' + '}}'
+
pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 1]]' + '\n' + '}}'
}
+
}
}
+
}
},
+
},
'mbe2': {
+
'mbe2': {
label: 'MB Era 2',
+
label: 'MB Era 2',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 2]]' + '\n' + '}}'
+
pre: '\n' + '|world=Scadrial' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Mistborn Era 2]]' + '\n' + '}}'
}
+
}
}
+
}
},
+
},
'wb': {
+
'wb': {
label: 'Warbreaker',
+
label: 'Warbreaker',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|world=Nalthis' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Warbreaker]]' + '\n' + '}}'
+
pre: '\n' + '|world=Nalthis' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Warbreaker]]' + '\n' + '}}'
}
+
}
}
+
}
},
+
},
'ela': {
+
'ela': {
label: 'Elantris',
+
label: 'Elantris',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|world=Sel' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Elantris (book)|Elantris]]' + '\n' + '}}'
+
pre: '\n' + '|world=Sel' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[Elantris (book)|Elantris]]' + '\n' + '}}'
}
+
}
}
+
}
},
+
},
'alc': {
+
'alc': {
label: 'Alcatraz',
+
label: 'Alcatraz',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|earth=Alcatraz' + '\n' + '|books=[[Alcatraz Versus the Evil Librarians (series)|Alcatraz Versus the Evil Librarians]]' + '\n' + '}}'
+
pre: '\n' + '|earth=Alcatraz' + '\n' + '|books=[[Alcatraz Versus the Evil Librarians (series)|Alcatraz Versus the Evil Librarians]]' + '\n' + '}}'
}
+
}
}
+
}
},
+
},
'ws': {
+
'ws': {
label: 'White Sand',
+
label: 'White Sand',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|world=Taldain' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[White Sand]]' + '\n' + '}}'
+
pre: '\n' + '|world=Taldain' + '\n' + '|universe=[[Cosmere]]' + '\n' + '|books=[[White Sand]]' + '\n' + '}}'
}
+
}
}
+
}
},
+
},
'first-born': {
+
'skyward': {
label: 'Firstborn',
+
label: 'Skyward',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '|nation=High Empire' + '\n' + '|books=[[Firstborn]]' + '\n' + '}}'
+
pre: '\n' + '|world=',
  +
post: '\n' + '|universe=[[Cytoverse]]' + '\n' + '|books=[[Skyward (series)]]' + '\n' + '}}'
}
 
}
+
}
},
+
}
'skyward': {
+
}
label: 'Skyward',
+
}
action: {
+
}
  +
}
type: 'encapsulate',
 
options: {
+
}
  +
}
pre: '\n' + '|world=',
 
  +
} );
post: '\n' + '|universe=[[Cytoverse]]' + '\n' + '|books=[[Skyward (series)]]' + '\n' + '}}'
 
}
 
}
 
}
 
}
 
}
 
}
 
}
 
}
 
} );
 
 
</pre>
 
</pre>
 
|}
 
|}
   
 
==== Page Endings ====
 
==== Page Endings ====
This dropdown follows the previous two on this list and makes the rest of page creation quick and easy. After selecting the relevant option from the Infobox Ends dropdown simply click the first three items in this dropdown followed by the relevant article status template and navbar template. Everything is inserted with the proper spacing and all that is left for you to do is to write the text of the article.
+
This dropdown follows the previous two on this list and makes the rest of page creation quick and easy. After selecting the relevant option from the Infobox Ends dropdown simply click the first three items in this dropdown followed by the relevant completion template and navbar template. Everything is inserted with the proper spacing and all that is left for you to do is to write the text of the article.
   
 
{| class="mw-collapsible mw-collapsed" width=100%
 
{| class="mw-collapsible mw-collapsed" width=100%
Line 806: Line 697:
 
|
 
|
 
<pre>
 
<pre>
//Add new page ends dropdown to the "advanced" section
+
//Add new page ends dropdown to the "advanced" section
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
+
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
+
section: 'advanced',
groups: {
+
groups: {
list: {
+
list: {
tools: {
+
tools: {
bottoms: {
+
bottoms: {
label: 'bottoms',
+
label: 'bottoms',
type: 'select',
+
type: 'select',
list: {
+
list: {
'pagename': {
+
'pagename': {
label: '{' + '{SUBST:PAGENAME}}',
+
label: '{' + '{SUBST:PAGENAME}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\''
+
pre: '\n' + '\'\'\'{' + '{SUBST:PAGENAME}}\'\'\''
}
+
}
}
+
}
},
+
},
'subpagename': {
+
'notes': {
label: '{' + '{SUBST:SUBPAGENAME}}',
+
label: '== Notes ==',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '\'\'\'{' + '{SUBST:SUBPAGENAME}}\'\'\''
+
pre: '\n\n' + '== Notes =='
}
+
}
}
+
}
},
+
},
'notes': {
+
'refsection': {
label: '== Notes ==',
+
label: '<' + 'references/>',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n\n' + '== Notes =='
+
pre: '\n' + '<' + 'references />'
}
+
}
}
+
}
},
+
},
'refsection': {
+
'stub': {
label: '<' + 'references/>',
+
label: '{' + '{stub}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '<' + 'references />'
+
pre: '\n' + '{' + '{stub}}'
}
+
}
}
+
}
},
+
},
'stub': {
+
'partial': {
label: '{' + '{stub}}',
+
label: '{' + '{partial}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{stub}}'
+
pre: '\n' + '{' + '{partial}}'
}
+
}
}
+
}
},
+
},
'partial': {
+
'complete': {
label: '{' + '{partial}}',
+
label: '{' + '{complete}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{partial}}'
+
pre: '\n' + '{' + '{complete}}'
}
+
}
}
+
}
},
+
},
'complete': {
+
'alcatraz': {
label: '{' + '{complete}}',
+
label: '{' + '{Alcatraz}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{complete}}'
+
pre: '\n' + '{' + '{Alcatraz}}'
}
+
}
}
+
}
},
+
},
'alcatraz': {
+
'elantris': {
label: '{' + '{Alcatraz}}',
+
label: '{' + '{Elantris}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{Alcatraz}}'
+
pre: '\n' + '{' + '{Elantris}}'
}
+
}
}
+
}
},
+
},
'elantris': {
+
'mbera1': {
label: '{' + '{Elantris}}',
+
label: '{' + '{Mistborn|Era 1}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{Elantris}}'
+
pre: '\n' + '{' + '{Mistborn|Era 1}}'
}
+
}
}
+
}
},
+
},
'mbera1': {
+
'mbera2': {
label: '{' + '{Mistborn|Era 1}}',
+
label: '{' + '{Mistborn|Era 2}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{Mistborn|Era 1}}'
+
pre: '\n' + '{' + '{Mistborn|Era 2}}'
}
+
}
}
+
}
},
+
},
'mbera2': {
+
'reckoners': {
label: '{' + '{Mistborn|Era 2}}',
+
label: '{' + '{Reckoners}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{Mistborn|Era 2}}'
+
pre: '\n' + '{' + '{Reckoners}}'
}
+
}
}
+
}
},
+
},
'reckoners': {
+
'sky': {
label: '{' + '{Reckoners}}',
+
label: '{' + '{Skyward}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{Reckoners}}'
+
pre: '\n' + '{' + '{Skyward}}'
}
+
}
}
+
}
},
+
},
'sky': {
+
'storm': {
label: '{' + '{Skyward}}',
+
label: '{' + '{Stormlight}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{Skyward}}'
+
pre: '\n' + '{' + '{Stormlight}}'
}
+
}
}
+
}
},
+
},
'storm': {
+
'warbreaker': {
label: '{' + '{Stormlight}}',
+
label: '{' + '{Warbreaker}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{Stormlight}}'
+
pre: '\n' + '{' + '{Warbreaker}}'
}
+
}
}
+
}
},
+
},
'warbreaker': {
+
'whitesand': {
label: '{' + '{Warbreaker}}',
+
label: '{' + '{White Sand}}',
action: {
+
action: {
type: 'encapsulate',
+
type: 'encapsulate',
options: {
+
options: {
pre: '\n' + '{' + '{Warbreaker}}'
+
pre: '\n' + '{' + '{White Sand}}'
}
+
}
}
+
}
},
+
}
'firstborn': {
+
}
label: '{' + '{Firstborn}}',
+
}
action: {
+
}
  +
}
type: 'encapsulate',
 
  +
}
options: {
 
  +
} );
pre: '\n' + '{' + '{Firstborn}}'
 
}
 
} },
 
'whitesand': {
 
label: '{' + '{White Sand}}',
 
action: {
 
type: 'encapsulate',
 
options: {
 
pre: '\n' + '{' + '{White Sand}}'
 
}
 
}
 
}
 
}
 
}
 
}
 
}
 
}
 
} );
 
 
</pre>
 
</pre>
 
|}
 
|}
   
 
=== Premade Booklets ===
 
=== Premade Booklets ===
A <code>booklet</code> is a type of section within the editing toolbar. Unlike a <code>toolbar</code> section which can contain buttons and dropdowns, booklet sections instead contain <code>pages</code>. The <code>Special characters</code> and <code>Help</code> sections of the default toolbar are examples of booklets.
+
A <code>booklet</code> is a type of section within the editing toolbar. Unlike a <code>toolbar</code> section which can contain buttons and dropdowns, booklet section instead contain <code>pages</code>. The <code>Special characters</code> and <code>Help</code> sections of the default toolbar are examples of booklets.
   
 
Booklets and dropdowns perform similar functions and which of the two you choose to use is mainly a matter of personal preference.
 
Booklets and dropdowns perform similar functions and which of the two you choose to use is mainly a matter of personal preference.
Line 1,013: Line 887:
 
//These next two reference templates are very long so they are done differently
 
//These next two reference templates are very long so they are done differently
 
{
 
{
action: {
+
'action': {
type: 'encapsulate',
+
'type': 'encapsulate',
 
options: {
 
options: {
 
pre: '{' + '{url ref|url=',
 
pre: '{' + '{url ref|url=',
Line 1,020: Line 894:
 
}
 
}
 
},
 
},
label: '{' + '{url ref}}'
+
'label': '{' + '{url ref}}'
 
},
 
},
 
{
 
{
action: {
+
'action': {
type: 'encapsulate',
+
'type': 'encapsulate',
 
options: {
 
options: {
 
pre: '{' + '{17s ref|topic/news/post',
 
pre: '{' + '{17s ref|topic/news/post',
Line 1,111: Line 985:
 
== Customization==
 
== Customization==
 
In this section we will present a guide to creating your own buttons, booklets and dropdowns for your toolbar. While there are other options and ways to do these things, for the sake of clarity and simplicity here we have limited this guide to the things that are the most useful and easiest to understand. For a more complete (though less clear) guide to the toolbar see [https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization Mediawiki's full guide].
 
In this section we will present a guide to creating your own buttons, booklets and dropdowns for your toolbar. While there are other options and ways to do these things, for the sake of clarity and simplicity here we have limited this guide to the things that are the most useful and easiest to understand. For a more complete (though less clear) guide to the toolbar see [https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization Mediawiki's full guide].
 
If the changes you made are not working and you would like assistance you can DM <code>King of Herdaz#2300</code> on Discord for help.
 
   
 
=== General Guidelines ===
 
=== General Guidelines ===
Line 1,118: Line 990:
   
 
* If you are having trouble, look at the example elements presented above and use them as a guide. Or simply copy one of the sample elements and modify it following the steps presented in this guide.
 
* If you are having trouble, look at the example elements presented above and use them as a guide. Or simply copy one of the sample elements and modify it following the steps presented in this guide.
  +
* You should not reuse internal names within your entire toolbar. If you use the same internal name multiple times then either strange things will happen or the toolbar will simply break.
* To add a one line comment put <code>//</code> at the beginning of a line followed by the text of the comment. Whatever you write after a <code>//</code> on that line will not affect your code.
 
* For multi line comments put your comments between <code>/*</code> and <code>*/</code>.
+
* To add a comment put <code>//</code> at the beginning of a line followed by the text of the comment. Whatever you write after a <code>//</code> will not affect your code.
* Code for your toolbar must have the exact correct number of curly brackets (<code>{</code>), square brackets (<code>[</code>), apostrophes (<code>'</code>), parentheses (<code>(</code>), and commas (<code>,</code>) to work. If your toolbar breaks after you changed something check to see if you missed or added an extra one of these.
 
* While not strictly necessary, it is a good idea to split code in your toolbar over multiple lines and with whitespace differentiating each "level" of the toolbar in a manner similar to how it is done in the examples on this page. This will help you keep track of the different parts of your code and will help you keep track of the number of open and closed curly brackets in your code.
 
 
==== Strings ====
 
A string is a piece of text within the toolbar that is encased between two apostrophes {<code>'</code>). Strings are used in labels and actions. They should follow the following guidelines, though some of them are not relevant to labels.
 
   
* Inserting <code>' + '</code> between two parts of a string can have effects on your [[Special:MyPage/common.js|common.js]] page (as will be discussed below), but will not appear on a page when the action is called, or be included in the label(s) on the actual toolbar. For example, both <code><nowiki>{{stub}}</nowiki></code> and <code><nowiki>{' + '{stub}}</nowiki></code> will produce the same result (<code><nowiki>{{stub}}</nowiki></code>) on the page when they are called.
+
* Inserting <code>' + '</code> between two pieces of text can have effects on your <code>common.js</code> page (as will be discussed below), but will not appear on a page when the action is called. For example, both <code><nowiki><br /></nowiki></code> and <code><nowiki><' + 'br /></nowiki></code> will produce the same result (<code><nowiki><br /></nowiki></code>) on the page when they are called.
* When writing out templates, whether for a label or an action, you must insert <code>' + '</code> between the first two curly brackets. For example, instead of writing <code><nowiki>{{Stormlight}}</nowiki></code> you should write <code><nowiki>{' + '{Stormlight}}</nowiki></code>. This prevents the template from applying categories to your [[Special:MyPage/common.js|common.js]] page and also prevents it from being listed on the relevant template's list of pages that use it.
+
* When writing out templates, whether for a label or an action, you must insert <code>' + '</code> between the first two curly brackets. For example, instead of writing <code><nowiki>{{Stormlight}}</nowiki></code> you should write <code><nowiki>{' + '{Stormlight}}</nowiki></code>. This prevents the template from applying categories to your <code>common.js</code> page and also prevents it from being listed on the relevant template's list of pages that use it.
 
* For the same reason you must also do this when writing category tags. For example, instead of writing <code><nowiki>[[Category: Stormlight]]</nowiki></code> you should write <code><nowiki>[' + '[Category: Stormlight]]</nowiki></code>.
 
* For the same reason you must also do this when writing category tags. For example, instead of writing <code><nowiki>[[Category: Stormlight]]</nowiki></code> you should write <code><nowiki>[' + '[Category: Stormlight]]</nowiki></code>.
* When writing code for substitutions this is even more important, since if you do not do it then the substitution will be performed when you save your [[Special:MyPage/common.js|common.js]] page. For example, instead of writing <code><nowiki>{{SUBST:PAGENAME}}</nowiki></code> you should write <code><nowiki>{' + '{SUBST:PAGENAME}}</nowiki></code>.
+
* When writing code for substitutions this is even more important, since if you do not do it then the substitution will be performed when you save your <code>common.js</code> page. For example, instead of writing <code><nowiki>{{SUBST:PAGENAME}}</nowiki></code> you should write <code><nowiki>{' + '{SUBST:PAGENAME}}</nowiki></code>.
   
==== Internal Names ====
 
Many things in the toolbar must be given internal names. Internal names help the program differentiate between different parts of the toolbar. What you use as an internal name will not affect the toolbar so you can use any string of characters.
 
 
Internal names must not contain any spaces. If you want an internal name to be more than one word you can use a dash (<code>-</code>) instead of a space. You should not reuse internal names within your entire toolbar. If you use the same internal name more than once then either strange things will happen or the toolbar will simply break.
 
 
==== Labels ====
 
A label is the name of an element that will be displayed on the toolbar. For dropdowns these are displayed in the dropdown itself, while with buttons the label is shown when you hover your cursor over the icon for the button. Unlike internal names labels can be reused.
 
 
{{anchor|action}}{{anchor|actions}}
 
 
==== Actions ====
 
==== Actions ====
While there are other types of actions that you can do, in this guide we focus on the <code>encapsulate</code> action as it is the easiest to understand and use. This action pastes one string before the highlighted text (or you cursor) and a second string after the highlighted text. The second string (after <code>post:</code>) is optional and can be deleted if you only want to insert one string.
+
While there are other types of actions that you can do, in this guide we focus on the <code>encapsulate</code> action as it is the easiest to understand and use. This action pastes one snippet of text before the highlighted text (or you cursor) and a second snippet after the highlighted text. The second snippet (<code>post:</code>) can be deleted if you only want to insert one snippet of text.
   
 
The code for this action is as follows, and this format is the same for dropdowns, booklets and buttons.
 
The code for this action is as follows, and this format is the same for dropdowns, booklets and buttons.
Line 1,153: Line 1,011:
 
</pre>
 
</pre>
   
<code>XXXX</code> is replaced by the string that goes before the highlighted text/cursor, and <code>YYYY</code> is replaced by the string that goes after the highlighted text/cursor.
+
<code>XXXX</code> is replaced by the snippet that goes before the highlighted text/cursor, and <code>YYYY</code> is replaced by the snippet that goes after the highlighted text/cursor.
   
* To have an action include a line break insert <code>\n</code> into the string at the place you want it to be. For stylistic reasons some people will put <code>' + '</code> between instances of <code>\n</code> and other text in their strings, but this does not have any effect on the output of the action and can be omitted if you want.
+
* To have an action include a line break insert <code>\n</code> into the snippet at the place you want it to be. For stylistic reasons some people will put <code>' + '</code> between instances of <code>\n</code> and other text in their snippets, but this does not have any effect on the output of the action and can be omitted if you want.
* To have an action include an apostrophe (<code>'</code>) within the string that it inserts, place <code>\'</code> into your code at the place you want the apostrophe to go. If you do not include the backslash (<code>\</code>) and type additional apostrophes in your code it will cause the toolbar to break. You must put an additional backslash with each additional apostrophe you add to a string.
+
* To have an action include an apostrophe (<code>'</code>) within the text that it inserts, place <code>\'</code> into your code at the place you want the apostrophe to go. If you do not include the backslash (<code>\</code>) and type additional apostrophes in your code it will cause the toolbar to break.
   
 
=== Creating Your Own Buttons ===
 
=== Creating Your Own Buttons ===
To create your own button paste the code at the end of this section into your [[Special:MyPage/common.js|common.js]] page between the two [[#Basic]] sections and change the following things:
+
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]] to the toolbar this should be either <code>main</code> or <code>advanced</code>.
+
* 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>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.
+
* Replace <code>CCCC</code> with what you want to name the button internally. The text that you put here does not actually affect anything and only matters for stylistic purposes.
* Replace <code>DDDD</code> with the label for this button. The text you put here will be shown when you hover your cursor over this button's icon on your toolbar.
+
* Replace <code>DDDD</code> with what you want to name the button. Unlike the previous item, this actually makes a difference. The text you put here will be shown when you hover your cursor over this button's icon on your toolbar.
 
* Replace <code>EEEE</code> with a link to the file that you would like to use as the icon for your button. This needs to be a full link starting after <code>https:</code>. For example, you can use <code>//upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png</code>. While you can use any file as your icon it is recommended that you use one of the icons listed on Mediawiki's [https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_icons list of toolbar icons] since they are all of a size and shape that works.
 
* Replace <code>EEEE</code> with a link to the file that you would like to use as the icon for your button. This needs to be a full link starting after <code>https:</code>. For example, you can use <code>//upload.wikimedia.org/wikipedia/commons/2/23/Button_code.png</code>. While you can use any file as your icon it is recommended that you use one of the icons listed on Mediawiki's [https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_icons list of toolbar icons] since they are all of a size and shape that works.
* Replace <code>FFFF</code> and <code>GGGG</code> as you would with any other [[#action]].
+
* Replace <code>FFFF</code> and <code>GGGG</code> as you would with any other [[#Actions|action]].
   
  +
{| class="mw-collapsible mw-collapsed" width=100%
  +
|-
  +
|
  +
|-
  +
|
 
<pre>
 
<pre>
 
// Optional Description
 
// Optional Description
Line 1,174: Line 1,037:
 
group: 'BBBB',
 
group: 'BBBB',
 
tools: {
 
tools: {
CCCC: {
+
"CCCC": {
 
label: 'DDDD',
 
label: 'DDDD',
 
type: 'button',
 
type: 'button',
Line 1,189: Line 1,052:
 
});
 
});
 
</pre>
 
</pre>
  +
|}
   
 
=== Creating Your Own Dropdowns ===
 
=== Creating Your Own Dropdowns ===
To start add this code into your [[Special:MyPage/common.js|common.js]] page between the two [[#Basic]] sections and change the following things:
+
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 [[#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>.
+
* 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>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.
+
* Replace <code>CCCC</code> with the name for the dropdown that will be displayed on the page.
 
Repeat the following steps for each item you add to your dropdown:
 
Repeat the following steps for each item you add to your dropdown:
* Replace <code>WWWW</code> with the internal name for the item.
+
* Replace <code>WWWW</code> with the internal name for the item
* Replace <code>XXXX</code> with the label for the item. This is how it will appear on the list.
+
* Replace <code>XXXX</code> with the display name for the item. This is how it will appear on the list.
* Replace <code>YYYY</code> and <code>ZZZZ</code> as you would with any other [[#action]].
+
* Replace <code>YYYY</code> and <code>ZZZZ</code> as you would with any other [[#Actions|action]].
   
  +
{| class="mw-collapsible mw-collapsed" width=100%
  +
|-
  +
|
  +
|-
  +
|
 
<pre>
 
<pre>
 
//Optional description
 
//Optional description
Line 1,211: Line 1,080:
 
type: 'select',
 
type: 'select',
 
list: {
 
list: {
WWWW: {
+
'WWWW': {
 
label: 'XXXX',
 
label: 'XXXX',
 
action: {
 
action: {
Line 1,231: Line 1,100:
 
} );
 
} );
 
</pre>
 
</pre>
  +
|}
   
 
For each item you want to add to the dropdown add the following code into the space indicated above and change the <code>WWWW</code>, <code>XXXX</code>, <code>YYYY</code>, and <code>ZZZZ</code> as you did for the first action in the list.
 
For each item you want to add to the dropdown add the following code into the space indicated above and change the <code>WWWW</code>, <code>XXXX</code>, <code>YYYY</code>, and <code>ZZZZ</code> as you did for the first action in the list.
   
  +
{| class="mw-collapsible mw-collapsed" width=100%
  +
|-
  +
|
  +
|-
  +
|
 
<pre>
 
<pre>
 
},
 
},
WWWW: {
+
'WWWW': {
 
label: 'XXXX',
 
label: 'XXXX',
 
action: {
 
action: {
Line 1,246: Line 1,121:
 
}
 
}
 
</pre>
 
</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 [[Special:MyPage/common.js|common.js]] 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 [[Special:MyPage/common.js|common.js]] 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>
 
   
 
=== Creating Your Own Booklets ===
 
=== Creating Your Own Booklets ===
Here we will tell you how to create booklets that contain pages of characters. For other things you can do with booklets see [https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization Mediawiki's guide].
+
Here we will tell you how to create booklets that contain pages of characters (which can also be [[#Actions]]). For other things you can do with booklets see [https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization Mediawiki's guide].
   
  +
Booklets and dropdowns perform similar functions and which of the two you choose to use is mainly a matter of personal preference.
A key difference between dropdowns and booklets is that while with dropdowns every option must be an action, with booklets that is not the case. Booklets contain <code>pages</code> of <code>characters</code> that when clicked paste text into the page. Characters can be either simple strings or [[#actions]]. This can make it easier to add items to booklets than to dropdowns, though booklets do have their complexities.
 
   
To create a new booklet section add the following code to your [[Special:MyPage/common.js|common.js]] page between the two [[#Basic]] sections and change the following things:
+
To create a new booklet section add the following code to your <code>/common.js</code> page:
* Replace <code>AAAA</code> with the internal name for the section.
 
* Replace <code>BBBB</code> with the label for the section.
 
   
 
<pre>
 
<pre>
 
//Optional description
 
//Optional description
 
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
sections: {
+
'sections': {
 
'AAAA': {
 
'AAAA': {
type: 'booklet',
+
'type': 'booklet',
label: 'BBBB',
+
'label': 'BBBB',
pages: {
+
'pages': {
 
</pre>
 
</pre>
   
Line 1,315: Line 1,152:
   
 
==== Pages ====
 
==== Pages ====
To create a new page for a booklet insert the following code in between the two pieces of code at the beginning of this section and make the following changes:
+
To create a new page for a booklet insert the following code
* Replace <code>CCCC</code> with the internal name for this page.
 
* Replace <code>DDDD</code> with the label for this page.
 
 
 
<pre>
 
<pre>
 
//Optional description
 
//Optional description
CCCC: {
+
'section-CCCC': {
label: 'DDDD',
+
'label': 'DDDD',
layout: 'characters',
+
'layout': 'characters',
characters: [
+
'characters': [
 
</pre>
 
</pre>
   
Characters you add to this page will go here.
+
Place the characters you want in this page here followed by this:
   
 
<pre>
 
<pre>
 
]
 
]
 
},
 
},
</pre>
 
 
==== Characters ====
 
For each character you add to a page paste the following code into the page (in the space indicated above) and replace <code>EEEE</code> with the text you want pasted into the page when this character is clicked. When you add characters this way the name displayed will simply be the text that you put in place of <code>EEEE</code>.
 
 
<pre>
 
'EEEE',
 
</pre>
 
 
Alternatively, you can add characters as [[#actions]]. This is helpful if the text you want inserted when this option is selected is very long and will take up a lot of space in the booklet page, or when you want this character to encapsulate text.
 
 
To add a character as an action paste the following code into the page (in the space indicated above) and change the following things:
 
* Replace <code>XXXX</code> and <code>YYYY</code> as you would with any other [[#action]].
 
* Replace <code>ZZZZ</code> with the label for this item that will be displayed in its booklet page.
 
 
<pre>
 
{
 
action: {
 
type: 'encapsulate',
 
options: {
 
pre: 'XXXX',
 
post: 'YYYY'
 
}
 
},
 
label: 'ZZZZ'
 
},
 
 
</pre>
 
</pre>
   
Line 1,363: Line 1,171:
 
This can be a little tricky since in order to remove an element you need to know what it is named. To find the name you will have to comb through the page source or look through [https://phabricator.wikimedia.org/diffusion/EWED/browse/master/modules/jquery.wikiEditor.toolbar.config.js the code for the default version].
 
This can be a little tricky since in order to remove an element you need to know what it is named. To find the name you will have to comb through the page source or look through [https://phabricator.wikimedia.org/diffusion/EWED/browse/master/modules/jquery.wikiEditor.toolbar.config.js the code for the default version].
   
Fortunately, the names of many of the elements are known. Here are premade snippets of code for many of the elements in the default toolbar. Paste any one of them into your [[Special:MyPage/common.js|common.js]] page within the two [[#Basic]] sections to remove that element.
+
Fortunately, the names of many of the elements are known. Here are premade snippets of code for many of the elements in the default toolbar. Paste any one of them into your <code>Common.js</code> page within the two [[#Basic]] sections to remove that element.
   
 
==== <nowiki><ref></nowiki> Button ====
 
==== <nowiki><ref></nowiki> Button ====
Line 1,374: Line 1,182:
 
//Remove the default <ref> button
 
//Remove the default <ref> button
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section:: 'main',
+
'section': 'main',
group:: 'insert',
+
'group': 'insert',
tool:: 'reference'
+
'tool': 'reference'
 
});</pre>
 
});</pre>
 
|}
 
|}
Line 1,389: Line 1,197:
 
//remove the bulleted list button
 
//remove the bulleted list button
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section:: 'advanced',
+
'section': 'advanced',
group:: 'format',
+
'group': 'format',
tool:: 'ulist'
+
'tool': 'ulist'
 
});</pre>
 
});</pre>
 
|}
 
|}
Line 1,404: Line 1,212:
 
//remove the numbered list button
 
//remove the numbered list button
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section:: 'advanced',
+
'section': 'advanced',
group:: 'format',
+
'group': 'format',
tool:: 'olist'
+
'tool': 'olist'
 
});</pre>
 
});</pre>
 
|}
 
|}
Line 1,419: Line 1,227:
 
//remove the default <br> button (to replace it with a <br/> button which is preferred on the Coppermind)
 
//remove the default <br> button (to replace it with a <br/> button which is preferred on the Coppermind)
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section:: 'advanced',
+
'section': 'advanced',
group:: 'format',
+
'group': 'format',
tool:: 'newline'
+
'tool': 'newline'
 
});</pre>
 
});</pre>
 
|}
 
|}
Line 1,434: Line 1,242:
 
//remove table button
 
//remove table button
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section:: 'advanced',
+
'section': 'advanced',
group:: 'insert',
+
'group': 'insert',
tool:: 'table'
+
'tool': 'table'
 
});</pre>
 
});</pre>
 
|}
 
|}
Line 1,449: Line 1,257:
 
//remove File button
 
//remove File button
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section:: 'main',
+
'section': 'main',
group:: 'insert',
+
'group': 'insert',
tool:: 'file'
+
'tool': 'file'
 
});</pre>
 
});</pre>
 
|}
 
|}
Line 1,464: Line 1,272:
 
//remove original link button
 
//remove original link button
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section:: 'main',
+
'section': 'main',
group:: 'insert',
+
'group': 'insert',
tool:: 'link'
+
'tool': 'link'
 
});</pre>
 
});</pre>
 
|}
 
|}
Line 1,479: Line 1,287:
 
<pre>
 
<pre>
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
 
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
section:: 'XXXX',
+
'section': 'XXXX',
group:: 'YYYY',
+
'group': 'YYYY',
tool:: 'ZZZZ'
+
'tool': 'ZZZZ'
 
});</pre>
 
});</pre>
 
|}
 
|}

Please note that all contributions to The Coppermind are considered to be released under the CC4 by-nc-nd (see Coppermind:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel Editing help (opens in new window)

Templates used on this page: