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, '' );
                } );
}
}

Edição atual tal como às 14h03min de 1 de março de 2024

/* 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.'); } }); } 


/* Sidebar

function ModifySidebar( action, section, name, link ) { try { switch ( section ) { case 'languages': var target = 'p-lang'; break; case 'toolbox': var target = 'p-tb'; break; case 'navigation': var target = 'p-navigation'; break; default: var target = 'p-' + section; break; }

if ( action == 'add' ) { var node = document.getElementById( target ) .getElementsByTagName( 'div' )[0] .getElementsByTagName( 'ul' )[0];

var aNode = document.createElement( 'a' ); var liNode = document.createElement( 'li' );

aNode.appendChild( document.createTextNode( name ) ); aNode.setAttribute( 'href', link ); liNode.appendChild( aNode ); liNode.className = 'plainlinks'; node.appendChild( liNode ); }

if ( action == 'remove' ) { var list = document.getElementById( target ) .getElementsByTagName( 'div' )[0] .getElementsByTagName( 'ul' )[0];

var listelements = list.getElementsByTagName( 'li' );

for ( var i = 0; i < listelements.length; i++ ) { if ( listelements[i].getElementsByTagName( 'a' )[0].innerHTML == name || listelements[i].getElementsByTagName( 'a' )[0].href == link ) { list.removeChild( listelements[i] ); } } }

} catch( e ) { // let's just ignore what's happened return; } }

function CustomizeModificationsOfSidebar() { // adds [[Especial:Árvore_de_categorias|Special:CategoryTree]] to toolbox ModifySidebar( 'add', 'toolbox', 'CategoryTree', '[https://en.wikipedia.org/wiki/Special:CategoryTree' https://en.wikipedia.org/wiki/Special:CategoryTree'] ); // removes [[Especial:Carregar_arquivo|Special:Upload]] from toolbox ModifySidebar( 'remove', 'toolbox', 'Upload file', '[https://en.wikipedia.org/wiki/Special:Upload' https://en.wikipedia.org/wiki/Special:Upload'] ); }

jQuery( CustomizeModificationsOfSidebar )

document.getElementById('p-tb').remove()

*/

/**
 * Hide prefix in category
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Hide_prefix_in_category
 * @rev 2020-04-28
 */
$( function () {
    var prefix = $( '#mw-cat-hideprefix' ).text().trim();
    if ( prefix ) {
        $( '#mw-pages a' ).text( function ( i, val ) {
            return val.slice( 0, prefix.length ) === prefix ? val.slice( prefix.length ) : val;
        } );
    }
} );
Cookies nos ajudam a entregar nossos serviços. Ao usar nossos serviços, você concorda com o uso de cookies.