diff options
Diffstat (limited to 'MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js')
-rw-r--r-- | MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js b/MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js index f47de956..4897189f 100644 --- a/MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js +++ b/MLEB/Translate/resources/js/ext.translate.special.pagetranslation.js @@ -1,8 +1,26 @@ -/* +/*! * @author Santhosh Thottingal + * @author Niklas Laxström + * @license GPL-2.0-or-later */ -jQuery( function ( $ ) { + +( function ( $, mw ) { 'use strict'; - $( '#wpUserLanguage' ).multiselectautocomplete( { inputbox: '#tpt-prioritylangs' } ); -} ); + $( function () { + $( '#wpUserLanguage' ).multiselectautocomplete( { inputbox: '#tpt-prioritylangs' } ); + + $( '#mw-content-text' ).on( 'click', '.mw-translate-jspost', function ( e ) { + var params, + uri = new mw.Uri( e.target.href ); + + params = uri.query; + params.token = mw.user.tokens.get( 'csrfToken' ); + $.post( uri.path, params ).done( function () { + location.reload(); + } ); + + e.preventDefault(); + } ); + } ); +}( jQuery, mediaWiki ) ); |