MediaWiki:Common.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m ritorno a Speciale:PermaLink/92937789 per investigare sul bug nel parsing JS
refactoring WP:Live mirror (document.___location deprecato); ripristino refactoring mw-collapsible (stavolta strict ES5); +importScript ove possibile; dichiarazioni "var" spezzate nei loro blocchi
Riga 15:
*/
( function () {
var i,badMirrors isBad,= [
badMirrors = [
'wikipedia.sapere.alice.it',
'212.48.3.33',
Riga 22 ⟶ 21:
'213.92.16.218',
'it.wikipedia.net.ru'
];
if( badMirrors.indexOf( window.___location.host ) !== - 1 ) {
for ( i = 0; i < badMirrors.length; i++ ) {
// redirect users to the same page on itwiki
if ( document.___location.href.indexOf( badMirrors[ i ] ) !== -1 ) {
//document window.___location.href = '//it.wikipedia.org/wiki/' + mw.config.get( 'wgPageName' );
isBad = true;
break;
}
}
if ( isBad ) {
// redirect users to the same page on itwiki
//document.___location.href = '//it.wikipedia.org/wiki/' + mw.config.get( 'wgPageName' );
// redirect users to a landing page
documentwindow.___location.href = '//it.wikipedia.org/wiki/Wikipedia:Live_mirror';
}
} )();
Riga 52 ⟶ 45:
* Menu interprogetto nella sidebar, vedi anche [[Modulo:Interprogetto]]
*/
mw.loader.load importScript( 'https://it.wikipedia.org/w/index.php?title=MediaWiki:InterProject.js&action=raw&ctype=text/javascript' );
 
/**
Riga 87 ⟶ 80:
*/
function comboboxEdittools() {
var $specialChars = $( '#specialchars' ), $select;
if ( $specialChars.length ) {
var $select = $( '<select>' ).change( function () {
$specialChars.find( 'p' ).hide();
$specialChars.find( 'option:selected' ).data().show();
Riga 137 ⟶ 130:
}
 
var $realTitleBanner = $( '#RealTitleBanner' ), $realTitle, $firstH1;
if ( $realTitleBanner.length && !$( '#DisableRealTitle' ).length ) {
var $realTitle = $realTitleBanner.find( '#RealTitle' );
var $firstH1 = $( 'h1:first' );
if ( $realTitle.length && $firstH1.length ) {
$realTitleBanner.hide();
Riga 167 ⟶ 160:
function initImageGroup() {
$( 'div.ImageGroup > div.ImageGroupUnits' ).each( function ( i, imageGroupUnits ) {
var $images, $prevLink, $nextLink, $countInfo, currImg = 0;
var $images = $( imageGroupUnits ).children( '.center' );
var $countInfo = $( '<kbd>' ).css( 'font-size', '110%' );
var $prevLink = $( '<a>' )
.attr( 'href', '#' ).attr( 'title', 'Immagine precedente' )
.text( '◀' ).css( 'text-decoration', 'none' )
Riga 177 ⟶ 170:
updateImageGroup( currImg -= 1, $images, $countInfo, $prevLink, $nextLink );
} );
var $nextLink = $( '<a>' )
.attr( 'href', '#' ).attr( 'title', 'Immagine successiva' )
.text( '▶' ).css( 'text-decoration', 'none' )
Riga 193 ⟶ 186:
/**
* Utilizzata con [[Template:Navbox]]: se presente più di una table
* con classi navbox e mw-collapsible, quelle con autocollapse si chiudono subito da sole.
* @author [[it:User:Rotpunkt]]
*/
function checkAutocollapse() {
if ( $( 'table.navbox.mw-collapsible' ).length > 1 ) {
$( 'table.navbox.mw-collapsible.autocollapse:not(.mw-collapsed)' ).each( function ( i, el ) {
// makeCollapsible a volte è eseguita prima, a volte successivamente al Common.js,
if ( !$( el ).hasClass( 'mw-collapsed' ) ) {
ifvar (collapsible = $( el this).data( 'mw-made-collapsible' ) ) {;
// makeCollapsible a volte è eseguita prima, a volte successivamente al Common.js,
if ( isBadcollapsible ) {
// se è già stata eseguita, non resta che simulare un click.
collapsible.collapse();
if ( $( el ).data( 'mw-made-collapsible' ) ) {
} else {
// hide() chiude la tabella più velocemente di fadeOut
$( el this).findaddclass( 'tr:not(:first)mw-collapsed' ).hide();
$( el ).find( '.mw-collapsible-toggle' ).click();
} else {
$( el ).addClass( 'mw-collapsed' );
}
}
} );
Riga 218 ⟶ 207:
 
/* Normalizzazione dei caratteri particolari per l'ordinamento alfabetico nelle tabelle sortable.
In futuro potrebbe diventare default e non più necessario, vedi [[phab:T72157]] */
 
mw.config.set( 'tableSorterCollation', {'á':'a','à':'a','ă':'a','â':'a','ǎ':'a','å':'a','ä':'a','ã':'a','ā':'a','ȁ':'a',