r58953 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58952‎ | r58953 | r58954 >
Date:16:29, 12 November 2009
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
* UsabilityIntiative: Hopefully fix bug 21342 (e.button != 0 check doesn't work in IE) and bug 21050 (IE doesn't throw keypress on backspace)
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php (modified) (history)
  • /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/UsabilityInitiative.hooks.php
@@ -71,16 +71,16 @@
7272 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ),
7373 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 20 ),
7474 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 15 ),
75 - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 25 ),
 75+ array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 26 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 35 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 3 ),
7979 ),
8080 'combined' => array(
81 - array( 'src' => 'js/plugins.combined.js', 'version' => 73 ),
 81+ array( 'src' => 'js/plugins.combined.js', 'version' => 74 ),
8282 ),
8383 'minified' => array(
84 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 73 ),
 84+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 74 ),
8585 ),
8686 ),
8787 );
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -15,13 +15,13 @@
1616 array( 'src' => 'Modules/Highlight/Highlight.js', 'version' => 1 ),
1717 array( 'src' => 'Modules/Preview/Preview.js', 'version' => 1 ),
1818 array( 'src' => 'Modules/Toc/Toc.js', 'version' => 1 ),
19 - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 4 ),
 19+ array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 5 ),
2020 ),
2121 'combined' => array(
22 - array( 'src' => 'WikiEditor.combined.js', 'version' => 2 ),
 22+ array( 'src' => 'WikiEditor.combined.js', 'version' => 3 ),
2323 ),
2424 'minified' => array(
25 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 2 ),
 25+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 3 ),
