r61035 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61034‎ | r61035 | r61036 >
Date:23:47, 13 January 2010
Author:adam
Status:resolved (Comments)
Tags:
Comment:
minor dialog tweaks
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/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -26,15 +26,15 @@
2727 array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ),
2828 array( 'src' => 'css/wikiEditor.templateEditor.css', 'version' => 1 ),
2929 array( 'src' => 'css/wikiEditor.toc.css', 'version' => 26 ),
30 - array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 8 ),
 30+ array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 9 ),
3131 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3232 ),
3333 'combined' => array(
34 - array( 'src' => 'css/combined.css', 'version' => 48 ),
 34+ array( 'src' => 'css/combined.css', 'version' => 49 ),
3535 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3636 ),
3737 'minified' => array(
38 - array( 'src' => 'css/combined.min.css', 'version' => 48 ),
 38+ array( 'src' => 'css/combined.min.css', 'version' => 49 ),
3939 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
4040 ),
4141 )
@@ -86,7 +86,7 @@
8787 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 22 ),
8888 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 44 ),
8989 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 12 ),
90 - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 40 ),
 90+ array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 41 ),
9191 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 10 ),
9292 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 61 ),
9393 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 9 ),
@@ -94,10 +94,10 @@
9595 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ),
9696 ),
9797 'combined' => array(
98 - array( 'src' => 'js/plugins.combined.js', 'version' => 141 ),
 98+ array( 'src' => 'js/plugins.combined.js', 'version' => 142 ),
9999 ),
100100 'minified' => array(
101 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 141 ),
 101+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 142 ),
102102 ),
103103 ),
104104 );
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css
@@ -345,9 +345,12 @@
346346 text-decoration: none;
347347 border-color: #a8d7f9;
348348 }
 349+.ui-widget table td.wikieditor-toolbar-table-preview-wrapper span {
 350+ padding: 4px 6px 0px;
 351+ display: block;
 352+}
