r64400 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64399‎ | r64400 | r64401 >
Date:18:44, 30 March 2010
Author:adam
Status:ok
Tags:
Comment:
WikiEditor: Restoring dialogs in IE, fixing the 'inserts at top in IE' problem, fixing search and replace with the textarea in IE and a small bug with the insert ref dialog
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.textSelection.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -71,7 +71,7 @@
7272 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ),
7373 array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ),
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 9 ),
75 - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ),
 75+ array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 28 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 179 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 52 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 54 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 369 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 370 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 369 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 370 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -16,14 +16,14 @@
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' => 78 ),
 20+ array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 79 ),
2121 array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 6 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'WikiEditor.combined.js', 'version' => 82 ),
 24+ array( 'src' => 'WikiEditor.combined.js', 'version' => 83 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 82 ),
 27+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 83 ),
2828 ),
2929 );
3030 static $messages = array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1390,6 +1390,7 @@
13911391 }
13921392 // Preserve whitespace in selection when replacing
13931393 if ( whitespace ) insertText = whitespace[0] + insertText + whitespace[1];
 1394+ $j(this).dialog( 'close' );
13941395 $j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), {
13951396 type: 'replace',
13961397 options: {
@@ -1400,7 +1401,6 @@
14011402 // Blank form
14021403 $j( '#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text' ).val( '' );
14031404 $j( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).attr( 'checked', '' );
1404 - $j(this).dialog( 'close' );
14051405 },
14061406 'wikieditor-toolbar-tool-link-cancel': function() {
14071407 $j(this).dialog( 'close' );
@@ -1515,6 +1515,8 @@
15161516 var insertText = $j( '#wikieditor-toolbar-reference-text' ).val();
15171517 var whitespace = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace' );
15181518 var attributes = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'attributes' );
 1519+ // Close the dialog
 1520+ $j( this ).dialog( 'close' );
15191521 $j.wikiEditor.modules.toolbar.fn.doAction(
15201522 $j( this ).data( 'context' ),
15211523 {
@@ -1527,12 +1529,8 @@
15281530 },
15291531 $j( this )
15301532 );
1531 -
15321533 // Restore form state
15331534 $j( '#wikieditor-toolbar-reference-text' ).val( "" );
1534 - // Close the dialog
1535 - $j( this ).dialog( 'close' );
1536 -
15371535 },
15381536 'wikieditor-toolbar-tool-reference-cancel': function() {
15391537 $j( this ).dialog( 'close' );
@@ -1544,7 +1542,9 @@
15451543 .$textarea.textSelection( 'getSelection' );
15461544 // set focus
15471545 $j( '#wikieditor-toolbar-reference-text' ).focus();
1548 - $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
 1546+ $j( '#wikieditor-toolbar-reference-dialog' )
 1547+ .data( 'whitespace', [ '', '' ] )
 1548+ .data( 'attributes', '' );
15491549 if ( selection != '' ) {
15501550 var matches, text;
15511551 if ( ( matches = selection.match( /^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/ ) ) ) {
@@ -1761,6 +1761,7 @@
17621762 if ( $j( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) )
17631763 classes.push( 'sortable' );
17641764 var classStr = classes.length > 0 ? ' class="' + classes.join( ' ' ) + '"' : '';
 1765+ $j(this).dialog( 'close' );
17651766 $j.wikiEditor.modules.toolbar.fn.doAction(
17661767 $j(this).data( 'context' ),
17671768 {
@@ -1786,8 +1787,6 @@
17871788 $j( '#wikieditor-toolbar-table-wikitable' ).click();
17881789 if ( $j( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) )
17891790 $j( '#wikieditor-toolbar-table-sortable' ).click();
1790 - $j(this).dialog( 'close' );
1791 -
17921791 },
17931792 'wikieditor-toolbar-tool-table-cancel': function() {
17941793 $j(this).dialog( 'close' );
@@ -1965,7 +1964,9 @@
19661965 'end': newEnd } );
19671966 }
19681967 $textarea.textSelection( 'scrollToCaretPosition' );
1969 - $j(this).data( 'offset', mode == 'replace' ? newEnd : end );
 1968+ $textarea.textSelection( 'setSelection', { 'start': start,
 1969+ 'end': mode == 'replace' ? newEnd : end } );
 1970+ $j( this ).data( 'offset', mode == 'replace' ? newEnd : end );
19701971 var textbox = typeof context.$iframe != 'undefined' ? context.$iframe[0].contentWindow : $textarea;
19711972 textbox.focus();
19721973 }
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -67,7 +67,7 @@
6868 insertText=escTarget;else if(text=='')
6969 insertText='['+escTarget+']';else
7070 insertText='['+escTarget+' '+escText+']';}
71 -if(whitespace)insertText=whitespace[0]+insertText+whitespace[1];$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').val('');$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').attr('checked','');$j(this).dialog('close');},'wikieditor-toolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-link-int-target').focus();$j('#wikieditor-toolbar-link-int-target').change();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;}
 71+if(whitespace)insertText=whitespace[0]+insertText+whitespace[1];$j(this).dialog('close');$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:insertText}},$j(this));$j('#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text').val('');$j('#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext').attr('checked','');},'wikieditor-toolbar-tool-link-cancel':function(){$j(this).dialog('close');}},open:function(){$j(this).data('articlePathRegex',new RegExp('^'+RegExp.escape(wgServer+wgArticlePath).replace(/\\\$1/g,'(.*)')+'$'));var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-link-int-target').focus();$j('#wikieditor-toolbar-link-int-target').change();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var target,text,type;var matches;if((matches=selection.match(/^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:matches[2]);type='int';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else if((matches=selection.match(/^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/))){target=matches[2];text=(matches[4]?matches[4]:'');type='ext';$j('#wikieditor-toolbar-link-dialog').data('whitespace',[matches[1],matches[5]]);}else{target=text=selection;}
7272 if(typeof text!='undefined')
7373 $j('#wikieditor-toolbar-link-int-text').val(text).change();if(typeof target!='undefined')
7474 $j('#wikieditor-toolbar-link-int-target').val(target).change();if(typeof type!='undefined')
@@ -83,7 +83,7 @@
8484 <input type="text" id="wikieditor-toolbar-reference-text" />\
8585 </div>\
8686 </div></fieldset>\
87 - </div>',init:function(){$j(this).find('[rel]').each(function(){$j(this).text(mw.usability.getMsg($j(this).attr('rel')));});},dialog:{dialogClass:'wikiEditor-toolbar-dialog',width:590,buttons:{'wikieditor-toolbar-tool-reference-insert':function(){var insertText=$j('#wikieditor-toolbar-reference-text').val();var whitespace=$j('#wikieditor-toolbar-reference-dialog').data('whitespace');var attributes=$j('#wikieditor-toolbar-reference-dialog').data('attributes');$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:whitespace[0]+'<ref'+attributes+'>',peri:insertText,post:'</ref>'+whitespace[1]}},$j(this));$j('#wikieditor-toolbar-reference-text').val("");$j(this).dialog('close');},'wikieditor-toolbar-tool-reference-cancel':function(){$j(this).dialog('close');}},open:function(){var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-reference-text').focus();$j('#wikieditor-toolbar-link-dialog').data('whitespace',['','']);if(selection!=''){var matches,text;if((matches=selection.match(/^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/))){text=matches[3];$j('#wikieditor-toolbar-reference-dialog').data('whitespace',[matches[1],matches[4]]);$j('#wikieditor-toolbar-reference-dialog').data('attributes',matches[2]);}else{text=selection;}
 87+ </div>',init:function(){$j(this).find('[rel]').each(function(){$j(this).text(mw.usability.getMsg($j(this).attr('rel')));});},dialog:{dialogClass:'wikiEditor-toolbar-dialog',width:590,buttons:{'wikieditor-toolbar-tool-reference-insert':function(){var insertText=$j('#wikieditor-toolbar-reference-text').val();var whitespace=$j('#wikieditor-toolbar-reference-dialog').data('whitespace');var attributes=$j('#wikieditor-toolbar-reference-dialog').data('attributes');$j(this).dialog('close');$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:whitespace[0]+'<ref'+attributes+'>',peri:insertText,post:'</ref>'+whitespace[1]}},$j(this));$j('#wikieditor-toolbar-reference-text').val("");},'wikieditor-toolbar-tool-reference-cancel':function(){$j(this).dialog('close');}},open:function(){var selection=$j(this).data('context').$textarea.textSelection('getSelection');$j('#wikieditor-toolbar-reference-text').focus();$j('#wikieditor-toolbar-reference-dialog').data('whitespace',['','']).data('attributes','');if(selection!=''){var matches,text;if((matches=selection.match(/^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/))){text=matches[3];$j('#wikieditor-toolbar-reference-dialog').data('whitespace',[matches[1],matches[4]]);$j('#wikieditor-toolbar-reference-dialog').data('attributes',matches[2]);}else{text=selection;}
8888 $j('#wikieditor-toolbar-reference-text').val(text);}
8989 if(!($j(this).data('dialogkeypressset'))){$j(this).data('dialogkeypressset',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);});}}}},'insert-table':{filters:['#wpTextbox1.toolbar-dialogs'],titleMsg:'wikieditor-toolbar-tool-table-title',id:'wikieditor-toolbar-table-dialog',html:'\
9090 <div class="wikieditor-toolbar-dialog-wrapper">\
@@ -151,10 +151,10 @@
152152 table=table.substr(0,table.length-1)+"\n";}
153153 var classes=[];if($j('#wikieditor-toolbar-table-wikitable').is(':checked'))
154154 classes.push('wikitable');if($j('#wikieditor-toolbar-table-sortable').is(':checked'))
155 -classes.push('sortable');var classStr=classes.length>0?' class="'+classes.join(' ')+'"':'';$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:'{|'+classStr+"\n",peri:table,post:'|}',ownline:true}},$j(this));$j('#wikieditor-toolbar-table-dimensions-rows').val(4);$j('#wikieditor-toolbar-table-dimensions-columns').val(3);if(!$j('#wikieditor-toolbar-table-dimensions-header').is(':checked'))
 155+classes.push('sortable');var classStr=classes.length>0?' class="'+classes.join(' ')+'"':'';$j(this).dialog('close');$j.wikiEditor.modules.toolbar.fn.doAction($j(this).data('context'),{type:'replace',options:{pre:'{|'+classStr+"\n",peri:table,post:'|}',ownline:true}},$j(this));$j('#wikieditor-toolbar-table-dimensions-rows').val(4);$j('#wikieditor-toolbar-table-dimensions-columns').val(3);if(!$j('#wikieditor-toolbar-table-dimensions-header').is(':checked'))
