summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/resources/js/ext.translate.special.pagetranslation.js
blob: 67610f5207e9e70cc70e4728211b04c560cd3c53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*!
 * @author Santhosh Thottingal
 * @author Niklas Laxström
 * @license GPL-2.0-or-later
 */

( function () {
	'use strict';

	$( 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();
		} );
	} );
}() );