new mw.widgets.MediaSearchWidget(configopt, sizeopt)
#
Creates an mw.widgets.MediaSearchWidget object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
config |
Object |
<optional> |
Configuration options |
size |
number |
<optional> |
Vertical size of thumbnails |
Extends
Methods
afterResultsResize()
#
Respond to window resize and check if the result display should be updated.
Respond to window resize and check if the result display should be updated.
getAvailableRow() → {number}
#
Find an available row at the end. Either we will need to create a new row or use the last available row if it isn't full.
Returns:
Row index
- Type
- number
getLang() → {string}
#
Get language for the search results.
Returns:
lang Language
- Type
- string
getQueryValue() → {string}
#
Get the sanitized query value from the input.
Returns:
Query value
- Type
- string
lazyLoadResults()
#
Lazy-load the images that are visible.
onQueryChange(value)
#
Handle search value change.
Parameters:
Name | Type | Description |
---|---|---|
value |
string | New value |
onResultsChange(items)
#
Respond to change results event in the results widget. Override the way SelectWidget and GroupElement append the items into the group so we can append them in groups of rows.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<mw.widgets.MediaResultWidget> | An array of item elements |
onResultsRemove(items)
#
Respond to removing results event in the results widget. Clear the relevant rows.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<OO.ui.OptionWidget> | Removed items |
onResultsScroll(e)
#
processQueueResults(items)
#
Process the media queue giving more items.
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<Object> | Given items by the media queue |
queryMediaQueue()
#
Query all sources for media.
resetRows()
#
Reset all the rows; destroy the jQuery elements and reset the rows array.
Reset all the rows; destroy the jQuery elements and reset the rows array.
runLayoutQueue()
#
Run layout methods from the queue only if the element is visible.
setLang(lang)
#
Set language for the search results.
Parameters:
Name | Type | Description |
---|---|---|
lang |
string | Language |
setup()
#
Setup the widget; activate the resize event.
teardown()
#
Teardown the widget; disconnect the window resize event.