156156 $j('#wikieditor-toolbar-table-dimensions-header').click();if(!$j('#wikieditor-toolbar-table-wikitable').is(':checked'))
157157 $j('#wikieditor-toolbar-table-wikitable').click();if($j('#wikieditor-toolbar-table-sortable').is(':checked'))
158 -$j('#wikieditor-toolbar-table-sortable').click();$j(this).dialog('close');},'wikieditor-toolbar-tool-table-cancel':function(){$j(this).dialog('close');}},open:function(){$j('#wikieditor-toolbar-table-dimensions-rows').focus();if(!($j(this).data('dialogkeypressset'))){$j(this).data('dialogkeypressset',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);});}}}},'search-and-replace':{'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':false,'safari':[['>=',3]],'chrome':[['>=',3]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':false,'safari':[['>=',3]],'chrome':[['>=',3]]}},filters:['#wpTextbox1.toolbar-dialogs'],titleMsg:'wikieditor-toolbar-tool-replace-title',id:'wikieditor-toolbar-replace-dialog',html:'\
 158+$j('#wikieditor-toolbar-table-sortable').click();},'wikieditor-toolbar-tool-table-cancel':function(){$j(this).dialog('close');}},open:function(){$j('#wikieditor-toolbar-table-dimensions-rows').focus();if(!($j(this).data('dialogkeypressset'))){$j(this).data('dialogkeypressset',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);});}}}},'search-and-replace':{'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':false,'safari':[['>=',3]],'chrome':[['>=',3]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':false,'safari':[['>=',3]],'chrome':[['>=',3]]}},filters:['#wpTextbox1.toolbar-dialogs'],titleMsg:'wikieditor-toolbar-tool-replace-title',id:'wikieditor-toolbar-replace-dialog',html:'\
159159 <div id="wikieditor-toolbar-replace-message">\
160160 <div id="wikieditor-toolbar-replace-nomatch" rel="wikieditor-toolbar-tool-replace-nomatch"></div>\
161161 <div id="wikieditor-toolbar-replace-success"></div>\
@@ -188,7 +188,7 @@
189189 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;}
190190 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;}
191191 $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});}
192 -$textarea.textSelection('scrollToCaretPosition');$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);});}
 192+$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);});}
