Usuário:VítoR Valente/vector.js

Origem: Wikipédia, a enciclopédia livre.

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.
/** Páginas novas direto *************************************************************
  * Descrição: Retorna diretamente a 'Especial:Páginas novas' ao marcar uma página
  *            como patrulhada.
  *********************************************************************************/
$( function() {
 var returnto = document.getElementById( 'mw-returnto' );
 if (returnto) { var ahref = returnto.childNodes[1].href;
 if (ahref == 'https://pt.wikipedia.org/wiki/Especial:P%C3%A1ginas_novas') window.location = ahref;}});

// [[d:User:Yair rand/WikidataInfo.js]]
mw.loader.load( '//www.wikidata.org/w/index.php?title=User:Yair rand/WikidataInfo.js&action=raw&ctype=text/javascript' );

// [[File:User:He7d3r/Tools/AjaxRollbackLinks.js]] (workaround for [[phab:T35355]])
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:He7d3r/Tools/AjaxRollbackLinks.js&action=raw&ctype=text/javascript' );

// [[File:User:He7d3r/Tools/ExtraEditButtons.js]] (workaround for [[phab:T35355]])
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:He7d3r/Tools/ExtraEditButtons.js&action=raw&ctype=text/javascript' );

// [[File:User:He7d3r/Tools/TemplateScript.js]] (workaround for [[phab:T35355]])
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:He7d3r/Tools/TemplateScript.js&action=raw&ctype=text/javascript' );

// [[File:User:He7d3r/Tools/AddLinksToValidationTools.js]] (workaround for [[phab:T35355]])
mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:He7d3r/Tools/AddLinksToValidationTools.js&action=raw&ctype=text/javascript' );

mw.loader.load("//de.wikipedia.org/w/index.php?title=Benutzer:TMg/autoFormatter.js&action=raw&ctype=text/javascript");

mw.loader.using( [ 'mediawiki.cookie' ] ).done( function () {
	mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-CollapsibleNav.css&action=raw&ctype=text/css', 'text/css' );
	mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-CollapsibleNav.js&action=raw&ctype=text/javascript' );
} );

/*  _____________________________________________________________________________
 * |                                                                             |
 * |                    === WARNING: GLOBAL GADGET FILE ===                      |
 * |                  Changes to this page affect many users.                    |
 * | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |
 * |_____________________________________________________________________________|
 *
 * Imported as of 09/06/2011 from [[User:ErrantX/defaultsummaries.js]]
 * Edited version from [[User:MC10/defaultsummaries.js]]
 * Implements default edit summary dropdown boxes
 */

/* global mediaWiki, ve */

