r68408 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68407‎ | r68408 | r68409 >
Date:15:58, 22 June 2010
Author:adam
Status:ok (Comments)
Tags:
Comment:
SimpleSearch - removing a superfluous event handler
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js
@@ -115,7 +115,8 @@
116116 positionFromLeft: $j( 'body' ).is( '.rtl' ),
117117 highlightInput: true
118118 } )
119 - .bind( 'paste cut', function() {
 119+ .bind( 'paste cut', function( e ) {
 120+ // make sure paste and cut events from the mouse trigger the keypress handler and cause the suggestions to update
120121 $j( this ).trigger( 'keypress' );
121122 } );
122123 $j( '#searchInput' ).suggestions( {
@@ -152,8 +153,5 @@
153154 }
154155 },
155156 $region: $j( '#simpleSearch' )
156 - } )
157 - .bind( 'paste cut', function() {
158 - $j( this ).trigger( 'keypress' );
159 - } );
 157+ } );
160158 });
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -17,13 +17,13 @@
1818 array( 'src' => 'Modules/ExpandableSearch/ExpandableSearch.js', 'version' => 5 ),
1919 array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 9 ),
2020 array( 'src' => 'Modules/FooterCleanup/FooterCleanup.js', 'version' => 5 ),
21 - array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 20 ),
 21+ array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 21 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'Vector.combined.js', 'version' => 59 ),
 24+ array( 'src' => 'Vector.combined.js', 'version' => 60 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'Vector.combined.min.js', 'version' => 60 ),
 27+ array( 'src' => 'Vector.combined.min.js', 'version' => 61 ),
2828 ),
2929 );
3030 static $modules = array(
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -620,7 +620,8 @@
621621 positionFromLeft: $j( 'body' ).is( '.rtl' ),
622622 highlightInput: true
623623 } )
624 - .bind( 'paste cut', function() {
 624+ .bind( 'paste cut', function( e ) {
 625+ // make sure paste and cut events from the mouse trigger the keypress handler and cause the suggestions to update
625626 $j( this ).trigger( 'keypress' );
626627 } );
627628 $j( '#searchInput' ).suggestions( {
@@ -657,8 +658,5 @@
658659 }
659660 },
660661 $region: $j( '#simpleSearch' )
661 - } )
662 - .bind( 'paste cut', function() {
663 - $j( this ).trigger( 'keypress' );
664 - } );
 662+ } );
665663 });
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -28,5 +28,5 @@
2929 var mod={'browsers':{'ltr':{'opera':[['>=',9.6]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'opera':[['>=',9.6]],'blackberry':false,'ipod':false,'iphone':false}}};if(!$j.wikiEditor.isSupported(mod)){return true;}
3030 $j('div#simpleSearch > input#searchInput').each(function(){$j('<label />').text(mw.usability.getMsg('vector-simplesearch-search')).css({'display':'none','position':'absolute','color':'#999999','cursor':'text','margin':'0 4px','top':'6px','line-height':'13px'}).css(($j('body').is('.rtl')?'right':'left'),0).mousedown(function(){$j(this).parent().find('input#searchInput').focus();return false;}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}}).bind('keypress',function(){if($j(this).parent().find('label:visible').size()>0)
3131 $j(this).parent().find('label').fadeOut(100);}).focus(function(){$j(this).parent().find('label').fadeOut(100);}).blur(function(){if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}});$j(document).bind('dragend',function(event){if($j('div#simpleSearch > label:visible').size()>0&&$j('div#simpleSearch > input#searchInput').val().length>0)
32 -$j('div#simpleSearch > label').fadeOut(100);});$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(){$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()
33 -$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')}).bind('paste cut',function(){$j(this).trigger('keypress');});});
\ No newline at end of file
 32+$j('div#simpleSearch > label').fadeOut(100);});$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()
 33+$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
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -64,7 +64,7 @@
6565 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ),
6666 array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ),
6767 array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 17 ),
68 - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 29 ),
 68+ array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 30 ),
6969 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 36 ),
7070 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 195 ),
7171 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ),
@@ -80,10 +80,10 @@
8181 array( 'src' => 'js/thirdparty/contentCollector.js', 'version' => 2 ),
8282 ),
8383 'combined' => array(
84 - array( 'src' => 'js/plugins.combined.js', 'version' => 442 ),
 84+ array( 'src' => 'js/plugins.combined.js', 'version' => 443 ),
8585 ),
8686 'minified' => array(
87 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 448 ),
 87+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 449 ),
8888 ),
8989 ),
9090 );

Comments

#Comment by Catrope (talk | contribs)   17:46, 22 June 2010
-		.bind( 'paste cut', function() {
+		.bind( 'paste cut', function( e ) {

Why did you add the e parameter when it's not being used?

#Comment by Adammiller~mediawikiwiki (talk | contribs)   17:54, 22 June 2010

I was using that for debugging and forgot to remove it.

Status & tagging log