193193 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;}
194194 if(wgNamespaceNumber==10){return true;}
195195 if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','templateEditor');}});
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js
@@ -1341,6 +1341,7 @@
13421342 }
13431343 // Preserve whitespace in selection when replacing
13441344 if ( whitespace ) insertText = whitespace[0] + insertText + whitespace[1];
 1345+ $j(this).dialog( 'close' );
13451346 $j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), {
13461347 type: 'replace',
13471348 options: {
@@ -1351,7 +1352,6 @@
13521353 // Blank form
13531354 $j( '#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text' ).val( '' );
13541355 $j( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).attr( 'checked', '' );
1355 - $j(this).dialog( 'close' );
13561356 },
13571357 'wikieditor-toolbar-tool-link-cancel': function() {
13581358 $j(this).dialog( 'close' );
@@ -1466,6 +1466,8 @@
14671467 var insertText = $j( '#wikieditor-toolbar-reference-text' ).val();
14681468 var whitespace = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'whitespace' );
14691469 var attributes = $j( '#wikieditor-toolbar-reference-dialog' ).data( 'attributes' );
 1470+ // Close the dialog
 1471+ $j( this ).dialog( 'close' );
14701472 $j.wikiEditor.modules.toolbar.fn.doAction(
14711473 $j( this ).data( 'context' ),
14721474 {
@@ -1478,12 +1480,8 @@
14791481 },
14801482 $j( this )
14811483 );
1482 -
14831484 // Restore form state
14841485 $j( '#wikieditor-toolbar-reference-text' ).val( "" );
1485 - // Close the dialog
1486 - $j( this ).dialog( 'close' );
1487 -
14881486 },
14891487 'wikieditor-toolbar-tool-reference-cancel': function() {
14901488 $j( this ).dialog( 'close' );
@@ -1495,7 +1493,9 @@
14961494 .$textarea.textSelection( 'getSelection' );
14971495 // set focus
14981496 $j( '#wikieditor-toolbar-reference-text' ).focus();
1499 - $j( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
 1497+ $j( '#wikieditor-toolbar-reference-dialog' )
 1498+ .data( 'whitespace', [ '', '' ] )
 1499+ .data( 'attributes', '' );
15001500 if ( selection != '' ) {
15011501 var matches, text;
15021502 if ( ( matches = selection.match( /^(\s*)<ref([^\>]*)>([^\<]*)<\/ref\>(\s*)$/ ) ) ) {
@@ -1712,6 +1712,7 @@
17131713 if ( $j( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) )
17141714 classes.push( 'sortable' );
17151715 var classStr = classes.length > 0 ? ' class="' + classes.join( ' ' ) + '"' : '';
 1716+ $j(this).dialog( 'close' );
17161717 $j.wikiEditor.modules.toolbar.fn.doAction(
17171718 $j(this).data( 'context' ),
17181719 {
@@ -1737,8 +1738,6 @@
17381739 $j( '#wikieditor-toolbar-table-wikitable' ).click();
17391740 if ( $j( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) )
17401741 $j( '#wikieditor-toolbar-table-sortable' ).click();
1741 - $j(this).dialog( 'close' );
1742 -
17431742 },
17441743 'wikieditor-toolbar-tool-table-cancel': function() {
17451744 $j(this).dialog( 'close' );
@@ -1916,7 +1915,9 @@
19171916 'end': newEnd } );
19181917 }
19191918 $textarea.textSelection( 'scrollToCaretPosition' );
1920 - $j(this).data( 'offset', mode == 'replace' ? newEnd : end );
 1919+ $textarea.textSelection( 'setSelection', { 'start': start,
 1920+ 'end': mode == 'replace' ? newEnd : end } );
 1921+ $j( this ).data( 'offset', mode == 'replace' ? newEnd : end );
19211922 var textbox = typeof context.$iframe != 'undefined' ? context.$iframe[0].contentWindow : $textarea;
19221923 textbox.focus();
19231924 }
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js
@@ -227,7 +227,10 @@
228228 } else if ( document.body.createTextRange ) {
229229 var selection = document.body.createTextRange();
230230 selection.moveToElementText( this );
231 - var length = selection.text.length;
 231+ var length = this.value.length;
 232+ // IE doesn't count \n when computing the offset, so we won't either
 233+ var newLines = this.value.match( /\n/g );
 234+ if ( newLines) length = length - newLines.length;
232235 selection.moveStart( 'character', options.start );
233236 selection.moveEnd( 'character', -length + options.end );
234237 selection.select();
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.dialogs.js
@@ -15,10 +15,7 @@
1616 'browsers': {
1717 // Left-to-right languages
1818 'ltr': {
19 - // HORRIBLE HACK
20 - // Normally we would say ['>=', 7] here, but there's a text selection loss on blur with the textarea
21 - 'msie': false,
22 - // END OF HORRIBLE HACK
 19+ 'msie': [['>=', 7]],
2320 // jQuery UI appears to be broken in FF 2.0 - 2.0.0.4
2421 'firefox': [
2522 ['>=', 2], ['!=', '2.0'], ['!=', '2.0.0.1'], ['!=', '2.0.0.2'], ['!=', '2.0.0.3'], ['!=', '2.0.0.4']
@@ -29,10 +26,7 @@
3027 },
3128 // Right-to-left languages
3229 'rtl': {
33 - // HORRIBLE HACK
34 - // Normally we would say ['>=', 7] here, but there's a text selection loss on blur with the textarea
35 - 'msie': false,
36 - // END OF HORRIBLE HACK
 30+ 'msie': [['>=', 7]],
3731 // jQuery UI appears to be broken in FF 2.0 - 2.0.0.4
3832 'firefox': [
3933 ['>=', 2], ['!=', '2.0'], ['!=', '2.0.0.1'], ['!=', '2.0.0.2'], ['!=', '2.0.0.3'], ['!=', '2.0.0.4']
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6394,7 +6394,10 @@
63956395 } else if ( document.body.createTextRange ) {
63966396 var selection = document.body.createTextRange();
63976397 selection.moveToElementText( this );
6398 - var length = selection.text.length;
 6398+ var length = this.value.length;
 6399+ // IE doesn't count \n when computing the offset, so we won't either
 6400+ var newLines = this.value.match( /\n/g );
 6401+ if ( newLines) length = length - newLines.length;
63996402 selection.moveStart( 'character', options.start );
64006403 selection.moveEnd( 'character', -length + options.end );
64016404 selection.select();
@@ -8375,10 +8378,7 @@
83768379 'browsers': {
83778380 // Left-to-right languages
83788381 'ltr': {
8379 - // HORRIBLE HACK
8380 - // Normally we would say ['>=', 7] here, but there's a text selection loss on blur with the textarea
8381 - 'msie': false,
8382 - // END OF HORRIBLE HACK
 8382+ 'msie': [['>=', 7]],
83838383 // jQuery UI appears to be broken in FF 2.0 - 2.0.0.4
83848384 'firefox': [
83858385 ['>=', 2], ['!=', '2.0'], ['!=', '2.0.0.1'], ['!=', '2.0.0.2'], ['!=', '2.0.0.3'], ['!=', '2.0.0.4']
@@ -8389,10 +8389,7 @@
83908390 },
83918391 // Right-to-left languages
83928392 'rtl': {
8393 - // HORRIBLE HACK
8394 - // Normally we would say ['>=', 7] here, but there's a text selection loss on blur with the textarea
8395 - 'msie': false,
8396 - // END OF HORRIBLE HACK
 8393+ 'msie': [['>=', 7]],
83978394 // jQuery UI appears to be broken in FF 2.0 - 2.0.0.4
83988395 'firefox': [
83998396 ['>=', 2], ['!=', '2.0'], ['!=', '2.0.0.1'], ['!=', '2.0.0.2'], ['!=', '2.0.0.3'], ['!=', '2.0.0.4']
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -430,7 +430,7 @@
431431 if(!postFinished){if(postRange.compareEndPoints("StartToEnd",postRange)==0){postFinished=true;}else{postRange.moveEnd("character",-1)
432432 if(postRange.text==postText){rawPostText+="\r\n";}else{postFinished=true;}}}}while((!postFinished||!periFinished||!postFinished));caretPos=rawPreText.replace(/\r\n/g,"\n").length;endPos=caretPos+rawPeriText.replace(/\r\n/g,"\n").length;}else if(e.selectionStart||e.selectionStart=='0'){caretPos=e.selectionStart;endPos=e.selectionEnd;}
433433 return options.startAndEnd?[caretPos,endPos]:caretPos;}
434 -return getCaret(this.get(0));},setSelection:function(options){return this.each(function(){if($(this).is(':hidden')){}else if(this.selectionStart||this.selectionStart=='0'){if(options.start>this.selectionEnd){this.selectionEnd=options.end;this.selectionStart=options.start;}else{this.selectionStart=options.start;this.selectionEnd=options.end;}}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=selection.text.length;selection.moveStart('character',options.start);selection.moveEnd('character',-length+options.end);selection.select();}});},scrollToCaretPosition:function(options){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));}
 434+return getCaret(this.get(0));},setSelection:function(options){return this.each(function(){if($(this).is(':hidden')){}else if(this.selectionStart||this.selectionStart=='0'){if(options.start>this.selectionEnd){this.selectionEnd=options.end;this.selectionStart=options.start;}else{this.selectionStart=options.start;this.selectionEnd=options.end;}}else if(document.body.createTextRange){var selection=document.body.createTextRange();selection.moveToElementText(this);var length=this.value.length;var newLines=this.value.match(/\n/g);if(newLines)length=length-newLines.length;selection.moveStart('character',options.start);selection.moveEnd('character',-length+options.end);selection.select();}});},scrollToCaretPosition:function(options){function getLineLength(e){return Math.floor(e.scrollWidth/($.os.name=='linux'?7:8));}
435435 function getCaretScrollPosition(e){var text=e.value.replace(/\r/g,"");var caret=$(e).textSelection('getCaretPosition');var lineLength=getLineLength(e);var row=0;var charInLine=0;var lastSpaceInLine=0;for(i=0;i<caret;i++){charInLine++;if(text.charAt(i)==" "){lastSpaceInLine=charInLine;}else if(text.charAt(i)=="\n"){lastSpaceInLine=0;charInLine=0;row++;}
436436 if(charInLine>lineLength){if(lastSpaceInLine>0){charInLine=charInLine-lastSpaceInLine;lastSpaceInLine=0;row++;}}}
437437 var nextSpace=0;for(j=caret;j<caret+lineLength;j++){if(text.charAt(j)==" "||text.charAt(j)=="\n"||caret==text.length){nextSpace=j;break;}}
@@ -580,7 +580,7 @@
581581 var args=$.makeArray(arguments);if(typeof context.$iframe==='undefined'&&args[0]=='addModule'&&typeof args[1]!='undefined'){var modules=args[1];if(typeof modules!="object"){modules={};modules[args[1]]='';}
582582 for(module in modules){if(module in $.wikiEditor.modules&&$.wikiEditor.isSupported($.wikiEditor.modules[module])&&$.wikiEditor.isRequired($.wikiEditor.modules[module],'iframe')){context.fn.setupIframe();break;}}}
583583 if(args.length>0){var call=args.shift();if(call in context.api){context.api[call](context,typeof args[0]=='undefined'?{}:args[0]);}}
584 -return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={'browsers':{'ltr':{'msie':false,'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]]},'rtl':{'msie':false,'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]]}},api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];}
 584+return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]]},'rtl':{'msie':[['>=',7]],'firefox':[['>=',2],['!=','2.0'],['!=','2.0.0.1'],['!=','2.0.0.2'],['!=','2.0.0.3'],['!=','2.0.0.4']],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]]}},api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];}
585585 mw.usability.load(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(mod in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[mod];var filtered=false;if(typeof module.filters!='undefined'){for(var i=0;i<module.filters.length;i++){if($(module.filters[i]).length==0){filtered=true;break;}}}
586586 if(!filtered&&$.wikiEditor.isSupported(module)&&$('#'+module.id).size()==0){if(typeof context.$iframe=='undefined'&&$.wikiEditor.isRequired(module,'iframe')){context.fn.setupIframe();}
587587 var configuration=module.dialog;configuration.bgiframe=true;configuration.autoOpen=false;configuration.modal=true;configuration.title=$.wikiEditor.autoMsg(module,'title');configuration.newButtons={};for(msg in configuration.buttons)

Status & tagging log