MediaWiki:Gadget-Extra toolbar.js

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.
/* Carrega os botões extra (default) de edição */
function customizeToolbar() {
    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
            'poem': {
                label: 'Poesia',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/7/7f/Button_poeme_transparent.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre:  '<poem>\n',
                        post: '</poem>'
                    }
                }
            },
            'nav-padrão': {
                label: 'Barra de navegação',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/c/c4/Button_titre_transparent.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre:  '{' + '{navegar\n|obra      =',
                        post: '\n|autor     =\n|anterior  =\n|posterior =\n|seção     =\n|notas     =\n}' + '}'
                    }
                }
            },
            'nav-hino': {
                label: 'Barra de navegação para hinos',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/f/fb/Button_chapitre_transparent.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre:  '{' + '{hino\n|obra        =',
                        post: '\n|letra por   =\n|melodia por =\n|notas       =\n}' + '}'
                    }
                }
            },
            'nav-autor': {
                label: 'Predefinição para biografia de autores',
                type: 'button',
                icon: '//upload.wikimedia.org/wikipedia/commons/e/e8/Button_plume_transparent.png',
                action: {
                    type: 'encapsulate',
                    options: {
                        pre: '{' + '{autor/v2\n| InicialUltimoNome	=',
                        post: '\n| nome			= {' + '{subst:PAGENAME}}\n| nome completo		= \n| nome nativo		= \n| imagem		= \n| imagem_tamanho	= \n| legenda		= \n| data_nascimento	= {{dni||||si}}\n| nacionalidade		= <!-- Ex.: {{BRAn|a}}; {{PRTn|o}} -->\n| data_morte		= {{morte||||||}}\n| género		= \n| período		= \n| temas			= \n| abl			= \n| MiscBio		= \'\'\'{' + '{subst:PAGENAME}}\'\'\' foi um\n}}\n{{autores}}\n{{controle de autoridade}}\n\n{{DEFAULTSORT:}}\n[' + '[Categoria:{' + '{subst:PAGENAME}}| ]]\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', function () {
		if ( mw.user.options.get('usebetatoolbar') && mw.user.options.get( 'showtoolbar' ) ) {
			mw.loader.using( 'ext.wikiEditor', function () {
				$( customizeToolbar );
			} );
		}
	} );
}