r62201 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62200‎ | r62201 | r62202 >
Date:21:55, 9 February 2010
Author:adam
Status:ok (Comments)
Tags:
Comment:
Adding a temporary div cover while the wikiEditor is loading
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.css (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.wikiEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -21,7 +21,7 @@
2222 array( 'src' => 'css/suggestions.css', 'version' => 6 ),
2323 array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 7 ),
2424 array( 'src' => 'css/vector.footerCleanup.css', 'version' => 1 ),
25 - array( 'src' => 'css/wikiEditor.css', 'version' => 9 ),
 25+ array( 'src' => 'css/wikiEditor.css', 'version' => 10 ),
2626 array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 19 ),
2727 array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ),
2828 array( 'src' => 'css/wikiEditor.toc.css', 'version' => 28 ),
@@ -29,11 +29,11 @@
3030 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3131 ),
3232 'combined' => array(
33 - array( 'src' => 'css/combined.css', 'version' => 63 ),
 33+ array( 'src' => 'css/combined.css', 'version' => 64 ),
3434 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3535 ),
3636 'minified' => array(
37 - array( 'src' => 'css/combined.min.css', 'version' => 63 ),
 37+ array( 'src' => 'css/combined.min.css', 'version' => 64 ),
3838 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3939 ),
4040 )
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 113 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 114 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 47 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 12 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 231 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 232 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 231 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 232 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.css
@@ -112,3 +112,26 @@
113113 .wikiEditor-view-wikitext {
114114 line-height: 1em;
115115 }
 116+.wikiEditor-ui-loading {
 117+ background: #f3f3f3;
 118+ z-index: 10;
 119+ position: absolute;
 120+ top: 0;
 121+ left: 0;
 122+ text-align: center;
 123+ height: 100%;
 124+ width: 100%;
 125+ border: 1px solid silver;
 126+ margin: -1px;
 127+ opacity: 0.9;
 128+ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
 129+ filter: alpha(opacity=90);
 130+}
 131+.wikiEditor-ui-loading span {
 132+ display: block;
 133+ height: 24px;
 134+ width: 24px;
 135+ background: url( ../images/wikiEditor/toolbar/loading.gif ) 0 0 no-repeat;
 136+ text-indent: -9999px;
 137+ margin: 0 auto;
 138+}
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -225,7 +225,29 @@
226226 .wikiEditor-view-wikitext {
227227 line-height: 1em;
228228 }
229 -/* wikiEditor dialogs module */
 229+.wikiEditor-ui-loading {
 230+ background: #f3f3f3;
 231+ z-index: 10;
 232+ position: absolute;
 233+ top: 0;
 234+ left: 0;
 235+ text-align: center;
 236+ height: 100%;
 237+ width: 100%;
 238+ border: 1px solid silver;
 239+ margin: -1px;
 240+ opacity: 0.9;
 241+ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
 242+ filter: alpha(opacity=90);
 243+}
 244+.wikiEditor-ui-loading span {
 245+ display: block;
 246+ height: 24px;
 247+ width: 24px;
 248+ background: url( ../images/wikiEditor/toolbar/loading.gif ) 0 0 no-repeat;
 249+ text-indent: -9999px;
 250+ margin: 0 auto;
 251+}/* wikiEditor dialogs module */
230252
231253 .wikiEditor-toolbar-dialog table {
232254 margin-top: 0.75em;
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -215,6 +215,29 @@
216216 .wikiEditor-view-wikitext{
217217 line-height:1em;
218218 }
 219+.wikiEditor-ui-loading{
 220+background:#f3f3f3;
 221+z-index:10;
 222+position:absolute;
 223+top:0;
 224+left:0;
 225+text-align:center;
 226+height:100%;
 227+width:100%;
 228+border:1px solid silver;
 229+margin:-1px;
 230+opacity:0.9;
 231+-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)";
 232+filter:alpha(opacity=90);
 233+}
 234+.wikiEditor-ui-loading span{
 235+display:block;
 236+height:24px;
 237+width:24px;
 238+background:url( ../images/wikiEditor/toolbar/loading.gif ) 0 0 no-repeat;
 239+text-indent:-9999px;
 240+margin:0 auto;
 241+}
219242 .wikiEditor-toolbar-dialog table{
220243 margin-top:0.75em;
221244 }
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -1174,7 +1174,12 @@
11751175 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-view wikiEditor-ui-view-wikitext' ) )
11761176 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-left' ) )
11771177 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-bottom' ) )
1178 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) );
 1178+ .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) )
 1179+ .after(
 1180+ $( '<div></div>' )
 1181+ .addClass( 'wikiEditor-ui-loading' )
 1182+ .append( $( '<span>Loading</span>' )
 1183+ .css( 'marginTop', context.$textarea.height() / 2 ) ) );
