Користувач:Amire80/common.js: відмінності між версіями
Перейти до навігації
Перейти до пошуку
Вилучено вміст Додано вміст
Amire80 (обговорення | внесок) bla |
Amire80 (обговорення | внесок) bla |
||
Рядок 19: | Рядок 19: | ||
} ) |
} ) |
||
.done( function ( response ) { |
.done( function ( response ) { |
||
var i, $th, |
|||
debugger; |
|||
$ |
$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 ); |
|||
} ); |
} ); |
||
} ); |
} ); |
Поточна версія на 18:00, 11 травня 2016
$( 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 );
} );
} );