349353 .ui-widget table .wikieditor-toolbar-table-preview-frame {
350354 width: 340px;
351 - height: 250px;
352355 background: #fff;
353356 padding: 10px;
354357 border: 1px solid #cdcdcd;
@@ -358,8 +361,6 @@
359362 .ui-widget table .wikieditor-toolbar-table-preview-content {
360363 width: 375px;
361364 display: block;
362 - position: absolute;
363 - top: -29px;
364365 }
365366 .ui-widget table .wikieditor-toolbar-table-preview {
366367 width: 340px;
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -815,9 +815,12 @@
816816 text-decoration: none;
817817 border-color: #a8d7f9;
818818 }
 819+.ui-widget table td.wikieditor-toolbar-table-preview-wrapper span {
 820+ padding: 4px 6px 0px;
 821+ display: block;
 822+}
819823 .ui-widget table .wikieditor-toolbar-table-preview-frame {
820824 width: 340px;
821 - height: 250px;
822825 background: #fff;
823826 padding: 10px;
824827 border: 1px solid #cdcdcd;
@@ -828,8 +831,6 @@
829832 .ui-widget table .wikieditor-toolbar-table-preview-content {
830833 width: 375px;
831834 display: block;
832 - position: absolute;
833 - top: -29px;
834835 }
835836 .ui-widget table .wikieditor-toolbar-table-preview {
836837 width: 340px;
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -767,9 +767,12 @@
768768 text-decoration:none;
769769 border-color:#a8d7f9;
770770 }
 771+.ui-widget table td.wikieditor-toolbar-table-preview-wrapper span{
 772+padding:4px 6px 0px;
 773+display:block;
 774+}
771775 .ui-widget table .wikieditor-toolbar-table-preview-frame{
772776 width:340px;
773 -height:250px;
774777 background:#fff;
775778 padding:10px;
776779 border:1px solid #cdcdcd;
@@ -780,8 +783,6 @@
781784 .ui-widget table .wikieditor-toolbar-table-preview-content{
782785 width:375px;
783786 display:block;
784 -position:absolute;
785 -top:-29px;
786787 }
787788 .ui-widget table .wikieditor-toolbar-table-preview{
788789 width:340px;
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1167,6 +1167,7 @@
11681168 });
11691169 },
11701170 dialog: {
 1171+ resizable: false,
11711172 width: 500,
11721173 buttons: {
11731174 'wikieditor-toolbar-tool-link-insert': function() {
@@ -1340,7 +1341,6 @@
13411342 <span rel="wikieditor-toolbar-tool-table-example"></span>\
13421343 <div class="wikieditor-toolbar-table-preview-frame">\
13431344 <div class="wikieditor-toolbar-table-preview-content">\
1344 - <span rel="wikieditor-toolbar-tool-table-example-text"></span>\
13451345 <table id="wikieditor-toolbar-table-preview" class="wikieditor-toolbar-table-preview wikitable">\
13461346 <tr class="wikieditor-toolbar-table-preview-header">\
13471347 <th rel="wikieditor-toolbar-tool-table-example-header"></th>\
@@ -1433,6 +1433,7 @@
14341434
14351435 },
14361436 dialog: {
 1437+ resizable: false,
14371438 buttons: {
14381439 'wikieditor-toolbar-tool-table-insert': function() {
14391440 var rowsVal = $j( '#wikieditor-toolbar-table-dimensions-rows' ).val();
@@ -1639,6 +1640,8 @@
16401641 });
16411642 },
16421643 dialog: {
 1644+ resizable: false,
 1645+ width: 500,
16431646 buttons: {
16441647 'wikieditor-toolbar-tool-replace-button-findnext': function( e ) {
16451648 $j(this).closest( '.ui-dialog' ).data( 'dialogaction', e.target );
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -54,7 +54,7 @@
5555 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;}
5656 var cache=$j(this).data('suggcache');if(typeof cache[title]!='undefined'){$j(this).suggestions('suggestions',cache[title]);return;}
5757 var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':title,'namespace':0,'suggest':'','format':'json'},dataType:'json',success:function(data){cache[title]=data[1];$j(that).suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request)
58 -request.abort();}});},dialog:{width:500,buttons:{'wikieditor-toolbar-tool-link-insert':function(){function escapeInternalText(s){return s.replace(/(]{2,})/g,'<nowiki>$1</nowiki>');}
 58+request.abort();}});},dialog:{resizable:false,width:500,buttons:{'wikieditor-toolbar-tool-link-insert':function(){function escapeInternalText(s){return s.replace(/(]{2,})/g,'<nowiki>$1</nowiki>');}
5959 function escapeExternalTarget(s){return s.replace(/ /g,'%20').replace(/]/g,'%5D');}
6060 function escapeExternalText(s){return s.replace(/(]+)/g,'<nowiki>$1</nowiki>');}
6161 var insertText='';var whitespace=$j('#wikieditor-toolbar-link-dialog').data('whitespace');var target=$j('#wikieditor-toolbar-link-int-target').val();var text=$j('#wikieditor-toolbar-link-int-text').val();if(target==''){alert(gM('wikieditor-toolbar-tool-link-empty'));return;}
@@ -83,7 +83,6 @@
8484 <span rel="wikieditor-toolbar-tool-table-example"></span>\
8585 <div class="wikieditor-toolbar-table-preview-frame">\
8686 <div class="wikieditor-toolbar-table-preview-content">\
87 - <span rel="wikieditor-toolbar-tool-table-example-text"></span>\
8887 <table id="wikieditor-toolbar-table-preview" class="wikieditor-toolbar-table-preview wikitable">\
8988 <tr class="wikieditor-toolbar-table-preview-header">\
9089 <th rel="wikieditor-toolbar-tool-table-example-header"></th>\
@@ -127,7 +126,7 @@
128127 <input type="text" id="wikieditor-toolbar-table-dimensions-columns" size="4" />\
129128 </td></tr></table></fieldset>',init:function(){$j(this).find('[rel]').each(function(){$j(this).text(gM($j(this).attr('rel')));});$j('#wikieditor-toolbar-table-dimensions-rows').val(4);$j('#wikieditor-toolbar-table-dimensions-columns').val(3);$j('#wikieditor-toolbar-table-wikitable').click(function(){$j('.wikieditor-toolbar-table-preview').toggleClass('wikitable');});$j('#wikieditor-toolbar-table-preview').clone().attr('id','wikieditor-toolbar-table-preview2').addClass('sortable').insertAfter($j('#wikieditor-toolbar-table-preview')).hide();if(typeof ts_makeSortable=='function')
130129 ts_makeSortable($j('#wikieditor-toolbar-table-preview2').get(0));$j('#wikieditor-toolbar-table-sortable').click(function(){$j('#wikieditor-toolbar-table-preview').hide().attr('id','wikieditor-toolbar-table-preview3');$j('#wikieditor-toolbar-table-preview2').attr('id','wikieditor-toolbar-table-preview').show();$j('#wikieditor-toolbar-table-preview3').attr('id','wikieditor-toolbar-table-preview2');});$j('#wikieditor-toolbar-table-dimensions-header').click(function(){var headerHTML=$j('.wikieditor-toolbar-table-preview-header').html();var hiddenHTML=$j('.wikieditor-toolbar-table-preview-hidden').html();$j('.wikieditor-toolbar-table-preview-header').html(hiddenHTML);$j('.wikieditor-toolbar-table-preview-hidden').html(headerHTML);if(typeof ts_makeSortable=='function')
131 -ts_makeSortable($j('#wikieditor-toolbar-table-preview, #wikieditor-toolbar-table-preview2').filter('.sortable').get(0));});},dialog:{buttons:{'wikieditor-toolbar-tool-table-insert':function(){var rowsVal=$j('#wikieditor-toolbar-table-dimensions-rows').val();var colsVal=$j('#wikieditor-toolbar-table-dimensions-columns').val();var rows=parseInt(rowsVal,10);var cols=parseInt(colsVal,10);var header=Math.min(1,$j('#wikieditor-toolbar-table-dimensions-header:checked').size());if(isNaN(rows)||isNaN(cols)||rows!=rowsVal||cols!=colsVal){alert(gM('wikieditor-toolbar-tool-table-invalidnumber'));return;}
 130+ts_makeSortable($j('#wikieditor-toolbar-table-preview, #wikieditor-toolbar-table-preview2').filter('.sortable').get(0));});},dialog:{resizable:false,buttons:{'wikieditor-toolbar-tool-table-insert':function(){var rowsVal=$j('#wikieditor-toolbar-table-dimensions-rows').val();var colsVal=$j('#wikieditor-toolbar-table-dimensions-columns').val();var rows=parseInt(rowsVal,10);var cols=parseInt(colsVal,10);var header=Math.min(1,$j('#wikieditor-toolbar-table-dimensions-header:checked').size());if(isNaN(rows)||isNaN(cols)||rows!=rowsVal||cols!=colsVal){alert(gM('wikieditor-toolbar-tool-table-invalidnumber'));return;}
132131 if(rows+header==0||cols==0){alert(gM('wikieditor-toolbar-tool-table-zero'));return;}
133132 if(rows*cols>1000){alert(gM('wikieditor-toolbar-tool-table-toomany',1000));return;}
134133 var headerText=gM('wikieditor-toolbar-tool-table-example-header');var normalText=gM('wikieditor-toolbar-tool-table-example');var table="";for(var r=0;r<rows+header;r++){table+="|-\n";for(var c=0;c<cols;c++){var isHeader=(r+1==header);var delim=isHeader?'!':'|';if(c>0){delim+=delim;}
@@ -167,6 +166,6 @@
168167 matches=text.match(regex);if(!matches)
169168 $j('#wikieditor-toolbar-replace-nomatch').show();else if(mode=='replaceAll'){var start=text.lastIndexOf(matches[matches.length-1]);var end=start+replaceStr.length;var replaced=text.replace(regex,replaceStr);var corr=replaced.length-text.length-replaceStr.length+matches[matches.length-1].length;$textarea.val(replaced).change().focus().textSelection('setSelection',{'start':start+corr,'end':end+corr}).textSelection('scrollToCaretPosition');$j('#wikieditor-toolbar-replace-success').text(gM('wikieditor-toolbar-tool-replace-success',matches.length)).show();$j(this).data('offset',0);}else{var start=text.indexOf(matches[0],$j(this).data('offset'));if(start==-1)
170169 start=text.indexOf(matches[0]);var end=start+matches[0].length;var newEnd=start+replaceStr.length;$textarea.focus().textSelection('setSelection',{'start':start,'end':end});if(mode=='replace'){$textarea.textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});}
171 -$textarea.textSelection('scrollToCaretPosition');$j(this).data('offset',mode=='replace'?newEnd:end);}});},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);});}
 170+$textarea.textSelection('scrollToCaretPosition');$j(this).data('offset',mode=='replace'?newEnd:end);}});},dialog:{resizable:false,width:500,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);});}
