Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
if ( mw.user.options.get( 'skin' ) === 'vector' )
$(function() {
setTimeout( function() {
'use strict';
var $searchBoxes = $( '#searchInput, #searchInput2, #powerSearchText, #searchText' );
if(!$searchBoxes.suggestions) return;
$searchBoxes.suggestions( {
fetch: function( query ) {
var $this = $( this );
if ( query.length !== 0 ) {
var params = {
action: 'opensearch',
search: query,
suggest: ''
};
$.ajax( {
data: params,
url: mw.util.wikiScript('api'),
dataType: 'json',
success: function( data ) {
if ($.isArray( data ) && 1 in data) {
var orig = data[1];
$this.suggestions( 'suggestions', orig );
if ( data[1].length < 10 ) {
params.search = query.replace( /^{{/, 'Template:' );
if ( params.search === query )
return;
params.limit = 10 - data[1].length;
$.ajax({
data: params,
url: mw.util.wikiScript('api'),
dataType: 'json',
success: function( data ) {
if ( $.isArray( data ) && 1 in data )
$this.suggestions( 'suggestions', orig.concat( data[1] ) );
}
});
}
}
}
} );
}
}
});
}, 1200); // setTimeout
}); // document.ready