Usuário:Gaèlic/2/common.js
Aspeto
Nota: Depois de publicar, poderá ter de contornar a cache do seu navegador para ver as alterações.
- Firefox / Safari: Pressione Shift enquanto clica Recarregar, ou pressione Ctrl-F5 ou Ctrl-R (⌘-R no Mac)
- Google Chrome: Pressione Ctrl-Shift-R (⌘-Shift-R no Mac)
- Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5.
var button = {
imageFile: '//upload.wikimedia.org/wikipedia/commons/e/e3/Sight_picture_showing_correct_sight_alignment.jpg',
speedTip: 'Inserir <' + 'div style="text-align:center;"></div>',
tagOpen: '<' + 'div style="text-align:center;">',
sampleText: '',
tagClose: '</div>'
},
customizeToolbar = function() {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'insert',
'tools': {
'ER': {
label: button.speedTip,
type: 'button',
// [[File:Sight picture showing correct sight alignment.jpg]]
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', function () {
$( customizeToolbar );
} );
} else {
$( customizeOldToolbar );
}
} );
}