r57015 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57014‎ | r57015 | r57016 >
Date:12:37, 28 September 2009
Author:catrope
Status:ok
Tags:
Comment:
EditToolbar: (bug 20844) Use in-dialog message rather than scary error-like-looking alert box for the "Your search did not match anything." and "5 replacement(s) made." messages.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -1164,6 +1164,10 @@
11651165 titleMsg: 'edittoolbar-tool-replace-title',
11661166 id: 'edittoolbar-replace-dialog',
11671167 html: '\
 1168+ <div id="edittoolbar-replace-message">\
 1169+ <div id="edittoolbar-replace-nomatch" rel="edittoolbar-tool-replace-nomatch"></div>\
 1170+ <div id="edittoolbar-replace-success"></div>\
 1171+ </div>\
11681172 <fieldset><table><tr>\
11691173 <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\
11701174 <td><input type="text" id="edittoolbar-replace-search" /></td>\
@@ -1231,6 +1235,7 @@
12321236 return s;
12331237 }
12341238
 1239+ $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success' ).hide();
12351240 var searchStr = $j( '#edittoolbar-replace-search' ).val();
12361241 var replaceStr = $j( '#edittoolbar-replace-replace' ).val();
12371242 var flags = '';
@@ -1249,7 +1254,7 @@
12501255 var text = fixOperaBrokenness( $textarea.val() );
12511256 var matches = text.match( regex );
12521257 if ( !matches ) {
1253 - alert( gM( 'edittoolbar-tool-replace-nomatch' ) );
 1258+ $j( '#edittoolbar-replace-nomatch' ).show();
12541259 } else if ( replaceAll ) {
12551260 // Prepare to select the last match
12561261 var start = text.lastIndexOf( matches[matches.length - 1] );
@@ -1261,7 +1266,9 @@
12621267 .setSelection( start + corr, end + corr )
12631268 .scrollToCaretPosition();
12641269
1265 - alert( gM( 'edittoolbar-tool-replace-success', matches.length ) );
 1270+ $j( '#edittoolbar-replace-success' )
 1271+ .text( gM( 'edittoolbar-tool-replace-success', matches.length ) )
 1272+ .show();
12661273 $j(this).data( 'offset', 0 );
12671274 } else {
12681275 var start = text.indexOf( matches[0],
@@ -1282,7 +1289,8 @@
12831290 }
12841291 },
12851292 open: function() {
1286 - $j(this).data( 'offset', 0 );
 1293+ $j(this).data( 'offset', 0 );
 1294+ $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success' ).hide();
12871295 if ( !( $j(this).data( 'dialogkeypressset' ) ) ) {
12881296 $j(this).data( 'dialogkeypressset', true );
12891297 // Execute the action associated with the first button
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php
@@ -19,7 +19,7 @@
2020 /* Configuration */
2121
2222 // Bump the version number every time you change any of the .css/.js files
23 -$wgEditToolbarStyleVersion = 39;
 23+$wgEditToolbarStyleVersion = 40;
2424
2525 // Set this to true to simply override the stock toolbar for everyone
2626 $wgEditToolbarGlobalEnable = false;

Status & tagging log