Usuário(a) Discussão:Emílio G. B. Másera
Adicionar tópico...
var button = {
imageFile: '//upload.wikimedia.org/wikipedia/commons/1/11/Button_ER.png',
speedTip: 'Inserir {' + '{ER||2=~~' + '~~}}',
tagOpen: '{' + '{ER|',
sampleText: '<número da regra>',
tagClose: '|2=~~' + '~~}}'
},
customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'insert',
'tools': {
'ER': {
label: button.speedTip,
type: 'button',
//
icon: button.imageFile,
action: {
type: 'encapsulate',
options: {
pre: button.tagOpen,
peri: button.sampleText,
post: button.tagClose
}
}
}
}
} );
},
customizeOldToolbar = function (){
mw.toolbar.addButton( button );
};
/* 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', function () { if ( mw.user.options.get('usebetatoolbar') && mw.user.options.get( 'showtoolbar' ) ) { mw.loader.using( 'ext.wikiEditor.toolbar', function () { $( customizeToolbar ); } ); } else { $( customizeOldToolbar ); } } ); }