( function ( $, mw ) { // Wrap with anonymous function
	var $summaryBox = $( '#wpSummary' ),
		minorSummaries = [
			'+ correção.',
			'+ atualização.',
			'+ melhoria.',
			'+ marcação.',
			'+ desambiguação.',
			'- desambiguação.',
			'rev ([[WP:VAN|vandalismo]]).',
			'rev ([[WP:V|sem fontes]]).',
			'rev (sem justificação).',
			'rev (parcialmente)',
			'+ redirecionamento ([[WP:ÁLBUM]]).',
			'+ redirecionamento ([[WP:CANÇÃO]]).',
			'+ redirecionamento ([[WP:DIGRESSÃO]]).',
			'+ redirecionamento.',
			'+ nova categoria.',
			'+ padronização.'
		],
		articleSummaries = [
			'+ expansão.',
		    '+ correções.',
			'+ atualizações.',
			'+ melhorias.',
			'+ ajustes.',
			'+ referências.',
			'+ novo artigo.',
			'+ conteúdo.',
			'+ predefinição.',
			'+ categoria.',
			'+ categorias.',
			'- categoria.',
			'+ imagem.',
			'- imagem.',
			'+ manutenção.',
			'+ ligação externa.',
			'- ligação externa.',
			'+ ligação interna.',
			'- ligação interna.',
			'- conteúdo sem [[WP:FC|fontes]].',
			'- abuso de [[WP:URC|uso de conteúdo restrito]].',
			'+ portal.',
			'+ portais.'
		],
		nonArticleSummaries = [
			'+ resposta.',
			'+ comentário.',
			'+ opinião.',
			'+ voto.',
			'+ pedido.',
			'+ aviso.'
		],
		templateSummaries = [
		    '+ correções.',
			'+ atualizações.',
			'+ conteúdo.',
			'+ melhorias.',
			'+ nova predefinição.'
		],
		projectSummaries = [
			'+ processo encerrado.',
			'- processo concluído.',
			'+ nova candidatura.',
			'+ novo processo.',
			'+ consenso obtido.'
		],
		portalSummaries = [
			'+ novo portal.',
			'+ organização.'
		],
		talkPageSummaries = [
			'+ novo tópico.',
			'+ nova discussão.',
			'+ sugestão.'
		];

	function addOptionsToDropdown( dropdown, optionTexts ) {
		dropdown.menu.addItems( optionTexts.map( function ( optionText ) {
			return new OO.ui.MenuOptionWidget( { label: optionText } );
		} ) );
	}

	function onSummarySelect( option ) {
		// Save the original value of the edit summary field
		var editsummOriginalSummary = $summaryBox.val(),
			canned = option.getLabel(),
			newSummary = editsummOriginalSummary;

		// Append old edit summary with space, if exists,
		// and last character != space
		if ( newSummary.length !== 0 && newSummary.charAt( newSummary.length - 1 ) !== ' ' ) {
			newSummary += ' ';
		}
		newSummary += canned;
		$summaryBox.val( newSummary ).trigger( 'change' );
	}

	function insertSummaryOptions( $insertBeforeThis, dropdownWidth ) {
		// For convenience, add a dropdown box with some canned edit
		// summaries to the form.
		var namespace = mw.config.get( 'wgNamespaceNumber' ),
			dropdown = new OO.ui.DropdownWidget( {
				label: 'Resumos de edição comuns'
			} ),
			minorDropdown = new OO.ui.DropdownWidget( {
				label: 'Resumos de edição menor e personalizados'
			} );

		dropdown.$element.css( 'width', dropdownWidth );
		dropdown.menu.on( 'select', onSummarySelect );

		minorDropdown.$element.css( 'width', dropdownWidth );
		minorDropdown.menu.on( 'select', onSummarySelect );

		addOptionsToDropdown( minorDropdown, minorSummaries );
        
        if ( namespace === 10 ) {
			addOptionsToDropdown( dropdown, templateSummaries );
		}
		if ( namespace === 4 ) {
			addOptionsToDropdown( dropdown, projectSummaries );
		}
		if ( namespace === 100 ) {
			addOptionsToDropdown( dropdown, portalSummaries );
		} 
		if ( namespace === 0 ) {
			addOptionsToDropdown( dropdown, articleSummaries );
		} else {
			addOptionsToDropdown( dropdown, nonArticleSummaries );
			if ( namespace % 2 !== 0 && namespace !== 3 ) {
				addOptionsToDropdown( dropdown, talkPageSummaries );
			}
		}
	    
		$insertBeforeThis.before( dropdown.$element );
		$insertBeforeThis.before( minorDropdown.$element );
	}
	// VisualEditor
	mw.hook( 've.saveDialog.stateChanged' ).add( function () {
		var target, $saveOptions;
		// .ve-init-mw-viewPageTarget-saveDialog-checkboxes
		if ( $( 'body' ).data( 'wppresent' ) ) { return; }
		$( 'body' ).data( 'wppresent', 'true' );

		target = ve.init.target;
		$saveOptions = target.saveDialog.$saveOptions;
		$summaryBox = target.saveDialog.editSummaryInput.$input;
		if ( !$saveOptions.length ) {
			return;
		}
		insertSummaryOptions( $saveOptions );
	} );
	// WikiEditor
	$.when( mw.loader.using( 'oojs-ui-core' ), $.ready ).then( function () {
		var $editCheckboxes = $( '.editCheckboxes' );

		// If we failed to find the editCheckboxes class
		if ( !$editCheckboxes.length ) {
			return;
		}
		insertSummaryOptions( $editCheckboxes, '48%' );
	} );
}( jQuery, mediaWiki ) ); // End wrap with anonymous function

