Jump to content

MediaWiki:Common.js/edit: Difference between revisions

m
→‎Defining new buttons: wording/formatting
m (sigh, did I really put this stupid obscure joke here?)
m (→‎Defining new buttons: wording/formatting)
Line 195: Line 195:


==Defining new buttons==
==Defining new buttons==
XEB can also work with extra buttons created by the user. To do this you must define the <tt>myButtons</tt> variable in [[Special:Mypage/monobook.js|your monobook.js]]. The format of <tt>myButtons</tt> is:
XEB can also work with extra buttons created by the user. To do this you must define the <tt>myButtons</tt> variable on your custom JS page. The format of <tt>myButtons</tt> is:


<pre>
<pre>
Line 209: Line 209:
* <tt>Before</tt> is the text to insert before the current cursor location.
* <tt>Before</tt> is the text to insert before the current cursor location.
* <tt>After</tt> is the text to place after the current cursor location.
* <tt>After</tt> is the text to place after the current cursor location.
* <tt>Text</tt> is the text that is placed between before and after. If the user has selected text in the edit box when the button is pressed this selected text will be placed between before and after instead.
* <tt>Text</tt> is the text that is placed between <tt>Before</tt> and <tt>After</tt>. If the user has selected text in the edit box, when the button is pressed this selected text will be placed between <tt>Before</tt> and <tt>After</tt> instead of <tt>Text</tt>.


This example defines two extra buttons:
This example defines two extra buttons: