Izmjene

nema sažetka izmjene
Red 1: Red 1:  
/* Bilo koja JavaScript će biti učitana za sve korisnike pri svakom učitavanju stranice. */
 
/* Bilo koja JavaScript će biti učitana za sve korisnike pri svakom učitavanju stranice. */
   −
document.getElementById('searchform').action = '/index.php';
+
( function ( mw, $ ) {
document.getElementsByName('search')[0].id = 'searchInput';
+
    $( function () {
 +
        $( '.searchboxInput' ).autocomplete( { //This is the class Name of your desired input
 +
            source: function( request, response ) {
 +
                // Create a new Api object (see [[RL/DM#mediawiki.api]]
 +
                var api = new mw.Api();
 +
                // Start a "GET" request
 +
                api.get( {
 +
                    action: 'opensearch',
 +
                    search: request.term, // This is the current value of the user's input
 +
                    suggest: ''
 +
                } ).done( function ( data ) {
 +
                    response( data[1] ); // set the results as the autocomplete options
 +
                } );
 +
            }
 +
        } );
 +
    } );
 +
}( mediaWiki, jQuery ) );