Index: trunk/extensions/Vector/modules/ext.vector.simpleSearch.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* JavaScript for SimpleSearch extension */ |
3 | 3 | |
4 | | -$( document ).ready( function() { |
| 4 | +jQuery( document ).ready( function( $ ) { |
5 | 5 | |
6 | 6 | // Compatibility map |
7 | 7 | var map = { |
— | — | @@ -40,14 +40,12 @@ |
41 | 41 | |
42 | 42 | // General suggestions functionality for all search boxes |
43 | 43 | $( '#searchInput, #searchInput2, #powerSearchText, #searchText' ) |
44 | | - .mouseover( function() { $(this).focus() |
45 | | - }) |
46 | 44 | .suggestions( { |
47 | 45 | fetch: function( query ) { |
48 | 46 | var $this = $(this); |
49 | | - if ( query.length != 0 ) { |
| 47 | + if ( query.length !== 0 ) { |
50 | 48 | var request = $.ajax( { |
51 | | - url: mw.config.get( 'wgScriptPath' ) + '/api.php', |
| 49 | + url: mw.util.wikiScript( 'api' ), |
52 | 50 | data: { |
53 | 51 | action: 'opensearch', |
54 | 52 | search: query, |
— | — | @@ -56,15 +54,15 @@ |
57 | 55 | }, |
58 | 56 | dataType: 'json', |
59 | 57 | success: function( data ) { |
60 | | - if ( $.isArray( data ) && 1 in data ) { |
| 58 | + if ( $.isArray( data ) !== -1 && 1 in data ) { |
61 | 59 | $this.suggestions( 'suggestions', data[1] ); |
62 | 60 | } |
63 | 61 | } |
64 | 62 | }); |
65 | 63 | $this.data( 'request', request ); |
66 | | - } |
| 64 | + } |
67 | 65 | }, |
68 | | - cancel: function () { |
| 66 | + cancel: function() { |
69 | 67 | var request = $(this).data( 'request' ); |
70 | 68 | // If the delay setting has caused the fetch to have not even happend yet, the request object will |
71 | 69 | // have never been set |
— | — | @@ -96,7 +94,7 @@ |
97 | 95 | }, |
98 | 96 | special: { |
99 | 97 | render: function( query ) { |
100 | | - if ( $(this).children().size() === 0 ) { |
| 98 | + if ( $(this).children().length === 0 ) { |
101 | 99 | $(this).show(); |
102 | 100 | var $label = $( '<div></div>', { |
103 | 101 | 'class': 'special-label', |