(require("gateway/rest"))(ajax, config, extractParser) → {Gateway}
Creates an instance of the RESTBase gateway.
This gateway differs from the MediaWiki gateway
in
that it fetches page data from the RESTBase page summary endpoint.
Parameters:
Name | Type | Description |
---|---|---|
ajax |
Ajax | A function with the same signature as |
config |
Object | Configuration that affects the major behavior of the gateway. |
extractParser |
function | A function that takes response and returns parsed extract |
- Source:
Returns:
- Type
- Gateway
Methods
(inner) generateThumbnailData(thumbnail, original, thumbSize) → {Object|undefined}
Resizes the thumbnail to the requested width, preserving its aspect ratio.
The requested width is limited to that of the original image unless the image is an SVG, which can be scaled infinitely.
This function is only intended to mangle the pretty thumbnail URLs used on Wikimedia Commons. Once an official thumb API is fully specified and implemented, this function can be made more general.
Parameters:
Name | Type | Description |
---|---|---|
thumbnail |
Object | The thumbnail image |
original |
Object | The original image |
thumbSize |
number | The requested size |
- Source:
Returns:
- Type
- Object | undefined
(inner) isSafeImgFormat(filename) → {boolean}
Checks whether the originalImage
property contains an image
format that's safe to render.
https://www.mediawiki.org/wiki/Help:Images#Supported_media_types_for_images
Parameters:
Name | Type | Description |
---|---|---|
filename |
string |
- Source:
Returns:
- Type
- boolean
Type Definitions
Ajax()
- Source: