From: Krinkle Date: Sat, 12 Feb 2011 20:08:55 +0000 (+0000) Subject: Since mwsuggest.js is no longer used in core, wgMWSuggestTemplate is not defined... X-Git-Tag: 1.31.0-rc.0~32024 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=b17bad75eb79dde6714e2f39b4780d131dd0e594;p=lhc%2Fweb%2Fwiklou.git Since mwsuggest.js is no longer used in core, wgMWSuggestTemplate is not defined either. This variable was previously defined by default. Gadgets using this broke with 1.17 since they assumed wgMWSuggestTemplate was defined just like mwsuggest.js did. I've added the definition for it inside the file itself. --- diff --git a/skins/common/mwsuggest.js b/skins/common/mwsuggest.js index d9bc737e82..134b2d8ab0 100644 --- a/skins/common/mwsuggest.js +++ b/skins/common/mwsuggest.js @@ -7,6 +7,12 @@ * by Robert Stojnic (April 2008) */ +// Make sure wgMWSuggestTemplate is defined +if ( !mw.config.exists( 'wgMWSuggestTemplate' ) ) { + mw.config.set( 'wgMWSuggestTemplate', mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + + "/api.php?action=opensearch\x26search={searchTerms}\x26namespace={namespaces}\x26suggest" ); +} + // search_box_id -> Results object window.os_map = {}; // cached data, url -> json_text @@ -416,7 +422,7 @@ window.os_delayedFetch = function() { var r = os_timer.r; var query = os_timer.query; os_timer = null; - var path = wgMWSuggestTemplate.replace( "{namespaces}", os_getNamespaces( r ) ) + var path = mw.config.get( 'wgMWSuggestTemplate' ).replace( "{namespaces}", os_getNamespaces( r ) ) .replace( "{dbname}", wgDBname ) .replace( "{searchTerms}", os_encodeQuery( query ) );