/* * CustomSummaryPresets.js
 *
 * Displays a highly configurable menu of custom edit summaries.
 * See documentation at [[User:Enterprisey/CustomSummaryPresets]].
 *
 * Mostly copied on 2018-07-24 from https://en.wikipedia.org/w/index.php?title=&oldid=807346245,
 * some code also taken from https://en.wikipedia.org/w/index.php?title=&oldid=498931785
 *
 * Older history:
 * Imported as of 09/06/2011 from [[User:ErrantX/defaultsummaries.js]]
 * Edited version from [[User:MC10/defaultsummaries.js]]
 * Implements default edit summary dropdown boxes
 */

var $summaryBox = $( '#wpSummary' );
if( typeof customGeneralSummaries === "undefined" ) {
        customGeneralSummaries = [];
        if (typeof customsum1 != "undefined") customGeneralSummaries.push( customsum1);
        if (typeof customsum2 != "undefined") customGeneralSummaries.push( customsum2);
        if (typeof customsum3 != "undefined") customGeneralSummaries.push( customsum3);
        if (typeof customsum4 != "undefined") customGeneralSummaries.push( customsum4);
        if (typeof customsum5 != "undefined") customGeneralSummaries.push( customsum5);
        if (typeof customsum6 != "undefined") customGeneralSummaries.push( customsum6);
        if (typeof customsum7 != "undefined") customGeneralSummaries.push( customsum7);
        if (typeof customsum8 != "undefined") customGeneralSummaries.push( customsum8);
        if (typeof customsum9 != "undefined") customGeneralSummaries.push( customsum9);
        if (typeof customsum10 != "undefined") customGeneralSummaries.push( customsum10);
        if (typeof customsum11 != "undefined") customGeneralSummaries.push( customsum11);
        if (typeof customsum12 != "undefined") customGeneralSummaries.push( customsum12);
        if (typeof customsum13 != "undefined") customGeneralSummaries.push( customsum13);
        if (typeof customsum14 != "undefined") customGeneralSummaries.push( customsum14);
        if (typeof customsum15 != "undefined") customGeneralSummaries.push( customsum15);
        if (typeof customsum16 != "undefined") customGeneralSummaries.push( customsum16);
        if (typeof customsum17 != "undefined") customGeneralSummaries.push( customsum17);
        if (typeof customsum18 != "undefined") customGeneralSummaries.push( customsum18);
        if (typeof customsum19 != "undefined") customGeneralSummaries.push( customsum19);
        if (typeof customsum20 != "undefined") customGeneralSummaries.push( customsum20);
}

function addOptionsToDropdown( dropdown, optionTexts ) {
	dropdown.menu.addItems( optionTexts.map( function ( optionText ) {
		return new OO.ui.MenuOptionWidget( { label: optionText } );
	} ) );
}

function onSummarySelect( option ) {
	// Save the original value of the edit summary field
	var editsummOriginalSummary = $summaryBox.val(),
		canned = option.getLabel(),
		newSummary = editsummOriginalSummary;

	// Append old edit summary with space, if exists,
	// and last character != space
	if ( newSummary.length !== 0 && newSummary.charAt( newSummary.length - 1 ) !== ' ' ) {
		newSummary += ' ';
	}
	newSummary += canned;
	$summaryBox.val( newSummary ).trigger( 'change' );
}

