new mw.widgets.MediaUserUploadsProvider(apiurl, configopt)
#
MediaWiki media search provider.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiurl |
string | The API url |
|
config |
Object |
<optional> |
Configuration options |
Extends
Methods
fetchAPIresults(howMany) → {jQuery.Promise}
#
Call the API for search results.
Parameters:
Name | Type | Description |
---|---|---|
howMany |
number | The number of results to retrieve |
- Inherited From:
- Source:
Returns:
Promise that resolves with an array of objects that contain the fetched data.
- Type
- jQuery.Promise
getAPIurl() → {string}
#
Get API URL.
- Inherited From:
- Source:
Returns:
API URL
- Type
- string
getAjaxSettings() → {Object}
#
Get the default ajax settings.
- Inherited From:
- Source:
Returns:
Ajax settings
- Type
- Object
getContinueData(howMany) → {Object}
#
Get continuation API data.
Parameters:
Name | Type | Description |
---|---|---|
howMany |
number | The number of results to retrieve |
- Overrides:
- Source:
Returns:
API request data
- Type
- Object
getDefaultFetchLimit() → {number}
#
Get fetch limit or 'page' size. This is the number of results per request.
- Inherited From:
- Source:
Returns:
limit
- Type
- number
getFetchProp() → {string}
#
Get prop.
- Inherited From:
- Source:
Returns:
prop
- Type
- string
getImageSizes() → {Array.<number>}
#
getLang() → {string}
#
Get provider API language.
- Inherited From:
- Source:
Returns:
Provider API language
- Type
- string
getName() → {string}
#
Get name.
- Inherited From:
- Source:
Returns:
name
- Type
- string
getOffset() → {number}
#
Get result offset.
- Inherited From:
- Source:
Returns:
Offset Results offset for the upcoming request
- Type
- number
getResults(howManyopt) → {jQuery.Promise}
#
Override parent method and get results from the source.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
howMany |
number |
<optional> |
The number of items to pull from the API |
- Inherited From:
- Source:
Returns:
Promise that is resolved into an array of available results, or is rejected if no results are available.
- Type
- jQuery.Promise
getStandardWidth() → {number|undefined
}
#
undefined
}
#
Get standard width, based on the provider source's thumb sizes.
- Inherited From:
- Source:
Returns:
fetchWidth
- Type
-
number
|
undefined
getStaticParams() → {Object}
#
Get the static, non-changing data parameters sent to the API.
- Inherited From:
- Source:
Returns:
Data parameters
- Type
- Object
getThumbSizes() → {Array.<number>}
#
Get thumb sizes.
- Inherited From:
- Source:
Returns:
sizes Available thumbnail sizes
- Type
- Array.<number>
getUserParams() → {Object}
#
Get the user-inputted dynamic data parameters sent to the API.
- Inherited From:
- Source:
Returns:
Data parameters
- Type
- Object
isDepleted() → {boolean}
#
Check whether the provider is depleted and has no more results to hand off.
- Inherited From:
- Source:
Returns:
The provider is depleted
- Type
- boolean
Check whether the provider is depleted and has no more results to hand off.
isValid() → {boolean}
#
Check if this source is valid.
- Overrides:
- Source:
Returns:
Source is valid
- Type
- boolean
loadSiteInfo() → {jQuery.Promise}
#
Initialize the source and get the site info.
Connect to the api url and retrieve the siteinfo parameters that are required for fetching results.
- Inherited From:
- Source:
Returns:
Promise that resolves when the class properties are set.
- Type
- jQuery.Promise
reset()
#
Reset the provider.
- Inherited From:
- Source:
setAPIurl(apiurl)
#
Set API URL.
Parameters:
Name | Type | Description |
---|---|---|
apiurl |
string | API URL |
- Inherited From:
- Source:
setAjaxSettings(settings)
#
Set the default ajax settings.
Parameters:
Name | Type | Description |
---|---|---|
settings |
Object | Ajax settings |
setContinue(continueData)
#
Set continuation data for the next page.
Parameters:
Name | Type | Description |
---|---|---|
continueData |
Object | Continuation data |
setDefaultFetchLimit(limit)
#
Set limit.
Parameters:
Name | Type | Description |
---|---|---|
limit |
number | Default number of results to fetch from the API |
setFetchProp(prop)
#
Set prop.
Parameters:
Name | Type | Description |
---|---|---|
prop |
string |
setImageSizes(sizes)
#
setLang(lang)
#
Set provider API language.
Parameters:
Name | Type | Description |
---|---|---|
lang |
string | Provider API language |
- Inherited From:
- Source:
setName(name)
#
Set name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string |
setOffset(offset)
#
Set result offset.
Parameters:
Name | Type | Description |
---|---|---|
offset |
number | Results offset for the upcoming request |
setThumbSizes(sizes)
#
setUserParams(params)
#
Set the data parameters sent to the API.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | User defined data parameters |
sort(results) → {Array.<Object>}
#
toggleDepleted(isDepleted)
#
Toggle depleted state.
Parameters:
Name | Type | Description |
---|---|---|
isDepleted |
boolean | The provider is depleted |