MediaWiki:Gadget-tradLink.js: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m uhm |
m fix |
||
| (7 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 20:
}
mw.util.addCSS(
'.tradlinks-buttons { width: 100%; text-align: center; margin-top: 10px }' '.tradlinks-error { color: red; font-size: 120%; font-weight: bold; text-align:center }'
function OptDialog( config ) {
OptDialog.parent.call( this, config );
Riga 37 ⟶ 40:
} );
this.addError = function ( error ) {
new OO.ui.HtmlSnippet( '<span
);
};
this.clearError = function () {
};
Riga 53 ⟶ 56:
maxLength: 3
} );
var field = new OO.ui.FieldLayout(
input,
Riga 60 ⟶ 64:
}
);
▲ field.on( 'change', this.clearError );
self.fields.push( field );
count++;
Riga 90 ⟶ 93:
};
optDialog = new OptDialog( {
size: '
} );
windowManager = new OO.ui.WindowManager();
Riga 169 ⟶ 172:
function tradLink( cod ) {
var lingue = getLingue();
▲ }
new mw.ForeignApi( '//' + lingue[cod] + '.wikipedia.org/w/api.php' ).get( {
Riga 197 ⟶ 195:
var trad = data.query.pages[ key ].langlinks[ 0 ][ "*" ];
$( '#wpTextbox1' ).textSelection( 'encapsulateSelection', {
pre: trad + "
} );
document.getElementById( 'wpTextbox1' ).selectionStart = selStart + trad.length + 1;
document.getElementById( 'wpTextbox1' ).selectionEnd = selEnd + trad.length +
return;
}
Riga 216 ⟶ 213:
}
$( function () {
if ( event.altKey && !event.shiftKey && !event.ctrlKey && !event.metaKey ) {
if ( event.which === 48 ) {
event.preventDefault();
mw.loader.using( [ 'oojs-ui-core', 'oojs-ui-widgets', 'oojs-ui-windows', 'mediawiki.widgets' ] )
.done( showDialog )
.fail( function() { console.error( 'Errore configurazione tradLink' ); } );
} else if ( event.which >= 49 && event.which < 57 ) {
event.preventDefault();
tradLink( event.which - 49 );
}
}
} );
} );
}( mediaWiki, jQuery ) );
| |||