uselang: mw.config.get( 'wgUserLanguage' ),
title: mw.config.get( 'wgPageName' ),
text: $textbox.textSelection( 'getContents' ),
- summary: $summary.textSelection( 'getContents' )
+ summary: $summary.textSelection( 'getContents' ),
+ sectionpreview: section !== ''
};
- if ( section !== '' ) {
- postData.sectionpreview = '';
- if ( section === 'new' ) {
- postData.section = section;
- postData.sectiontitle = postData.summary;
- }
+ if ( section === 'new' ) {
+ postData.section = 'new';
+ postData.sectiontitle = postData.summary;
}
if ( isDiff ) {
$wikiPreview.hide();
// First PST the input, then diff it
- postData.onlypst = '';
+ postData.onlypst = true;
request = api.post( postData );
request.done( function ( response ) {
- var postData;
- postData = {
+ return api.post( {
action: 'query',
- indexpageids: '',
+ indexpageids: true,
prop: 'revisions',
titles: mw.config.get( 'wgPageName' ),
rvdifftotext: response.parse.text[ '*' ],
- rvprop: ''
- };
- if ( section !== '' ) {
- postData.rvsection = section;
- }
- return api.post( postData ).done( function ( result2 ) {
+ rvprop: [],
+ rvsection: section === '' ? undefined : section
+ } ).done( function ( response ) {
try {
- var diffHtml = result2.query.pages[ result2.query.pageids[ 0 ] ]
+ var diffHtml = response.query.pages[ response.query.pageids[ 0 ] ]
.revisions[ 0 ].diff[ '*' ];
$wikiDiff.find( 'table.diff tbody' ).html( diffHtml );
} catch ( e ) {
} else {
$wikiDiff.hide();
$.extend( postData, {
- pst: '',
- preview: '',
+ pst: true,
+ preview: true,
prop: 'text|displaytitle|modules|jsconfigvars|categorieshtml|templates|langlinks|limitreporthtml',
disableeditsection: true
} );
titles: ( new mw.Title( this.nameToCheck, mw.config.get( 'wgNamespaceIds' ).file ) ).getPrefixedText(),
prop: 'imageinfo',
iiprop: 'uploadwarning',
- indexpageids: ''
+ indexpageids: true
} ).done( function ( result ) {
var resultOut = '';
if ( result.query ) {
text: '{{' + license + '}}',
title: $( '#wpDestFile' ).val() || 'File:Sample.jpg',
prop: 'text',
- pst: ''
+ pst: true
} ).done( function ( result ) {
$spinnerLicense.remove();
uploadLicense.processResult( result, license );
if ( mw.Title.newFromText( query ) ) {
return this.interwikiPrefixesPromise.then( function () {
- var params, props,
+ var params,
interwiki = query.substring( 0, query.indexOf( ':' ) );
if (
interwiki && interwiki !== '' &&
} else {
params = {
action: 'query',
+ prop: [ 'info', 'pageprops' ],
generator: 'prefixsearch',
gpssearch: query,
gpsnamespace: widget.namespace !== null ? widget.namespace : undefined,
gpslimit: widget.limit,
ppprop: 'disambiguation'
};
- props = [ 'info', 'pageprops' ];
if ( widget.showRedirectTargets ) {
- params.redirects = '1';
+ params.redirects = true;
}
if ( widget.showImages ) {
- props.push( 'pageimages' );
+ params.prop.push( 'pageimages' );
params.pithumbsize = 80;
params.pilimit = widget.limit;
}
if ( widget.showDescriptions ) {
- props.push( 'pageterms' );
+ params.prop.push( 'pageterms' );
params.wbptterms = 'description';
}
- params.prop = props.join( '|' );
req = new mw.Api().get( params );
promiseAbortObject.abort = req.abort.bind( req ); // todo: ew
return req;