MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus BS-Wiki: Wissen teilen
Dg (Diskussion | Beiträge) |
Dg (Diskussion | Beiträge) |
||
Zeile 2: | Zeile 2: | ||
var customizeToolbar = function() { | var customizeToolbar = function() { | ||
/* Your code goes here */ | /* 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: '//bits.wikimedia.org/skins-1.5/common/images/button_hr.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "----", | ||
+ | ownline: true | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
}; | }; | ||
Version vom 8. April 2012, 00:29 Uhr
/* Jedes JavaScript hier wird für alle Benutzer für jede Seite geladen. */
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: '//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 );
} );
}
} );
}