mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-15 10:38:19 +00:00
32 lines
746 B
JavaScript
32 lines
746 B
JavaScript
/* eslint-disable */
|
|
|
|
/**
|
|
* Based on https://gerrit.wikimedia.org/g/wikimedia/portals/+/refs/heads/master
|
|
* See T219590 for more details
|
|
*/
|
|
|
|
/* global WMTypeAhead, _, addEvent */
|
|
( function ( WMTypeAhead ) {
|
|
|
|
let inputEvent,
|
|
searchInput = document.getElementById( 'searchInput' ),
|
|
typeAhead = new WMTypeAhead( 'searchform', 'searchInput' );
|
|
|
|
/**
|
|
* Testing for 'input' event and falling back to 'propertychange' event for IE.
|
|
*/
|
|
if ( 'oninput' in document ) {
|
|
inputEvent = 'input';
|
|
} else {
|
|
inputEvent = 'propertychange';
|
|
}
|
|
|
|
/**
|
|
* Attaching type-ahead query action to 'input' event.
|
|
*/
|
|
addEvent( searchInput, inputEvent, _.debounce( function () {
|
|
typeAhead.query( searchInput.value );
|
|
}, 100 ) );
|
|
|
|
}( WMTypeAhead ) );
|