Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js |
— | — | @@ -88,7 +88,9 @@ |
89 | 89 | }, |
90 | 90 | dataType: 'json', |
91 | 91 | success: function( data ) { |
92 | | - $this.suggestions( 'suggestions', data[1] ); |
| 92 | + if ( data && 1 in data ) { |
| 93 | + $this.suggestions( 'suggestions', data[1] ); |
| 94 | + } |
93 | 95 | } |
94 | 96 | }); |
95 | 97 | $j(this).data( 'request', request ); |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -495,7 +495,9 @@ |
496 | 496 | }, |
497 | 497 | dataType: 'json', |
498 | 498 | success: function( data ) { |
499 | | - $this.suggestions( 'suggestions', data[1] ); |
| 499 | + if ( data && 1 in data ) { |
| 500 | + $this.suggestions( 'suggestions', data[1] ); |
| 501 | + } |
500 | 502 | } |
501 | 503 | }); |
502 | 504 | $j(this).data( 'request', request ); |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -30,5 +30,5 @@ |
31 | 31 | $j(document).ready(function(){if(!wgVectorEnabledModules.simplesearch||wgVectorPreferences.simplesearch.disablesuggest||skin!='vector'){return true;} |
32 | 32 | var mod={'browsers':{'ltr':{'opera':[['>=',9.6]],'docomo':false,'blackberry':false,'ipod':false,'iphone':false},'rtl':{'opera':[['>=',9.6]],'docomo':false,'blackberry':false,'ipod':false,'iphone':false}}};if(!$j.wikiEditor.isSupported(mod)){return true;} |
33 | 33 | if('placeholder'in document.createElement('input')){$j('div#simpleSearch > input#searchInput').attr('placeholder',mw.usability.getMsg('vector-simplesearch-search'));}else{$j('div#simpleSearch > input#searchInput').each(function(){var $input=$j(this);$input.bind('blur',function(){if($input.val().length==0){$input.val(mw.usability.getMsg('vector-simplesearch-search')).addClass('placeholder');}}).bind('focus',function(){if($input.hasClass('placeholder')){$input.val('').removeClass('placeholder');}}).parents('form').bind('submit',function(){if($input.hasClass('placeholder')){$input.val('').removeClass('placeholder');}});if($input.val()==''){$input.trigger('blur');}});} |
34 | | -$j('#searchInput, #searchInput2, #powerSearchText, #searchText').suggestions({fetch:function(query){var $this=$j(this);var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':query,'namespace':0,'suggest':''},dataType:'json',success:function(data){$this.suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request&&typeof request.abort=='function'){request.abort();$j(this).removeData('request');}},result:{select:function($textbox){$textbox.closest('form').submit();}},delay:120,positionFromLeft:$j('body').is('.rtl'),highlightInput:true}).bind('paste cut',function(e){$j(this).trigger('keypress');});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){if($j(this).children().size()==0){$j(this).show() |
| 34 | +$j('#searchInput, #searchInput2, #powerSearchText, #searchText').suggestions({fetch:function(query){var $this=$j(this);var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':query,'namespace':0,'suggest':''},dataType:'json',success:function(data){if(data&&1 in data){$this.suggestions('suggestions',data[1]);}}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request&&typeof request.abort=='function'){request.abort();$j(this).removeData('request');}},result:{select:function($textbox){$textbox.closest('form').submit();}},delay:120,positionFromLeft:$j('body').is('.rtl'),highlightInput:true}).bind('paste cut',function(e){$j(this).trigger('keypress');});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){if($j(this).children().size()==0){$j(this).show() |
35 | 35 | $label=$j('<div />').addClass('special-label').text(mw.usability.getMsg('vector-simplesearch-containing')).appendTo($j(this));$query=$j('<div />').addClass('special-query').text(query).appendTo($j(this));$query.autoEllipsis();}else{$j(this).find('.special-query').empty().text(query).autoEllipsis();}},select:function($textbox){$textbox.closest('form').append($j('<input />').attr({'type':'hidden','name':'fulltext','value':1}));$textbox.closest('form').submit();}},$region:$j('#simpleSearch')});}); |
\ No newline at end of file |