r59191 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59190‎ | r59191 | r59192 >
Date:00:16, 18 November 2009
Author:catrope
Status:ok (Comments)
Tags:
Comment:
acaifix: Change tactics for handling browsers that don't restore cursor positions: onblur causes problems, so use a delayed event on keyup and mouseup (may need more events there)
Modified paths:
  • /branches/usability/acaifix/UsabilityInitiative.hooks.php (modified) (history)
  • /branches/usability/acaifix/js/plugins.combined.js (modified) (history)
  • /branches/usability/acaifix/js/plugins.combined.min.js (modified) (history)
  • /branches/usability/acaifix/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: branches/usability/acaifix/UsabilityInitiative.hooks.php
@@ -66,16 +66,16 @@
6767 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
6868 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ),
6969 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 18 ),
70 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 13 ),
 70+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 14 ),
7171 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 22 ),
7272 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 8 ),
7373 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 27 ),
7474 ),
7575 'combined' => array(
76 - array( 'src' => 'js/plugins.combined.js', 'version' => 65 ),
 76+ array( 'src' => 'js/plugins.combined.js', 'version' => 66 ),
7777 ),
7878 'minified' => array(
79 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 65 ),
 79+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 66 ),
8080 ),
8181 ),
8282 );
Index: branches/usability/acaifix/js/plugins/jquery.wikiEditor.js
@@ -170,12 +170,11 @@
171171 $(this).setSelection( pos[0], pos[1] );
172172 $(this).data( 'wikiEditor-cursor', false );
173173 })
174 - .blur( function() {
175 - var pos = $(this).data( 'wikiEditor-cursor' );
176 - if ( !$(this).data( 'wikiEditor-cursor' ) )
177 - $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true, true ) );
178 - });
 174+ .delayedBind( 100, 'keyup mouseup', function() {
 175+ $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true ) );
179176
 177+ } );
 178+
180179 // Create a set of standard methods for internal and external use
181180 context.api = {
182181 /**
Index: branches/usability/acaifix/js/plugins.combined.js
@@ -1334,12 +1334,11 @@
13351335 $(this).setSelection( pos[0], pos[1] );
13361336 $(this).data( 'wikiEditor-cursor', false );
13371337 })
1338 - .blur( function() {
1339 - var pos = $(this).data( 'wikiEditor-cursor' );
1340 - if ( !$(this).data( 'wikiEditor-cursor' ) )
1341 - $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true, true ) );
1342 - });
 1338+ .delayedBind( 100, 'keyup mouseup', function() {
 1339+ $(this).data( 'wikiEditor-cursor', $(this).getCaretPosition( true ) );
13431340
 1341+ } );
 1342+
13441343 // Create a set of standard methods for internal and external use
13451344 context.api = {
13461345 /**
Index: branches/usability/acaifix/js/plugins.combined.min.js
@@ -88,8 +88,7 @@
8989 $.isOperaBroken=true;div.remove();}
9090 if($.isOperaBroken)
9191 s=s.replace(/\n/g,"\r\n");return s;};$.fn.wikiEditor=function(){var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);$(this).wrap($('<div></div>').addClass('wikiEditor-ui').attr('id','wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom').attr('id','wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text').attr('id','wikiEditor-ui-text'));context.$ui=$(this).parent().parent().parent();context.$ui.after($('<div style="clear:both;"></div>'));context.$ui.prepend($('<div></div>').addClass('wikiEditor-ui-top').attr('id','wikiEditor-ui-top'));$(this).focus(function(){var pos=$(this).data('wikiEditor-cursor');if(pos)
92 -$(this).setSelection(pos[0],pos[1]);$(this).data('wikiEditor-cursor',false);}).blur(function(){var pos=$(this).data('wikiEditor-cursor');if(!$(this).data('wikiEditor-cursor'))
93 -$(this).data('wikiEditor-cursor',$(this).getCaretPosition(true,true));});context.api={addModule:function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}}
 92+$(this).setSelection(pos[0],pos[1]);$(this).data('wikiEditor-cursor',false);}).delayedBind(100,'keyup mouseup',function(){$(this).data('wikiEditor-cursor',$(this).getCaretPosition(true));});context.api={addModule:function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}}
9493 if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}}
9594 if(arguments.length>0&&typeof arguments[0]=='object'){context.api.addModule(context,arguments[0]);}else{arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);}}}
9695 return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,{'modules':data})},openDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('open');}},closeDialog:function(context,data){if(data.dialog in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[data.dialog].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];}

Follow-up revisions

RevisionCommit summaryAuthorDate
r59204wmf-deployment: Merging usability changes from trunk...catrope18:53, 18 November 2009

Comments

#Comment by Shuhari (talk | contribs)   18:47, 18 November 2009

This revision was reviewed by Werdna at 6:44pm UTC on November 18th before production deployment.

Status & tagging log