r66335 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66334‎ | r66335 | r66336 >
Date:11:55, 13 May 2010
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: (bug 23500) Search&replace doesn't highlight stuff in Firefox. Apparently $('textarea').focus(); doesn't work in our case but $('textarea')[0].focus(); does, weird.
Modified paths:
  • /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)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -16,16 +16,16 @@
1717 array( 'src' => 'Modules/Preview/Preview.js', 'version' => 6 ),
1818 array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ),
1919 array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ),
20 - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 88 ),
 20+ array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 89 ),
2121 array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 6 ),
2222 array( 'src' => 'Modules/Templates/Templates.js', 'version' => 1 ),
2323 array( 'src' => 'Modules/AddMediaWizard/AddMediaWizard.js', 'version' => 6 ),
2424 ),
2525 'combined' => array(
26 - array( 'src' => 'WikiEditor.combined.js', 'version' => 93 ),
 26+ array( 'src' => 'WikiEditor.combined.js', 'version' => 94 ),
2727 ),
2828 'minified' => array(
29 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 93 ),
 29+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 94 ),
3030 ),
3131 );
3232 static $messages = array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -2000,7 +2000,7 @@
20012001 $textarea.textSelection( 'setSelection', { 'start': start,
20022002 'end': mode == 'replace' ? newEnd : end } );
20032003 $j( this ).data( 'offset', mode == 'replace' ? newEnd : end );
2004 - var textbox = typeof context.$iframe != 'undefined' ? context.$iframe[0].contentWindow : $textarea;
 2004+ var textbox = typeof context.$iframe != 'undefined' ? context.$iframe[0].contentWindow : $textarea[0];
20052005 textbox.focus();
20062006 }
20072007 });
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -189,7 +189,7 @@
190190 if(!match){$j('#wikieditor-toolbar-replace-nomatch').show();}else if(mode=='replaceAll'){var index;for(var i=0;i<match.length;i++){index=s.indexOf(match[i]);if(index==-1){break;}
191191 s=s.substr(index+match[i].length);var start=index+offset;var end=start+match[i].length;var newEnd=start+replaceStr.length;$textarea.textSelection('setSelection',{'start':start,'end':end}).textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});offset=newEnd;}
192192 $j('#wikieditor-toolbar-replace-success').text(u.getMsg('wikieditor-toolbar-tool-replace-success',match.length)).show();$j(this).data('offset',0);}else{var start=match.index+offset;var end=start+match[0].length;var newEnd=start+replaceStr.length;var context=$j(this).data('context');$textarea.textSelection('setSelection',{'start':start,'end':end});if(mode=='replace'){$textarea.textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});}
193 -$textarea.textSelection('scrollToCaretPosition');$textarea.textSelection('setSelection',{'start':start,'end':mode=='replace'?newEnd:end});$j(this).data('offset',mode=='replace'?newEnd:end);var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow:$textarea;textbox.focus();}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'wikieditor-toolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'wikieditor-toolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'wikieditor-toolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#wikieditor-toolbar-replace-search').focus();$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex').hide();if(!($j(this).data('onetimeonlystuff'))){$j(this).data('onetimeonlystuff',true);$j(this).closest('.ui-dialog').keypress(function(e){if((e.keyCode||e.which)==13){var button=$j(this).data('dialogaction')||$j(this).find('button:first');button.click();e.preventDefault();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});}
 193+$textarea.textSelection('scrollToCaretPosition');$textarea.textSelection('setSelection',{'start':start,'end':mode=='replace'?newEnd:end});$j(this).data('offset',mode=='replace'?newEnd:end);var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow:$textarea[0];textbox.focus();}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'wikieditor-toolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'wikieditor-toolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'wikieditor-toolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#wikieditor-toolbar-replace-search').focus();$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex').hide();if(!($j(this).data('onetimeonlystuff'))){$j(this).data('onetimeonlystuff',true);$j(this).closest('.ui-dialog').keypress(function(e){if((e.keyCode||e.which)==13){var button=$j(this).data('dialogaction')||$j(this).find('button:first');button.click();e.preventDefault();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});}
194194 var dialog=$j(this).closest('.ui-dialog');var that=this;var context=$j(this).data('context');var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow.document:context.$textarea;$j(textbox).bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}else if((e.keyCode||e.which)==27){$j(that).dialog('close');}});},close:function(){var context=$j(this).data('context');var textbox=typeof context.$iframe!='undefined'?context.$iframe[0].contentWindow.document:context.$textarea;$j(textbox).unbind('keypress.srdialog');$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}});$j(document).ready(function(){if(!wgWikiEditorEnabledModules.templateEditor){return true;}
195195 if(wgNamespaceNumber==10){return true;}
196196 if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','templateEditor');}});if(wgWikiEditorEnabledModules.addMediaWizard){if(typeof mwAddMediaConfig=='undefined'){mwAddMediaConfig={};}
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js
@@ -1951,7 +1951,7 @@
19521952 $textarea.textSelection( 'setSelection', { 'start': start,
19531953 'end': mode == 'replace' ? newEnd : end } );
19541954 $j( this ).data( 'offset', mode == 'replace' ? newEnd : end );
1955 - var textbox = typeof context.$iframe != 'undefined' ? context.$iframe[0].contentWindow : $textarea;
 1955+ var textbox = typeof context.$iframe != 'undefined' ? context.$iframe[0].contentWindow : $textarea[0];
19561956 textbox.focus();
19571957 }
19581958 });

Status & tagging log