11791184 // Get references to some of the newly created containers
11801185 context.$ui = context.$textarea.parent().parent().parent().parent().parent();
11811186 context.$wikitext = context.$textarea.parent().parent().parent().parent();
@@ -1288,6 +1293,10 @@
12891294 context.$iframe.show();
12901295 // Let modules know we're ready to start working with the content
12911296 context.fn.trigger( 'ready' );
 1297+ //remove our temporary loading
 1298+ $( '.wikiEditor-ui-loading' ).fadeOut( 'fast', function() {
 1299+ $( this ).remove();
 1300+ } );
12921301 // Setup event handling on the iframe
12931302 $( context.$iframe[0].contentWindow.document )
12941303 .bind( 'keydown', function( event ) {
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6737,7 +6737,7 @@
67386738 break;
67396739 // Intercept all tab events to provide consisten behavior across browsers
67406740 // Webkit browsers insert tab characters by default into the iframe rather than changing input focus
6741 - case 9:
 6741+ case 9: //tab
67426742 // if any modifier keys are pressed, allow the browser to do it's thing
67436743 if ( event.ctrlKey || event.altKey || event.shiftKey ) {
67446744 return true;
@@ -6754,6 +6754,12 @@
67556755 return false;
67566756 }
67576757 break;
 6758+ case 86: //v
 6759+ if ( event.ctrlKey ){
 6760+ //paste, intercepted for IE
 6761+ context.evt.paste( event );
 6762+ }
 6763+ break;
67586764 }
67596765 return true;
67606766 },
@@ -7601,7 +7607,12 @@
76027608 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-view wikiEditor-ui-view-wikitext' ) )
76037609 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-left' ) )
76047610 .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-bottom' ) )
7605 - .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) );
 7611+ .wrap( $( '<div></div>' ).addClass( 'wikiEditor-ui-text' ) )
 7612+ .after(
 7613+ $( '<div></div>' )
 7614+ .addClass( 'wikiEditor-ui-loading' )
 7615+ .append( $( '<span>Loading</span>' )
 7616+ .css( 'marginTop', context.$textarea.height() / 2 ) ) );
76067617 // Get references to some of the newly created containers
76077618 context.$ui = context.$textarea.parent().parent().parent().parent().parent();
76087619 context.$wikitext = context.$textarea.parent().parent().parent().parent();
@@ -7715,6 +7726,10 @@
77167727 context.$iframe.show();
77177728 // Let modules know we're ready to start working with the content
77187729 context.fn.trigger( 'ready' );
 7730+ //remove our temporary loading
 7731+ $( '.wikiEditor-ui-loading' ).fadeOut( 'fast', function() {
 7732+ $( this ).remove();
 7733+ } );
