Utilizador:Luan/common.js

Origem: Wikcionário, o dicionário livre.
Nota: Após salvar, você terá de limpar a cache do seu navegador para ver as alterações:
  • Internet Explorer: Mantenha pressionada a tecla Ctrl e aperte F5; ou mantenha pressionada a tecla Ctrl e clique no botão "Recarregar" (Reload)
  • Firefox e SeaMonkey: Mantenha pressionada a tecla Shift ⇧ e clique no botão "Recarregar" (Reload ou Atualizar) ou mantenha pressionada a tecla Ctrl e aperte F5; ou mantenha pressionada as teclas Ctrl, Shift ⇧ e R (Command ⌘, Shift ⌥ e R em Macintosh)
  • Safari e Konqueror: Clique no botão "Recarregar" (Reload)
  • Opera: É necessário limpar manualmente a cache no menu "Ferramentas"→"Preferências"→"Avançadas"→"Histórico" e clicar no botão "Esvaziar Já"
  • Chrome: É necessário limpar manualmente a cache no botão "Ferramentas"→"Limpar dados de navegação", selecione "Esvaziar o cache" e clicar no botão "Limpar dados de navegação"
/**
 * 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>' } }
				},
				'language': {
					'label': 'Linguagem',
					'action': { 'type': 'encapsulate', 'options': { 'pre': '\{\{categoria\-tópico\|Linguagem\|', 'peri': 'text', 'post': '\}\}\n\n\[\[en\:Category\:\:Language\]\]' } }
				},
				'communication': {
					'label': 'Comunicação',
					'action': { 'type': 'encapsulate', 'options': { 'pre': '\{\{categoria\-tópico\|Comunicação\|', 'peri': 'text', 'post': '\}\}\n\n\[\[en\:Category\:\:Communication\]\]' } }
				},
				'psycol': {
					'label': 'Psicologia',
					'action': { 'type': 'encapsulate', 'options': { 'pre': '\{\{categoria\-tópico\|Psicologia\|', 'peri': 'text', 'post': '\}\}\n\n\[\[en\:Category\:\:Psychology\]\]' } }
				}
			}
		};
	$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': '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' ),
				$.ready
			).then( customizeToolbar );
		}
	} );
}

/**
 * Ferramenta de renomeação em massa (massmove)
 */
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );
mw.loader.load('//pt.wiktionary.org/w/index.php?title=User:Defender/massmove.js&action=raw&ctype=text/javascript');

/**
 * Ferramenta de categorização em massa (cat-a-lot)
 */
 /* User:קיפודנחש/cat-a-lot.js */
window.catALotPrefs = {editpages:  true};
mw.loader.using(['jquery.ui', 'mediawiki.util', 'jquery.mwExtension'], function(){
  mw.loader.load('//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-Cat-a-lot.js&action=raw&ctype=text/javascript');
  importStylesheetURI('//commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-Cat-a-lot.css&action=raw&ctype=text/css');
});
// Backlink: [[w:en:User:קיפודנחש/cat-a-lot.js]]