Nota: Depois de publicar, deve limpar o cachê do seu navegador para ver as alterações.
- Firefox e 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 e Edge: Pressione Ctrl enquanto clica Recarregar, ou pressione Ctrl-F5
- Opera: Pressione Ctrl-F5.
/* jshint laxbreak:true, expr:true, esversion: 6 */
/* global mediaWiki, jQuery */
( function( mw, $ ) {
'use strict';
// Automated welcome to open a nonexistent user talk page
function automated_welcome() {
var user = /:(.+)/.exec( mw.util.getParamValue( 'title' ) )[ 1 ],
template = '{{subst:bv' + ( ( mw.util.isIPv4Address( user ) || mw.util.isIPv6Address( user ) )
? '-ip'
: '' ) + '}} ~~' + '~~';
$( '#wpTextbox1' ).val( template );
$( '#wpWatchthis' ).attr( 'checked', false );
$( '#wpSummary' ).val( 'Dando mensagem de boas-vindas com um [[Utilizador:Juan90264/scripts.js|script]]' );
$( '#editform' ).submit();
}
if ( mw.config.get( 'wgNamespaceNumber' ) === 3
&& !!mw.util.getParamValue( 'redlink' )
&& mw.config.get( 'wgPageName' ).search( 'Usuário_Discussão:Juan90264' ) === -1
) {
$( automated_welcome );
}
// Adds links to view 1000, 2000, 3000, 4000 and 5000 results on lists
function add_more_numlink() {
var i,
$target = !!$( '.mw-numlink' ).eq( 4 )[ 0 ]
? $( '.mw-numlink' ).eq( 4 )
: $( '#mw-content-text' ).find( 'a' ).eq( $( '#mw-content-text' ).find( 'a' ).eq( 8 ).html() === '500' ? 8 : 9 );
for ( i = 5; i > 0; i-- ) {
$target.after(
' | ',
$target.clone()
.text( 1000 * i )
.attr( 'href', $target.attr( 'href' ).replace( /(limit=)\d+/, '$1' + ( 1000 * i ) ) )
);
}
}
if ( !!$( '.mw-numlink' ).length || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Whatlinkshere' )
add_more_numlink();
// Check all boxes in undelete page
function checkAll_restore() {
$( '.deleterevision-log-submit' ).after( ' <a id="check_all">Marcar tudo</a>' );
$( '#check_all' ).click( function() {
$( 'ul input[type="checkbox"]' ).each( function() {
$( this ).prop( 'checked', true );
} );
} );
}
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Undelete' )
$( checkAll_restore );
// Check all diff links automatically with &unhide=1
function unhide_bypass() {
if ( !!$( '.mw-changeslist-diff' ).length ) {
$( '.mw-changeslist-diff' ).each( function() {
$( this )[ 0 ].href += '&unhide=1';
} );
} else {
$( 'a' ).each( function() {
if ( $( this ).text().search( /\b(dif|ant|atu)\b/ ) !== -1 )
$( this )[ 0 ].href += '&unhide=1';
} );
}
}
if ( mw.config.get( 'wgNamespaceNumber') === -1 || mw.config.get( 'wgAction' ) !== 'view' )
$( unhide_bypass );
// Enforce the use of legacyeditor on abuse filters
function enforce_legacyeditor_abusefilter() {
$( '#wpAceFilterEditor' ).css( 'display', 'none' );
$( '#wpFilterRules' ).css( 'display', 'block' );
$( '#wpTestExpr' ).css( 'display', 'block' );
$( '#wpTestFilter' ).css( 'display', 'block' );
}
$( function() {
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'AbuseFilter' ) {
let ELEAF_interval = setInterval( function() {
if ( $( '#wpAceFilterEditor' ).css( 'display' ) === 'block' ) {
$( enforce_legacyeditor_abusefilter );
clearInterval( ELEAF_interval );
}
}, 1 );
}
} );
// Adds more buttons in Special:EditWatchlist
function moreButtons_editWatchlist() {
let autocheck = function( prop, value ) {
$( 'input[type="checkbox"]' ).each( function() {
try {
if ( $( this ).parent().parent().next().find( 'a' ).eq( 0 ).prop( prop ).indexOf( value ) !== -1 )
$( this ).prop( 'checked', true );
} catch ( e ) {}
} );
};
$( '.oo-ui-fieldLayout-field' ).eq( 0 ).after( '<br />Selecionar: <a id="checkDeletedPages">páginas inexistentes</a> — <a id="checkRedirects">redirecionamento</a>' );
$( '#checkDeletedPages' ).click( function() { autocheck( 'href', 'redlink=1' ); } );
$( '#checkRedirects' ).click( function() { autocheck( 'class', 'mw-redirect' ); } );
}
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'EditWatchlist' )
$( moreButtons_editWatchlist );
}( mediaWiki, jQuery ) );