Page MenuHomePhabricator
Paste P7434

(An Untitled Masterwork)
ActivePublic

Authored by matmarex on Aug 7 2018, 8:14 PM.
Tags
None
Referenced Files
F24652024:
Aug 7 2018, 8:14 PM
Subscribers
AffiliateLookupTextInputWidget.prototype.getLookupRequest = function () {
var value = this.getValue();
return this.getValidity().then( function () {
// Query the API to get the list of affiliates
return new mw.Api().get( queryAffiliatesPage() ).then( function ( data ) {
var affiliates, affiliatesContent;
affiliatesContent = getAffiliatesList( data.query.pages );
affiliates = affiliatesContent.split(',');
// Filter to only affiliates whose names contain the input (case-insensitive)
affiliates = affiliates.filter( function ( v ) {
return v.toLowerCase().indexOf( value.toLowerCase() ) !== -1;
} );
return affiliates;
} );
}, function () {
// No results when the input contains invalid content
return [];
} );
};