Index: trunk/extensions/Translate/resources/ext.translate.messagetable.js |
— | — | @@ -0,0 +1,28 @@ |
| 2 | +jQuery( document ).ready( function( $ ) { |
| 3 | + var $buttons = $( ".mw-translate-messagereviewbutton" ); |
| 4 | + $buttons.each( function() { |
| 5 | + var $b = $(this); |
| 6 | + $b.click( function() { |
| 7 | + var successFunction = function( data, textStatus ) { |
| 8 | + console.log( data, textStatus ); |
| 9 | + if ( data.error ) { |
| 10 | + var reason = mw.msg( "translate-messagereview-apierror-" + data.error.code ); |
| 11 | + $b.val( mw.msg( "translate-messagereview-failure", reason ) ); |
| 12 | + } else { |
| 13 | + $b.val( mw.msg( "translate-messagereview-done" ) ); |
| 14 | + } |
| 15 | + }; |
| 16 | + |
| 17 | + var params = { |
| 18 | + action: "translationreview", |
| 19 | + token: $b.data( "token" ), |
| 20 | + revision: $b.data( "revision" ), |
| 21 | + format: "json" |
| 22 | + }; |
| 23 | + $b.val( mw.msg( "translate-messagereview-progress" ) ); |
| 24 | + $b.prop( "disabled", true ); |
| 25 | + $.post( mw.util.wikiScript( "api" ), params, successFunction ); |
| 26 | + |
| 27 | + } ); |
| 28 | + } ); |
| 29 | +} ); |
Property changes on: trunk/extensions/Translate/resources/ext.translate.messagetable.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 30 | + native |