172171 var dialog=$j(this).closest('.ui-dialog');$j(this).data('context').$textarea.bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}});},close:function(){$j(this).data('context').$textarea.unbind('keypress.srdialog').focus();$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}});mw.ready(function(){if(!wgWikiEditorEnabledModules.templateEditor){return true;}
173172 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
@@ -1118,6 +1118,7 @@
11191119 });
11201120 },
11211121 dialog: {
 1122+ resizable: false,
11221123 width: 500,
11231124 buttons: {
11241125 'wikieditor-toolbar-tool-link-insert': function() {
@@ -1291,7 +1292,6 @@
12921293 <span rel="wikieditor-toolbar-tool-table-example"></span>\
12931294 <div class="wikieditor-toolbar-table-preview-frame">\
12941295 <div class="wikieditor-toolbar-table-preview-content">\
1295 - <span rel="wikieditor-toolbar-tool-table-example-text"></span>\
12961296 <table id="wikieditor-toolbar-table-preview" class="wikieditor-toolbar-table-preview wikitable">\
12971297 <tr class="wikieditor-toolbar-table-preview-header">\
12981298 <th rel="wikieditor-toolbar-tool-table-example-header"></th>\
@@ -1384,6 +1384,7 @@
13851385
13861386 },
13871387 dialog: {
 1388+ resizable: false,
13881389 buttons: {
13891390 'wikieditor-toolbar-tool-table-insert': function() {
13901391 var rowsVal = $j( '#wikieditor-toolbar-table-dimensions-rows' ).val();
@@ -1590,6 +1591,8 @@
15911592 });
15921593 },
15931594 dialog: {
 1595+ resizable: false,
 1596+ width: 500,
15941597 buttons: {
15951598 'wikieditor-toolbar-tool-replace-button-findnext': function( e ) {
15961599 $j(this).closest( '.ui-dialog' ).data( 'dialogaction', e.target );

Comments

#Comment by Catrope (talk | contribs)   21:45, 17 January 2010
+			resizable: false,

Why make all dialogs nonresizable?

#Comment by Adammiller~mediawikiwiki (talk | contribs)   00:59, 18 January 2010

Paru, and Hannes requested it. I saw no reason they needed to be resizable. Do you?

#Comment by Catrope (talk | contribs)   01:42, 18 January 2010

Most of these dialogs contain textboxes that people type stuff in, so long-winded people might wanna grow the dialog so their input doesn't wrap out of view. Also, we can't really guarantee we'll get the dialog size right for languages with long messages and/or long words like German; while we wanna handle this as gracefully as possible in our code, we need to give people the opportunity to change the size of the window to make it look nicer.

Short version: I see no reason why it should be *non*resizable. We shouldn't take features away from people without a good reason.

#Comment by Catrope (talk | contribs)   15:54, 25 January 2010

Adam removed two of the resizable: false lines in r61293, and the third one (table dialog) seems valid since it's only used to enter numbers and resizing will make it look ugly.

Status & tagging log