mw.widgets.MediaSearchWidget

Media search widget.

Extends

Constructor

new mw.widgets.MediaSearchWidget(config, size) #

Creates an mw.widgets.MediaSearchWidget object.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

size number optional

Vertical size of thumbnails

Source:

Methods

afterResultsResize() #

Respond to window resize and check if the result display should be updated.

Source:

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.

Source:

Returns:

Row index

Type
number
Find an available row at the end.

getLang() → {string} #

Get language for the search results.

Source:

Returns:

lang Language

Type
string
Get language for the search results.

getQueryValue() → {string} #

Get the sanitized query value from the input.

Source:

Returns:

Query value

Type
string
Get the sanitized query value from the input.

lazyLoadResults() #

Lazy-load the images that are visible.

Source:
Lazy-load the images that are visible.

onQueryChange(value) #

Handle search value change.

Parameters:

Name Type Description
value string

New value

Source:
Handle search value change.

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

Source:
Respond to change results event in the results widget.

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

Source:
Respond to removing results event in the results widget.

onResultsScroll(e) #

Handle results scroll events.

Parameters:

Name Type Description
e jQuery.Event

Scroll event

Source:
Handle results scroll events.

processQueueResults(items) #

Process the media queue giving more items.

Parameters:

Name Type Description
items Array.<Object>

Given items by the media queue

Source:
Process the media queue giving more items.

queryMediaQueue() #

Query all sources for media.

resetRows() #

Reset all the rows; destroy the jQuery elements and reset the rows array.

Source:

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.

Source:
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

Source:
Set language for the search results.

setup() #

Setup the widget; activate the resize event.

Source:
Setup the widget; activate the resize event.

teardown() #

Teardown the widget; disconnect the window resize event.

Source:
Teardown the widget; disconnect the window resize event.