r58974 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58973‎ | r58974 | r58975 >
Date:21:40, 12 November 2009
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
Fix for r58973: needs parentheses
Modified paths:
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js
@@ -470,7 +470,7 @@
471471 // This is a terrible hack: IE and Safari use a 1/2/4 bitmask,
472472 // but Firefox uses 0/1/2
473473 // See http://quirksmode.org/dom/w3c_events.html#miscprop
474 - if ( e.button !== 0 && e.button & 1 == 0) {
 474+ if ( e.button !== 0 && ( e.button & 1 ) == 0) {
475475 return true;
476476 }
477477 var $sections = $(this).data( 'context' ).$ui.find( '.sections' );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2379,7 +2379,7 @@
23802380 // This is a terrible hack: IE and Safari use a 1/2/4 bitmask,
23812381 // but Firefox uses 0/1/2
23822382 // See http://quirksmode.org/dom/w3c_events.html#miscprop
2383 - if ( e.button !== 0 && e.button & 1 == 0) {
 2383+ if ( e.button !== 0 && ( e.button & 1 ) == 0) {
23842384 return true;
23852385 }
23862386 var $sections = $(this).data( 'context' ).$ui.find( '.sections' );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -144,7 +144,7 @@
145145 return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+
146146 $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';}
147147 html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'encapsulate','options':{'pre':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'encapsulate','options':{'pre':character[1]}}};}
148 -if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('mousedown',function(e){if(e.button!==0&&e.button&1==0){return true;}
 148+if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('mousedown',function(e){if(e.button!==0&&(e.button&1)==0){return true;}
149149 var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':0},$section.outerHeight()*2,function(){$(this).css('overflow','visible');});}
150150 if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));}
151151 $.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);}).click(function(){return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}}

Follow-up revisions

RevisionCommit summaryAuthorDate
r58975usability: Merge r58973, r58974 from trunk into acaifixcatrope21:43, 12 November 2009
r59204wmf-deployment: Merging usability changes from trunk...catrope18:53, 18 November 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r58973UsabilityInitiative: Fix for r58953catrope21:35, 12 November 2009

Comments

#Comment by Tim Starling (talk | contribs)   02:22, 18 November 2009

Is it intended that this will cause a middle-button click to be treated the same as a left-button click in FF?

#Comment by Catrope (talk | contribs)   11:08, 18 November 2009

That's not intended, no, but I don't think it's a big deal, or that we can cleanly solve this without browser sniffing. The problem would go away if we went back to using click(), but we're using mousedown() for a reason. I'll discuss this with Trevor.

#Comment by Catrope (talk | contribs)   18:59, 18 November 2009

Changed back to using click() in r59202

#Comment by Tim Starling (talk | contribs)   00:42, 19 November 2009

I think if you have a choice between browser sniffing and totally broken behaviour, you should choose browser sniffing.

#Comment by Catrope (talk | contribs)   08:03, 19 November 2009

Agreed. However, we decided that using click instead of mousedown was OK, so that's what we did.

Status & tagging log