Користувач:Amire80/common.js
Увага: Після публікування слід очистити кеш браузера, щоб побачити зміни.
- Firefox / Safari: тримайте Shift, коли натискаєте Оновити, або натисніть Ctrl-F5 чи Ctrl-Shift-R (⌘-R на Apple Mac)
- Google Chrome: натисніть Ctrl-Shift-R (⌘-Shift-R на Apple Mac)
- Internet Explorer / Edge: тримайте Ctrl, коли натискаєте Оновити, або натисніть Ctrl-F5
- Opera: натисніть Ctrl-F5
$( function () {
'use strict';
var api = new mw.Api(),
$cxmt = $( '#cxmt' );
if ( mw.config.get( 'wgTitle' ).match( /\/CX-MT$/ ) === null &&
$cxmt.length === 0
) {
return;
}
api.post( {
action: 'query',
format: 'json',
list: 'cxpublishedtranslations',
limit: 10,
to: 'uk'
} )
.done( function ( response ) {
var i, $th,
$table = $( '<table>' ),
translations = response.result.translations;
$( '<tr>' ).append(
$( '<th>' ).text( 'Source language' ),
$( '<th>' ).text( 'Source title' ),
$( '<th>' ).text( 'any' ),
$( '<th>' ).text( 'human' ),
$( '<th>' ).text( 'mt' ),
$( '<th>' ).text( 'MT sections' ),
$( '<th>' ).text( 'target title' )
).appendTo( $table );
for ( i = 0; i < translations.length; i++ ) {
$( '<tr>' ).append(
$( '<td>' ).text( translations[ i ].sourceLanguage ),
$( '<td>' ).text( translations[ i ].sourceTitle ),
$( '<td>' ).text( translations[ i ].stats.any ),
$( '<td>' ).text( translations[ i ].stats.human ),
$( '<td>' ).text( translations[ i ].stats.mt ),
$( '<td>' ).text( translations[ i ].stats.mtSectionCount ),
$( '<td>' ).text( translations[ i ].targetTitle )
).appendTo( $table );
}
$cxmt.append( $table );
} );
} );