Utilizador:Luan/common.js: diferenças entre revisões
Conteúdo apagado Conteúdo adicionado
Tentando resolver o problema de "Páginas com erros no destaque de sintaxe" |
instalação de w:en:User:Plastikspork/massmove.js, ferramenta indicada por Defender |
||
Linha 84: | Linha 84: | ||
// Add the customizations to LiquidThreads' edit toolbar, if available |
// Add the customizations to LiquidThreads' edit toolbar, if available |
||
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); |
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar ); |
||
mw.loader.load('//en.wikipedia.org/wiki/User:Plastikspork/massmove.js&action=raw&ctype=text/javascript'); |
Revisão das 02h10min de 8 de abril de 2016
/**
* Altera a barra de ferramentas, incluindo novos botões para auxiliar a edição
* Reduzido de [[MediaWiki:Gadget-ImprovedEditToolbar.js]], que foi simplificado de [[en:MediaWiki:Common.js/Special characters.js]], que foi criado pelo [[:en:User:Darklama]]
*/
var customizeToolbar = function() {
var source,
$edit = $( '#wpTextbox1' ),
source_list = {
'label': 'Tipo de texto',
'type': 'select',
'list': {
'teletype': {
'label': 'Monoespaçado',
'action': { 'type': 'encapsulate', 'options': { 'pre': '<tt>', 'peri': 'text', 'post': '</tt>' } }
},
'code': {
'label': 'Código em linha',
'action': { 'type': 'encapsulate', 'options': { 'pre': '<code>', 'peri': 'text', 'post': '</code>' } }
}
}
};
$edit.wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'format',
'tools': {
'underline': {
label: 'Sublinhado',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/8b/Button_underline_he.png',
action: {
type: 'encapsulate',
options: { pre: "<u>", peri: "text", post: "</u>" }
}
},
'strikethrough': {
label: 'Riscado',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/6/6d/Vector_strikeout.png',
action: {
type: 'encapsulate',
options: { pre: "<s>", peri: "text", post: "</s>" }
}
}
}
});
$edit.wikiEditor( 'addToToolbar', {
'section': 'main',
'group': 'insert',
'tools': {
'math': {
label: 'Fórmula matemática',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/7/7d/Button_equation_he.png',
action: {
type: 'encapsulate',
options: {
pre: "<math>",
post: "</math>"
}
}
}
}
});
$edit.wikiEditor( 'addToToolbar', {
'section': 'advanced',
'group': 'heading',
'tools': {
'text-type': source_list
}
});
};
/* 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' ) ) {
$.when(
mw.loader.using( 'ext.wikiEditor.toolbar' ),
$.ready
).then( customizeToolbar );
}
} );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );
mw.loader.load('//en.wikipedia.org/wiki/User:Plastikspork/massmove.js&action=raw&ctype=text/javascript');