Razlika između izmjena na stranici "MediaWiki:Common.js"

Izvor: Sandžakpedija
Idi na navigaciju Idi na pretragu
(Nova stranica: →‎Bilo koja JavaScript će biti učitana za sve korisnike pri svakom učitavanju stranice.: document.getElementById('searchform').action = '/index.php'; document.getElementsByN...)
 
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 ) );

Verzija na dan 19 maj 2020 u 23:10

/* Bilo koja JavaScript će biti učitana za sve korisnike pri svakom učitavanju stranice. */

( function ( mw, $ ) {
    $( 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 ) );