Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js |
— | — | @@ -61,7 +61,14 @@ |
62 | 62 | } ) |
63 | 63 | .parents( 'form' ) |
64 | 64 | .bind( 'submit', function() { |
65 | | - $input.trigger( 'focus' ); |
| 65 | + // $input.trigger( 'focus' ); is problematic |
| 66 | + // because it actually focuses $input, leading |
| 67 | + // to nasty behavior in mobile browsers |
| 68 | + if ( $input.hasClass( 'placeholder' ) ) { |
| 69 | + $input |
| 70 | + .val( '' ) |
| 71 | + .removeClass( 'placeholder' ); |
| 72 | + } |
66 | 73 | } ); |
67 | 74 | if ( $input.val() == '' ) { |
68 | 75 | $input.trigger( 'blur' ); |
Property changes on: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js |
___________________________________________________________________ |
Added: svn:mergeinfo |
69 | 76 | Merged /trunk/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js:r56207,56209,56296,56333,56355,62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62266-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66324,66331-66335,66337-68736,68742-68841,68843-69725,71518 |
70 | 77 | Merged /trunk/phase3/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js:r56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816,65387,65391,65555,65590 |
71 | 78 | Merged /branches/wmf-deployment/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js:r60970 |
72 | 79 | Merged /trunk/phase3/resources/jquery/jquery.placeholder.js:r76510 |
73 | 80 | Merged /branches/REL1_15/phase3/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js:r51646 |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -468,7 +468,14 @@ |
469 | 469 | } ) |
470 | 470 | .parents( 'form' ) |
471 | 471 | .bind( 'submit', function() { |
472 | | - $input.trigger( 'focus' ); |
| 472 | + // $input.trigger( 'focus' ); is problematic |
| 473 | + // because it actually focuses $input, leading |
| 474 | + // to nasty behavior in mobile browsers |
| 475 | + if ( $input.hasClass( 'placeholder' ) ) { |
| 476 | + $input |
| 477 | + .val( '' ) |
| 478 | + .removeClass( 'placeholder' ); |
| 479 | + } |
473 | 480 | } ); |
474 | 481 | if ( $input.val() == '' ) { |
475 | 482 | $input.trigger( 'blur' ); |
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -29,6 +29,6 @@ |
30 | 30 | $j('form').submit(function(){window.onbeforeunload=fallbackWindowOnBeforeUnload;});});var fallbackWindowOnBeforeUnload=null;if(wgVectorEnabledModules.simplesearch&&skin=='vector'&&typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];} |
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 | | -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(){$input.trigger('focus');});if($input.val()==''){$input.trigger('blur');}});} |
| 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 | 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() |
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 |