MediaWiki:Common.js: mudanças entre as edições

Sem resumo de edição
Sem resumo de edição
 
(2 revisões intermediárias pela mesma usuária não estão sendo mostradas)
Linha 1: Linha 1:
/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki
/* Códigos JavaScript aqui colocados serão carregados por todos aqueles que acessarem alguma página deste wiki


function checkform() { re = /^\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{2,3})+$/; if (!(re.test(jQuery("#email").val()))) { jQuery("#result").empty().append("Please enter a valid email address"); jQuery("#email").focus(); return false; } return true; } function submitForm() { successMessage = 'Thank you for your registration. Please check your email to confirm.'; data = jQuery('#subscribeform').serialize(); jQuery.ajax( { type: 'POST', data: data, url: 'https://www.boletimdigital.icict.fiocruz.br/lists/?p=subscribe&id=150', dataType: 'html', success: function (data, status, request) { jQuery("#result").empty().append(data != '' ? data : successMessage); jQuery('#email').val(''); }, error: function (request, status, error) { alert('Sorry, we were unable to process your subscription.'); } }); }




Linha 30: Linha 31:


/**
/**
  * Hide prefix in [[Special:PrefixIndex]]
  * Hide prefix in category
  *
  *
* Adds a checkbox to the form on [[Special:PrefixIndex]].
  * @source https://www.mediawiki.org/wiki/Snippets/Hide_prefix_in_category
* When the form is submitted with this checkbox ticked,
  * @rev 2020-04-28
* the prefix value will be hidden in the output (see also Wikimedia's [[phab:T29131]]).
*
  * @source: https://www.mediawiki.org/wiki/Snippets/Hide_prefix_in_SpecialPrefixIndex
  * @rev: 2
  */
  */
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Prefixindex' ) {
$( function () {
var prefix = $( '#nsfrom' ).val();
    var prefix = $( '#mw-cat-hideprefix' ).text().trim();
var hideprefixVal = mw.util.getParamValue( 'hideprefix' );
    if ( prefix ) {
// ^ Works only 1.17+
        $( '#mw-pages a' ).text( function ( i, val ) {
// Replace with a call to a similar function or create one if you're using 1.16 or lower
            return val.slice( 0, prefix.length ) === prefix ? val.slice( prefix.length ) : val;
var $hideprefixLabel = $( '<label/>', {
        } );
'for': 'hideprefix',
    }
'text': 'Hide prefix:'
} );
} );
var $hideprefixInput = $( '<input/>', {
'type': 'checkbox',
'name': 'hideprefix',
'id': 'hideprefix',
'value': '1'
} );
if ( hideprefixVal == '1' ) {
$hideprefixInput.attr( 'checked', 'checked' );
}
var $hideprefixRow = $( '<tr/>' )
.append( $( '<td/>', {
'class': 'mw-label',
'html': $hideprefixLabel
} ) )
.append( $( '<td/>', {
'class': 'mw-input',
'html': $hideprefixInput
} ) );
// Add checkbox
$( '#nsselect' ).find( ' > tbody:first' ).append( $hideprefixRow );
// Do it
if ( prefix && hideprefixVal == '1' ) {
$( '#mw-prefixindex-list-table td a' ).text( function( i, val ) {
return val.replace( prefix, '' );
                } );
}
}