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)
  • Internet Explorer / Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
  • Opera: Pressione Ctrl-F5.
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',
                                        // [[Imagem:Button ER.png]]
                                        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.loader.using( 'ext.wikiEditor', function () {
                                $( customizeToolbar );
                        } );
                } else {
                        $( customizeOldToolbar );
                }
        } );
}

importScript('MediaWiki:Gadget-desambiguacoes.js');