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

Contenuto cancellato Contenuto aggiunto
m -prefissi
Semplificazioni varie
Riga 37:
$( '<legend>' ).text( "Elenco" ).appendTo( $fieldset );
var count = 1;
$lingue.eachforEach( lingue, function( id, val ) {
$( '<label>' )
.attr( 'for', id )
Riga 86:
name = "tradLinkLangs=",
ca = document.cookie.split( ';' );
for ( var i = 0; i <in ca.length; i++ ) {
var c = trimStringStart( ca[ i ] );
if ( c.indexOf( name ) === 0 ) {
value = c.substring( name.length, c.length );
break;
}
Riga 95:
 
return value !== ""
// XXX Perché limita a 9 elementi?
? value.split( ',' ).slice( 0, 9 )
: [ 'en', 'nl', 'de', 'sv', 'fr', 'ru', 'es', 'war', 'vi' ];
Riga 103 ⟶ 104:
 
var toTrad = mw.html.escape( $( '#wpTextbox1' ).textSelection( 'getSelection' ) );
var trad = "";
$.getJSON( "https://" + lingue[ cod ] + ".wikipedia.org/w/api.php?callback=?", {
action: "query",
Riga 113:
},
function( data ) {
var selStart = document.getElementById( 'wpTextbox1' ).selectionStart,
selEnd = document.getElementById( 'wpTextbox1' ).selectionEnd;
if ( typeof( data ) != "undefined" &&
typeof( data.query ) != "undefined" &&
Riga 125 ⟶ 123:
typeof( data.query.pages[ key ].langlinks[ 0 ][ "*" ] ) != "undefined"
) {
var trad = data.query.pages[ key ].langlinks[ 0 ][ "*" ];,
var selStart = document.getElementById( 'wpTextbox1' ).selectionStart,
selEnd = document.getElementById( 'wpTextbox1' ).selectionEnd;
try {
mw.html.escape( $( '#wpTextbox1' ).textSelection( 'encapsulateSelection', {