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

m
no edit summary
m
 
=== Others ===
For elements not on this list take this code and replace <code>XXXX</code> with the name of the section the element is in, replace <code>YYYY</code> with the name of the group the element is part of, and replace <code>ZZZZ</code> with the name of the element. You you can find these names by looking through [https://phabricator.wikimedia.org/diffusion/EWED/browse/master/modules/jquery.wikiEditor.toolbar.config.js the code for the default version].
{| class="mw-collapsible mw-collapsed" width=100%
|-
* 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>FFFF</code> withand the<code>GGGG</code> firstas snippetyou ofwould text.with Followany theother [[#General GuidelinesActions|action]].
* Replace <code>GGGG</code> with the second snippet of text. Follow the [[#General Guidelines]]. If you do not want to have a second snippet you can delete this line.
 
{| class="mw-collapsible mw-collapsed" width=100%
=== 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:
* Replace <code>AAAA</code> with the internal name for the dropdown.
*
* Replace <code>BBBB</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:
* Replace <code>WWWW</code> with the internal name for the item
* 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 [[#Actions|action]].
 
{| class="mw-collapsible mw-collapsed" width=100%
 
== General Guidelines ==
Here are some rules and tips for writing code on for yourtoolbaryour toolbar:
 
* 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 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>.
* 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.
* Do not reuse internal names within your entire toolbar.
 
=== Actions ===
Autopatrolled, Editors
8,830

edits