Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -212,6 +212,7 @@ |
213 | 213 | |
214 | 214 | $wgResourceModules['ext.translate.special.importtranslations'] = array( |
215 | 215 | 'scripts' => 'resources/ext.translate.special.importtranslations.js', |
| 216 | + 'dependencies' => array( 'jquery.ui.autocomplete' ), |
216 | 217 | ) + $resourcePaths; |
217 | 218 | |
218 | 219 | $wgResourceModules['ext.translate.selecttoinput'] = array( |
Index: trunk/extensions/Translate/resources/ext.translate.special.importtranslations.js |
— | — | @@ -1,15 +1,19 @@ |
2 | | -/** Call this to enable suggestions on input (id=inputId), on a form (name=formName) */ |
3 | | -function translateImportInit(){ |
4 | | - os_initHandlers( 'mw-translate-up-wiki-input', 'mw-translate-import', document.getElementById('mw-translate-up-wiki-input') ); |
| 2 | +jQuery( function( $ ) { |
| 3 | + $(".mw-translate-import-inputs").change( function() { |
| 4 | + var id = $(this).attr( "id" ).replace( /-input/, "" ); |
| 5 | + $( "input[name=upload-type]:checked" ).attr( "checked", false ); |
| 6 | + $( "#" + id ).attr( "checked", "checked" ); |
| 7 | + } ); |
5 | 8 | |
6 | | - jQuery(".mw-translate-import-inputs").each(function(i) { |
7 | | - os_hookEvent(this, "focus", function(event) { |
8 | | - var srcid = os_getTarget(event).id; |
9 | | - var inputid = srcid.replace("-input", ""); |
10 | | - |
11 | | - jQuery("#" + inputid).attr("checked", "checked"); |
12 | | - }); |
13 | | - }); |
14 | | -} |
15 | | - |
16 | | -hookEvent("load", translateImportInit); |
\ No newline at end of file |
| 9 | + $( "#mw-translate-up-wiki-input" ).autocomplete( { |
| 10 | + source: function( request, response ) { |
| 11 | + var api = mw.util.wikiScript( "api" ); |
| 12 | + var data = { action: "opensearch", format: "json", namespace: 6, search: request.term }; |
| 13 | + var success = function( res ) { |
| 14 | + response( res[1] ); |
| 15 | + }; |
| 16 | + |
| 17 | + $.get( api, data, success ); |
| 18 | + } |
| 19 | + } ); |
| 20 | +} ); |