77197734 // Setup event handling on the iframe
77207735 $( context.$iframe[0].contentWindow.document )
77217736 .bind( 'keydown', function( event ) {
@@ -7723,10 +7738,10 @@
77247739 .bind( 'paste', function( event ) {
77257740 return context.fn.trigger( 'paste', event );
77267741 } )
7727 - .bind( 'keyup mouseup paste cut encapsulateSelection', function( event ) {
 7742+ .bind( 'keyup paste mouseup cut encapsulateSelection', function( event ) {
77287743 return context.fn.trigger( 'change', event );
77297744 } )
7730 - .delayedBind( 250, 'keyup mouseup paste cut encapsulateSelection', function( event ) {
 7745+ .delayedBind( 250, 'keyup paste mouseup cut encapsulateSelection', function( event ) {
77317746 context.fn.trigger( 'delayedChange', event );
77327747 } );
77337748 } );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -449,6 +449,7 @@
450450 return false;}
451451 break;case 9:if(event.ctrlKey||event.altKey||event.shiftKey){return true;}else{var $tabindexList=$j('[tabindex]:visible').sort(function(a,b){return a.tabIndex>b.tabIndex?1:-1;});for(var i=0;i<$tabindexList.length;i++){if($tabindexList.eq(i).attr('id')==context.$iframe.attr('id')){$tabindexList.get(i+1).focus();break;}}
452452 return false;}
 453+break;case 86:if(event.ctrlKey){context.evt.paste(event);}
453454 break;}
454455 return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';}
455456 switch(event.which){case 8:break;}
@@ -527,10 +528,10 @@
528529 pos=nextPos+(leavingP?1:0);if(t.node.nodeName=='#text'){lastTextNode=t.node;lastTextNodeDepth=t.depth;}
529530 t=nextT;}},'saveSelection':function(){if(!$.browser.msie){return;}
530531 context.$iframe[0].contentWindow.focus();context.savedSelection=context.$iframe[0].contentWindow.document.selection.createRange();},'restoreSelection':function(){if(!$.browser.msie||context.savedSelection===null){return;}
531 -context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event);});context.$iframe=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'tabindex':1,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime(),'id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){if(!this.isSecondRun){context.$iframe[0].contentWindow.document.designMode='on';if($.browser.msie){this.isSecondRun=true;return;}}
 532+context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text')).after($('<div></div>').addClass('wikiEditor-ui-loading').append($('<span>Loading</span>').css('marginTop',context.$textarea.height()/2)));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event);});context.$iframe=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'tabindex':1,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime(),'id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){if(!this.isSecondRun){context.$iframe[0].contentWindow.document.designMode='on';if($.browser.msie){this.isSecondRun=true;return;}}
532533 context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val().replace(/&esc;/g,'&esc;esc;').replace(/\<p\>/g,'&esc;&lt;p&gt;').replace(/\<\/p\>/g,'&esc;&lt;/p&gt;').replace(/\<span class="wikiEditor-tab"\>\<\/span\>/g,'&esc;&lt;span&nbsp;class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;').replace(/&nbsp;/g,'&esc;&amp;nbsp;');if($.browser.msie){html=html.replace(/\t/g,'<span class="wikiEditor-tab"></span>');if($.browser.versionNumber<=7){html=html.replace(/ /g,"&nbsp;");}else{html=html.replace(/(^|\n) /g,"$1&nbsp;");}}
533534 html=$('<div />').text('<p>'+html.replace(/\r?\n/g,'</p><p>')+'</p>').html().replace(/&amp;nbsp;/g,'&nbsp;').replace(/&lt;p&gt;/g,'<p>').replace(/&lt;\/p&gt;/g,'</p>').replace(/<p><\/p>/g,'<br>').replace(/&amp;esc;&amp;amp;nbsp;/g,'&amp;nbsp;').replace(/&amp;esc;&amp;lt;p&amp;gt;/g,'&lt;p&gt;').replace(/&amp;esc;&amp;lt;\/p&amp;gt;/g,'&lt;/p&gt;').replace(/&amp;esc;&amp;lt;span&amp;nbsp;class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g,'&lt;span class="wikiEditor-tab"&gt;&lt;\/span&gt;').replace(/&amp;esc;esc;/g,'&amp;esc;');context.$content.html(html);context.oldHTML=html;context.history.push({'html':html});if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
534 -context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$(context.$iframe[0].contentWindow.document).bind('keydown',function(event){return context.fn.trigger('keydown',event);}).bind('paste',function(event){return context.fn.trigger('paste',event);}).bind('keyup mouseup paste cut encapsulateSelection',function(event){return context.fn.trigger('change',event);}).delayedBind(250,'keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));if(context.fallbackWindowOnBeforeUnload){return context.fallbackWindowOnBeforeUnload();}};}
 535+context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$('.wikiEditor-ui-loading').fadeOut('fast',function(){$(this).remove();});$(context.$iframe[0].contentWindow.document).bind('keydown',function(event){return context.fn.trigger('keydown',event);}).bind('paste',function(event){return context.fn.trigger('paste',event);}).bind('keyup paste mouseup cut encapsulateSelection',function(event){return context.fn.trigger('change',event);}).delayedBind(250,'keyup paste mouseup cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));if(context.fallbackWindowOnBeforeUnload){return context.fallbackWindowOnBeforeUnload();}};}
535536 var args=$.makeArray(arguments);if(args.length>0){var call=args.shift();if(call in context.api){context.api[call](context,typeof args[0]=='undefined'?{}:args[0]);}}
536537 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,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,data){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];}
537538 mw.usability.load(['$j.ui','$j.ui.dialog','$j.ui.draggable','$j.ui.resizable'],function(){for(module in $.wikiEditor.modules.dialogs.modules){var module=$.wikiEditor.modules.dialogs.modules[module];if($('#'+module.id).size()==0){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)

Follow-up revisions

RevisionCommit summaryAuthorDate
r62203followup to r62201 to insert the loading div before other DOM manipulationsadam22:07, 9 February 2010
r62248Making the fallback text on the temporary wikieditor cover translation friend...adam15:00, 10 February 2010

Comments

#Comment by Catrope (talk | contribs)   11:32, 10 February 2010
+				.append( $( '<span>Loading</span>' )

This should be made translatable.

Status & tagging log