function insertSummaryOptions( $insertBeforeThis, dropdownWidth ) {
	// For convenience, add a dropdown box with some canned edit
	// summaries to the form.
	var namespace = mw.config.get( 'wgNamespaceNumber' ),
		dropdown = new OO.ui.DropdownWidget( {
			label: 'Resumos personalizados de edição – clique para usar'
		} );

	dropdown.$element.css( 'width', dropdownWidth );
	dropdown.menu.on( 'select', onSummarySelect );

	addOptionsToDropdown( dropdown, customGeneralSummaries );
	if( typeof customNamespaceSummaries != "undefined" && customNamespaceSummaries[namespace + ''] ) {
		addOptionsToDropdown( dropdown, customNamespaceSummaries[namespace + ''] );
	}

	$insertBeforeThis.before( dropdown.$element );
}
// VisualEditor
mw.hook( 've.saveDialog.stateChanged' ).add( function () {
	var target, $saveOptions;
	// .ve-init-mw-viewPageTarget-saveDialog-checkboxes
	if ( $( 'body' ).data( 'wppresent' ) ) { return; }
	$( 'body' ).data( 'wppresent', 'true' );

	target = ve.init.target;
	$saveOptions = target.saveDialog.$saveOptions;
	$summaryBox = target.saveDialog.editSummaryInput.$input;
	if ( !$saveOptions.length ) {
		return;
	}
	insertSummaryOptions( $saveOptions );
} );
// WikiEditor (i.e. the normal wikicode editor)
$.when( mw.loader.using( 'oojs-ui-core' ), $.ready ).then( function () {
	var $editCheckboxes = $( '.editCheckboxes' );

	// If we failed to find the editCheckboxes class
	if ( !$editCheckboxes.length ) {
		return;
	}
	insertSummaryOptions( $editCheckboxes, '38%' );
} );

// Resumos personalizados
var customNamespaceSummaries = {
'0': [
"1",
],
'2': [
"2",
],
};

mw.loader.load('//pt.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=Usuário:Luizdl/Script_de_ajustes.js&action=raw&ctype=text/javascript', 'text/javascript');

/*
This script was created by Majr of the Minecraft Wiki.
The original script is available here:
http://minecraftwiki.net/wiki/User:Majr/goToTop.js/ */
$(function(){
'use strict';

$('body').append('<span id="to-top">▲ Ir para o topo</span>');
var $topButton = $('#to-top');

$topButton.css({
	'color': '#191970',
	'position': 'fixed',
	'bottom': '-30px',
	'border': '3px solid dodgerblue',
	'border-left': '6px solid deepskyblue',
    'background-color': 'lightgrey',
	'right': '4px',
	'cursor': 'pointer',
	'transition': 'bottom 0.5s',
	'-webkit-transition': 'bottom 0.5s',
	'user-select': 'none',
	'-webkit-user-select': 'none',
	'-moz-user-select': 'none',
	'-ms-user-select': 'none'
}).click(function(){
	$('html, body').animate({scrollTop: 0},'slow');
});

$(window).scroll(function(){
	if ($(window).scrollTop() > 100 ) {
		$topButton.css('bottom', '4px');
	}else{
		$topButton.css('bottom', '-30px');
	}
});
});

/* This script adds a link saying "Subpages" to subpages of your user page.
   To use the script, add the following line to Special:MyPage/common.js:
 
importScript('User:PrimeHunter/My_subpages.js'); // Linkback: [[User:PrimeHunter/My subpages.js]]

*/

$.when( mw.loader.using( ['mediawiki.util'] ), $.ready ).done( function() {
  mw.util.addPortletLink(
    'p-personal',
    mw.util.getUrl( 'Special:PrefixIndex/User:' ) + mw.config.get( 'wgUserName' ) + '/',
    'Subpáginas',
    'pt-mysubpages',
    'Mostrar as minhas subpáginas',
    null,
    '#pt-preferences'
  );
});