2626 ),
2727 );
2828 static $modules = array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -929,7 +929,7 @@
930930 // has changed the link text field - this is a convience thing since most link texts are going to be the
931931 // the same as the page title
932932 // Also change the internal/external radio button accordingly
933 - $j( '#wikieditor-toolbar-link-int-target' ).bind( 'change keypress paste cut', function() {
 933+ $j( '#wikieditor-toolbar-link-int-target' ).bind( 'change keydown paste cut', function() {
934934 // $j(this).val() is the old value, before the keypress
935935 // Defer this until $j(this).val() has been updated
936936 setTimeout( function() {
@@ -942,8 +942,13 @@
943943 $j( '#wikieditor-toolbar-link-int-text' ).val( $j( '#wikieditor-toolbar-link-int-target' ).val() );
944944 }, 0 );
945945 });
946 - $j( '#wikieditor-toolbar-link-int-text' ).bind( 'change keypress paste cut', function() {
947 - $j(this).data( 'untouched', false );
 946+ $j( '#wikieditor-toolbar-link-int-text' ).bind( 'change keydown paste cut', function() {
 947+ var oldVal = $j(this).val();
 948+ var that = this;
 949+ setTimeout( function() {
 950+ if ( $j(that).val() != oldVal )
 951+ $j(that).data( 'untouched', false );
 952+ }, 0 );
948953 });
949954 // Add images to the page existence widget, which will be shown mutually exclusively to communicate if the
950955 // page exists, does not exist or the title is invalid (like if it contains a | character)
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -37,10 +37,11 @@
3838 status='notexists';else if(typeof page.invalid!='undefined')
3939 status='invalid';}
4040 cache[target]=status;updateWidget(status);}}));}
41 -$j(this).find('[rel]').each(function(){$j(this).text(gM($j(this).attr('rel')));});$j('#wikieditor-toolbar-link-int-target').bind('change keypress paste cut',function(){setTimeout(function(){if(isExternalLink($j('#wikieditor-toolbar-link-int-target').val()))
 41+$j(this).find('[rel]').each(function(){$j(this).text(gM($j(this).attr('rel')));});$j('#wikieditor-toolbar-link-int-target').bind('change keydown paste cut',function(){setTimeout(function(){if(isExternalLink($j('#wikieditor-toolbar-link-int-target').val()))
4242 $j('#wikieditor-toolbar-link-type-ext').attr('checked','checked');else
4343 $j('#wikieditor-toolbar-link-type-int').attr('checked','checked');if($j('#wikieditor-toolbar-link-int-text').data('untouched'))
44 -$j('#wikieditor-toolbar-link-int-text').val($j('#wikieditor-toolbar-link-int-target').val());},0);});$j('#wikieditor-toolbar-link-int-text').bind('change keypress paste cut',function(){$j(this).data('untouched',false);});var existsMsg=gM('wikieditor-toolbar-tool-link-int-target-status-exists');var notexistsMsg=gM('wikieditor-toolbar-tool-link-int-target-status-notexists');var invalidMsg=gM('wikieditor-toolbar-tool-link-int-target-status-invalid');var externalMsg=gM('wikieditor-toolbar-tool-link-int-target-status-external');var loadingMsg=gM('wikieditor-toolbar-tool-link-int-target-status-loading');$j('#wikieditor-toolbar-link-int-target-status').before($j('<br />')).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-exists','src':$j.wikiEditor.imgPath+'dialogs/'+'insert-link-exists.png','alt':existsMsg,'title':existsMsg})).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-notexists','src':$j.wikiEditor.imgPath+'dialogs/'+'insert-link-notexists.png','alt':notexistsMsg,'title':notexistsMsg})).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-invalid','src':$j.wikiEditor.imgPath+'dialogs/'+'insert-link-invalid.png','alt':invalidMsg,'title':invalidMsg})).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-external','src':$j.wikiEditor.imgPath+'dialogs/'+'insert-link-external.png','alt':externalMsg,'title':externalMsg})).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-loading','src':$j.wikiEditor.imgPath+'dialogs/loading.gif','alt':loadingMsg,'title':loadingMsg})).data('existencecache',{}).children().hide();$j('#wikieditor-toolbar-link-int-target').bind('keypress paste cut',function(){if(typeof $j(this).data('timerID')!='undefined'){clearTimeout($j(this).data('timerID'));}
 44+$j('#wikieditor-toolbar-link-int-text').val($j('#wikieditor-toolbar-link-int-target').val());},0);});$j('#wikieditor-toolbar-link-int-text').bind('change keydown paste cut',function(){var oldVal=$j(this).val();var that=this;setTimeout(function(){if($j(that).val()!=oldVal)
 45+$j(that).data('untouched',false);},0);});var existsMsg=gM('wikieditor-toolbar-tool-link-int-target-status-exists');var notexistsMsg=gM('wikieditor-toolbar-tool-link-int-target-status-notexists');var invalidMsg=gM('wikieditor-toolbar-tool-link-int-target-status-invalid');var externalMsg=gM('wikieditor-toolbar-tool-link-int-target-status-external');var loadingMsg=gM('wikieditor-toolbar-tool-link-int-target-status-loading');$j('#wikieditor-toolbar-link-int-target-status').before($j('<br />')).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-exists','src':$j.wikiEditor.imgPath+'dialogs/'+'insert-link-exists.png','alt':existsMsg,'title':existsMsg})).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-notexists','src':$j.wikiEditor.imgPath+'dialogs/'+'insert-link-notexists.png','alt':notexistsMsg,'title':notexistsMsg})).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-invalid','src':$j.wikiEditor.imgPath+'dialogs/'+'insert-link-invalid.png','alt':invalidMsg,'title':invalidMsg})).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-external','src':$j.wikiEditor.imgPath+'dialogs/'+'insert-link-external.png','alt':externalMsg,'title':externalMsg})).append($j('<img />').attr({'id':'wikieditor-toolbar-link-int-target-status-loading','src':$j.wikiEditor.imgPath+'dialogs/loading.gif','alt':loadingMsg,'title':loadingMsg})).data('existencecache',{}).children().hide();$j('#wikieditor-toolbar-link-int-target').bind('keypress paste cut',function(){if(typeof $j(this).data('timerID')!='undefined'){clearTimeout($j(this).data('timerID'));}
4546 var timerID=setTimeout(updateExistence,120);$j(this).data('timerID',timerID);}).change(function(){if(typeof $j(this).data('timerID')!='undefined'){clearTimeout($j(this).data('timerID'));}
4647 updateExistence();});$j('#wikieditor-toolbar-link-int-target').data('suggcache',{}).suggestions({fetch:function(query){var that=this;var title=$j(this).val();if(isExternalLink(title)||title.indexOf('|')!=-1||title==''){$j(this).suggestions('suggestions',[]);return;}
4748 var cache=$j(this).data('suggcache');if(typeof cache[title]!='undefined'){$j(this).suggestions('suggestions',cache[title]);return;}
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js
@@ -929,7 +929,7 @@
930930 // has changed the link text field - this is a convience thing since most link texts are going to be the
931931 // the same as the page title
932932 // Also change the internal/external radio button accordingly
933 - $j( '#wikieditor-toolbar-link-int-target' ).bind( 'change keypress paste cut', function() {
 933+ $j( '#wikieditor-toolbar-link-int-target' ).bind( 'change keydown paste cut', function() {
934934 // $j(this).val() is the old value, before the keypress
935935 // Defer this until $j(this).val() has been updated
936936 setTimeout( function() {
@@ -942,8 +942,13 @@
943943 $j( '#wikieditor-toolbar-link-int-text' ).val( $j( '#wikieditor-toolbar-link-int-target' ).val() );
944944 }, 0 );
945945 });
946 - $j( '#wikieditor-toolbar-link-int-text' ).bind( 'change keypress paste cut', function() {
947 - $j(this).data( 'untouched', false );
 946+ $j( '#wikieditor-toolbar-link-int-text' ).bind( 'change keydown paste cut', function() {
 947+ var oldVal = $j(this).val();
 948+ var that = this;
 949+ setTimeout( function() {
 950+ if ( $j(that).val() != oldVal )
 951+ $j(that).data( 'untouched', false );
 952+ }, 0 );
948953 });
949954 // Add images to the page existence widget, which will be shown mutually exclusively to communicate if the
950955 // page exists, does not exist or the title is invalid (like if it contains a | character)
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js
@@ -467,7 +467,10 @@
468468 } )
469469 .bind( 'mousedown', function( e ) {
470470 // Only act when the primary mouse button was pressed
471 - if ( e.button !== 0 ) {
 471+ // This is a terrible hack: IE and Safari use a 1/2/4 bitmask,
 472+ // but Firefox uses 0/1/2
 473+ // See http://quirksmode.org/dom/w3c_events.html#miscprop
 474+ if ( e.button !== 0 || e.button & 1 == 0) {
472475 return true;
473476 }
474477 var $sections = $(this).data( 'context' ).$ui.find( '.sections' );
@@ -579,7 +582,7 @@
580583 return false;
581584 });
582585 return false;
583 - });
 586+ })
584587 context.modules.$toolbar.append( $dragControl );
585588 }
586589 var $sections = $( '<div />' ).addClass( 'sections' ).appendTo( context.modules.$toolbar );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2376,7 +2376,10 @@
23772377 } )
23782378 .bind( 'mousedown', function( e ) {
23792379 // Only act when the primary mouse button was pressed
2380 - if ( e.button !== 0 ) {
 2380+ // This is a terrible hack: IE and Safari use a 1/2/4 bitmask,
 2381+ // but Firefox uses 0/1/2
 2382+ // See http://quirksmode.org/dom/w3c_events.html#miscprop
 2383+ if ( e.button !== 0 || e.button & 1 == 0) {
23812384 return true;
23822385 }
23832386 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){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
r58972usability: Merge r58953 (IE fixes) from trunk to acaifixcatrope20:52, 12 November 2009
r58973UsabilityInitiative: Fix for r58953catrope21:35, 12 November 2009
r59204wmf-deployment: Merging usability changes from trunk...catrope18:53, 18 November 2009

Comments

#Comment by Tim Starling (talk | contribs)   01:33, 18 November 2009

Plainly broken, I assume you're hoping this was fixed in r58973 and r58974. I assume the bug 21050 component is also untested. Is it too much to ask that you test your changes before commit? Do we need to sponsor you a Windows license or something?

Marking as "fixme" pending proper testing.

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

Yes, I fixed it in those revs, and I had others test it. I downloaded VirtualBox yesterday and I'm gonna play around with it today so I'll (hopefully) finally have IE to test on.

Removing fixme as this has been tested by other people, and you haven't explicitly said it didn't work for you (after r58972 and r58973 that is; the deployment candidate is running on http://prototype.wikimedia.org/deployment/ ).

Status & tagging log