Jump to content

MediaWiki:Common.js/edit: Difference between revisions

m
m (→‎Adding buttons: the tags need to be on the side of the transcluded page to avoid massive ugliness)
m (→‎Defining new buttons: less ugly code)
Line 197: Line 197:
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 in [[Special:Mypage/monobook.js|your monobook.js]]. The format of <tt>myButtons</tt> is:


<code>
<pre>
myButtons={'_CODE1':['url1','Tooltip1','Before1','After1','Text1'],
myButtons={'_CODE1':['url1','Tooltip1','Before1','After1','Text1'],
'_CODE2':['url2','Tooltip2','Before2','After2','Text2']};
'_CODE2':['url2','Tooltip2','Before2','After2','Text2']};
</code>
</pre>


where:
where:
Line 213: Line 213:
This example defines two extra buttons:
This example defines two extra buttons:


<code>
<pre>
myButtons={'_ZZ':['http://upload.wikimedia.org/wikipedia/commons/e/e9/Button_headline2.png','Mark Test','Before','After','Middle'],
myButtons={'_ZZ':['http://upload.wikimedia.org/wikipedia/commons/e/e9/Button_headline2.png',
'_ZA':'http://upload.wikimedia.org/wikipedia/commons/1/13/Button_enter.png','Mark2 Test','111','333','222']};
'Mark Test','Before','After','Middle'],'_ZA':'http://upload.wikimedia.org/wikipedia/commons/1/13/
</code>
Button_enter.png','Mark2 Test','111','333','222']};
</pre>


For more examples and usable buttons, see the [[wikipedia:User:Willscrlt/Voting buttons|!voting/discussion buttons]] made by [[wikipedia:User:Willscrlt|Willscrlt]] of Wikipedia.
For more examples and usable buttons, see the [[wikipedia:User:Willscrlt/Voting buttons|!voting/discussion buttons]] made by [[wikipedia:User:Willscrlt|Willscrlt]] of Wikipedia.