MediaWiki:Common.js
Aus BS-Wiki: Wissen teilen
/* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */
/* geht hier noch nicht aber 1.19 in MW. */
var customizeToolbar = function() {
/* Your code goes here */
/* Horizontal line button */
/* This puts the button in the "Advanced" section of the toolbar. To put it in the top section of the toolbar instead, replace 'advanced' with 'main'. */
/* The button uses the old toolbar's horizontal line image; to change this, change the URL after icon: */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"hline": {
label: 'Horizontal line',
type: 'button',
icon: 'http://bits.wikimedia.org/skins-1.5/common/images/button_hr.png',
action: {
type: 'encapsulate',
options: {
pre: "----",
ownline: true
}
}
}
}
} );
};
/* Check if we are in edit mode and the required modules are available and then customize the toolbar */
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
mw.loader.using( 'user.options', function () {
if ( mw.user.options.get('usebetatoolbar') ) {
mw.loader.using( 'ext.wikiEditor.toolbar', function () {
$(document).ready( customizeToolbar );
} );
}
} );
}