MediaWiki:Gadget-tradLink.js: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
l'encoding viene fatto da getJSON, comunque servirebbe rawurlencode, non html.escape
fix vari
Riga 1:
/**
* Considera il testo selezionato come il titolo di una voce straniera, e lo
*
*Considera il testo selezionato come il titolo di una voce straniera, e lo trasforma nel titolo dell'equivalente voce italiana
*
* Autore : [[:it:User:Jalo]]
Riga 10:
*/
 
/* global mediaWiki, jQuery, OO */
( function( mw, $ ) {
'use strict';
Riga 37:
$( '<legend>' ).text( "Elenco" ).appendTo( $fieldset );
var count = 1;
lingue.forEach( function( idval, valid ) {
$( '<label>' )
.attr( 'for', id )
.text( "Alt+" + count + ': ' )
.appendTo( $fieldset );
.append(var $input = $( '<input/>' )
$fieldset
.append( $( '<input/>' )
.attr( 'id', id )
.attr( 'type', 'text' )
.attr( 'size', 3 )
.attr( 'value', ( val || '' ) ) );
$fieldset
.append( $input )
.append( '<br/>' );
count++;
} );
// show the dialog
var Buttonsbuttons = {},
OKText = 'OK',
CancelTextcancelText = 'Cancel';
 
Buttonsbuttons[ OKText ] = function() {
var paramslingue = []'';
count = 0;
$dialog.find( 'input:text' ).each( function() {
params[lingue count++ ] = $( this ).val().trim();
} );
lingue = params.join();
var d = new Date();
d.setTime( d.getTime() + ( 20 * 365 * 24 * 60 * 60 * 1000 ) ); // 20 years
Riga 69 ⟶ 68:
$( this ).dialog( 'close' );
};
Buttonsbuttons[ CancelTextcancelText ] = function() {
$( this ).dialog( 'close' );
};
Riga 78 ⟶ 77:
modal: true,
zIndex: 10000,
buttons: Buttonsbuttons
} );
}
Riga 95 ⟶ 94:
 
return value !== ""
// XXX Perché limita a 9 elementi?
? value.split( ',' ).slice( 0, 9 )
: [ 'en', 'nl', 'de', 'sv', 'fr', 'ru', 'es', 'war', 'vi' ];
Riga 136 ⟶ 134:
}
}
var noLinkLabel = "[NO LINK]";
$( '#wpTextbox1' ).textSelection( 'encapsulateSelection', {
pre: "",
post: "[NO LINK]"noLinkLabel
} );
document.getElementById( 'wpTextbox1' ).selectionStart = selEnd;
document.getElementById( 'wpTextbox1' ).selectionEnd = selEnd + 9noLinkLabel.length;
} );
}