Lankide:Zuiarra/customizeToolbar.js
Oharra: Gorde ondoren zure nabigatzailearen katxea ekidin beharko duzu aldaketak ikusteko. Mozilla / Firefox / Safari: Shift tekla sakatu birkargatzeko momentuan, edo Ctrl-Shift-R sakatu (Cmd-Shift-R Apple Mac baten); IE: Ctrl tekla sakatu birkargatzeko momentuan, edo Ctrl-F5 sakatu; Konqueror:: Birkargatzeko klik egin, edo F5 sakatu, besterik ez; Opera erabiltzaileek Tresnak-Hobespenak atalera jo eta katxea garbitzeko aukera hautatu.
/*
Tresna-barra pertsonalizatuei buruzko informazioa:
https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization#Configuration_structure
*/
var customizeToolbar = function () {
var izenburua = mw.config.get( 'wgTitle' );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'sections': {
'berriak': {
'type': 'toolbar', // Can also be 'booklet'
'label': 'Orrialde berriak'
// or 'labelMsg': 'section-emoticons-label' for a localized label
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'berriak',
'groups': {
'biografiak': {
'label': 'Biografiak' // or use labelMsg for a localized label, see above
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'berriak',
'group': 'biografiak',
'tools': {
'sortu': {
label: 'Sortu!', // or use labelMsg for a localized label, see above
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/0/0a/Gnome-stock_person.svg/22px-Gnome-stock_person.svg.png',
action: {
type: 'encapsulate',
options: {
pre: "{{biografia infotaula automatikoa}}\n", // text to be inserted
peri: "'''" + izenburua + "''' ([[]], [[]])\n\n",
post: "{{bizialdia|||}}\n"
}
}
}
}
} );
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
mw.loader.using( 'user.options' ).then( function () {
// This can be the string "0" if the user disabled the preference ([[phab:T54542#555387]])
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) {
$.when(
mw.loader.using( 'ext.wikiEditor' ), $.ready
).then( customizeToolbar );
}
} );
}