r59849 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59848‎ | r59849 | r59850 >
Date:20:58, 8 December 2009
Author:catrope
Status:ok
Tags:
Comment:
UsabilityInitiative: Recombine and bump style versions for r59838, r59839, r59841, r59843, r59844, r59845.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -74,15 +74,15 @@
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 35 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ),
78 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 46 ),
79 - array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 4 ),
 78+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 47 ),
 79+ array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 5 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ),
8181 ),
8282 'combined' => array(
83 - array( 'src' => 'js/plugins.combined.js', 'version' => 98 ),
 83+ array( 'src' => 'js/plugins.combined.js', 'version' => 99 ),
8484 ),
8585 'minified' => array(
86 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 98 ),
 86+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 99 ),
8787 ),
8888 ),
8989 );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2217,15 +2217,17 @@
22182218 },
22192219 function( data ) {
22202220 if (
2221 - data.parse == undefined ||
2222 - data.parse.text == undefined ||
2223 - data.parse.text['*'] == undefined
 2221+ typeof data.parse == 'undefined' ||
 2222+ typeof data.parse.text == 'undefined' ||
 2223+ typeof data.parse.text['*'] == 'undefined'
22242224 ) {
22252225 return;
22262226 }
22272227 context.modules.preview.previousText = wikitext;
22282228 context.$preview.find( '.wikiEditor-preview-loading' ).hide();
2229 - context.$preview.find( '.wikiEditor-preview-contents' ).html( data.parse.text['*'] );
 2229+ context.$preview.find( '.wikiEditor-preview-contents' )
 2230+ .html( data.parse.text['*'] )
 2231+ .find( 'a:not([href^=#])' ).attr( 'href', '#' );
22302232 },
22312233 'json'
22322234 );
@@ -2488,15 +2490,18 @@
24892491 var $this = $( this ), context = $this.data( 'context' ),
24902492 pT = $this.parent().position().top - 1;
24912493 $this.parent()
2492 - .css( 'position', 'absolute' )
2493 - .css( { 'left': 'auto', 'right': 0, 'top': pT } )
 2494+ .css( { 'marginTop': '1px', 'position': 'absolute', 'left': 'auto', 'right': 0, 'top': pT } )
24942495 .fadeOut( 'fast', function() {
24952496 $( this ).hide()
2496 - .css( 'width', '1px' );
 2497+ .css( { 'marginTop': '0', 'width': '1px' } );
24972498 context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).fadeIn( 'fast' );
24982499 } )
24992500 .prev()
2500 - .animate( { 'marginRight': '-1px' }, 'fast', function() { $( this ).css( 'marginRight', 0 ); } )
 2501+ .animate( { 'marginRight': '-1px' }, 'fast', function() {
 2502+ $( this ).css( 'marginRight', 0 );
 2503+ // Let the UI know things have moved around
 2504+ context.fn.trigger( 'resize' );
 2505+ } )
25012506 .children()
25022507 .animate( { 'marginRight': '1px' }, 'fast', function() { $( this ).css( 'marginRight', 0 ); } );
25032508 $.cookie( 'wikiEditor-' + context.instance + '-toc-width', 0 );
@@ -2515,9 +2520,12 @@
25162521 context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide();
25172522 $this.parent()
25182523 .show()
 2524+ .css( 'marginTop', '1px' )
25192525 .animate( { 'width' : openWidth }, 'fast', function() {
25202526 context.$content.trigger( 'mouseup' );
2521 - $( this ).css( { 'position': 'relative', 'right': 'auto', 'top': 'auto' } );
 2527+ $( this ).css( { 'marginTop': '0', 'position': 'relative', 'right': 'auto', 'top': 'auto' } );
 2528+ // Let the UI know things have moved around
 2529+ context.fn.trigger( 'resize' );
25222530 } )
25232531 .prev()
25242532 .animate( { 'marginRight': ( parseFloat( openWidth ) * -1 ) }, 'fast' )
@@ -2640,6 +2648,8 @@
26412649 $( this ).css( { 'width': ui.size.width, 'top': 'auto', 'height': 'auto' } )
26422650 .data( 'wikiEditor-ui-left' ).css( 'marginRight', ( -1 * ui.size.width ) )
26432651 .children().css( 'marginRight', ui.size.width );
 2652+ // Let the UI know things have moved around
 2653+ context.fn.trigger( 'resize' );
26442654 },
26452655 stop: function ( e, ui ) {
26462656 context.$ui.find( '.wikiEditor-ui-resize-mask' ).remove();
@@ -2650,6 +2660,8 @@
26512661 context.modules.$toc.data( 'openWidth', ui.size.width );
26522662 $.cookie( 'wikiEditor-' + context.instance + '-toc-width', ui.size.width );
26532663 }
 2664+ // Let the UI know things have moved around
 2665+ context.fn.trigger( 'resize' );
26542666 }
26552667 });
26562668 // Convert our east resize handle into a secondary west resize handle
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -125,8 +125,8 @@
126126 (wrapper.width()-oldWidth)/2);}
127127 $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(event){}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){return[];},mark:function(context,division,tokens){}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('preview'in context.modules){return;}
128128 context.modules.preview={'previousText':null};context.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previousText==wikitext){return;}
129 -context.$preview.find('.wikiEditor-preview-contents').empty();context.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(data.parse==undefined||data.parse.text==undefined||data.parse.text['*']==undefined){return;}
130 -context.modules.preview.previousText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']);},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-dialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-dialog-title',html:'\
 129+context.$preview.find('.wikiEditor-preview-contents').empty();context.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(typeof data.parse=='undefined'||typeof data.parse.text=='undefined'||typeof data.parse.text['*']=='undefined'){return;}
 130+context.modules.preview.previousText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').attr('href','#');},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-dialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-dialog-title',html:'\
131131 <div class="wikiEditor-dialog-copywarn"></div>\
132132 <div class="wikiEditor-dialog-editoptions">\
133133 <form>\
@@ -155,7 +155,7 @@
156156 section=Math.max(0,section);}
157157 var sectionLink=context.modules.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.$toc.offset().top;var scrollTop=context.modules.$toc.scrollTop();var divHeight=context.modules.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0)
158158 context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight)
159 -context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context'),pT=$this.parent().position().top-1;$this.parent().css('position','absolute').css({'left':'auto','right':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css('width','1px');context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');}).prev().animate({'marginRight':'-1px'},'fast',function(){$(this).css('marginRight',0);}).children().animate({'marginRight':'1px'},'fast',function(){$(this).css('marginRight',0);});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=context.modules.$toc.data('openWidth');context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();$this.parent().show().animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'position':'relative','right':'auto','top':'auto'});}).prev().animate({'marginRight':(parseFloat(openWidth)*-1)},'fast').children().animate({'marginRight':openWidth},'fast');$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.$toc.data('openWidth'));return false;},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;}
 159+context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context'),pT=$this.parent().position().top-1;$this.parent().css({'marginTop':'1px','position':'absolute','left':'auto','right':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css({'marginTop':'0','width':'1px'});context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');}).prev().animate({'marginRight':'-1px'},'fast',function(){$(this).css('marginRight',0);context.fn.trigger('resize');}).children().animate({'marginRight':'1px'},'fast',function(){$(this).css('marginRight',0);});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=context.modules.$toc.data('openWidth');context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();$this.parent().show().css('marginTop','1px').animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'marginTop':'0','position':'relative','right':'auto','top':'auto'});context.fn.trigger('resize');}).prev().animate({'marginRight':(parseFloat(openWidth)*-1)},'fast').children().animate({'marginRight':openWidth},'fast');$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.$toc.data('openWidth'));return false;},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;}
160160 sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}}
161161 return sections;}
162162 function buildList(structure){var list=$('<ul />');for(i in structure){var div=$('<div />').addClass('section-'+structure[i].index).data('wrapper',structure[i].wrapper).click(function(event){context.fn.scrollToTop($(this).data('wrapper'));context.$textarea.textSelection('setSelection',{'start':0,'startContainer':$(this).data('wrapper')});if(typeof $.trackAction!='undefined')
@@ -164,7 +164,8 @@
165165 list.append(item);}
166166 return list;}
167167 function buildCollapseControls(){var $collapseControl=$('<div />'),$expandControl=$('<div />');$collapseControl.addClass('tab').addClass('tab-toc').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.$toc.trigger('collapse.wikiEditor-toc');return false;}).find('a').text(gM('wikieditor-toc-hide'));$expandControl.addClass('wikiEditor-ui-toc-expandControl').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.$toc.trigger('expand.wikiEditor-toc');return false;}).hide().find('a').text(gM('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);}
168 -function buildResizeControls(){context.$ui.data('resizableDone',true).find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',preventPositionLeftChange:true,minWidth:50,start:function(e,ui){var $this=$(this);$('<div />').addClass('wikiEditor-ui-resize-mask').css({'position':'absolute','z-index':2,'left':0,'top':0,'bottom':0,'right':0}).appendTo(context.$ui.find('.wikiEditor-ui-left'));$this.resizable('option','maxWidth',$this.parent().width()-450);},resize:function(e,ui){$(this).css({'width':ui.size.width,'top':'auto','height':'auto'}).data('wikiEditor-ui-left').css('marginRight',(-1*ui.size.width)).children().css('marginRight',ui.size.width);},stop:function(e,ui){context.$ui.find('.wikiEditor-ui-resize-mask').remove();context.$content.trigger('mouseup');if(ui.size.width<parseFloat($.wikiEditor.modules.toc.minimumWidth)){context.modules.$toc.trigger('collapse');}else{context.modules.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);}}});context.$ui.find('.ui-resizable-e').removeClass('ui-resizable-e').addClass('ui-resizable-w').addClass('wikiEditor-ui-toc-resize-grip');context.modules.$toc.bind('collapse.wikiEditor-toc',$.wikiEditor.modules.toc.fn.collapse).bind('expand.wikiEditor-toc',$.wikiEditor.modules.toc.fn.expand);context.modules.$toc.data('openWidth',$.wikiEditor.modules.toc.defaultWidth);if($.cookie('wikiEditor-'+context.instance+'-toc-width')==0){context.modules.$toc.trigger('collapse.wikiEditor-toc',{data:context});}else if($.cookie('wikiEditor-'+context.instance+'-toc-width')>0){var initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');if(initialWidth<parseFloat($.wikiEditor.modules.toc.minimumWidth))
 168+function buildResizeControls(){context.$ui.data('resizableDone',true).find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',preventPositionLeftChange:true,minWidth:50,start:function(e,ui){var $this=$(this);$('<div />').addClass('wikiEditor-ui-resize-mask').css({'position':'absolute','z-index':2,'left':0,'top':0,'bottom':0,'right':0}).appendTo(context.$ui.find('.wikiEditor-ui-left'));$this.resizable('option','maxWidth',$this.parent().width()-450);},resize:function(e,ui){$(this).css({'width':ui.size.width,'top':'auto','height':'auto'}).data('wikiEditor-ui-left').css('marginRight',(-1*ui.size.width)).children().css('marginRight',ui.size.width);context.fn.trigger('resize');},stop:function(e,ui){context.$ui.find('.wikiEditor-ui-resize-mask').remove();context.$content.trigger('mouseup');if(ui.size.width<parseFloat($.wikiEditor.modules.toc.minimumWidth)){context.modules.$toc.trigger('collapse');}else{context.modules.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);}
 169+context.fn.trigger('resize');}});context.$ui.find('.ui-resizable-e').removeClass('ui-resizable-e').addClass('ui-resizable-w').addClass('wikiEditor-ui-toc-resize-grip');context.modules.$toc.bind('collapse.wikiEditor-toc',$.wikiEditor.modules.toc.fn.collapse).bind('expand.wikiEditor-toc',$.wikiEditor.modules.toc.fn.expand);context.modules.$toc.data('openWidth',$.wikiEditor.modules.toc.defaultWidth);if($.cookie('wikiEditor-'+context.instance+'-toc-width')==0){context.modules.$toc.trigger('collapse.wikiEditor-toc',{data:context});}else if($.cookie('wikiEditor-'+context.instance+'-toc-width')>0){var initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');if(initialWidth<parseFloat($.wikiEditor.modules.toc.minimumWidth))
169170 initialWidth=parseFloat($.wikiEditor.modules.toc.minimumWidth)+1;context.modules.$toc.data('openWidth',initialWidth+'px');context.$ui.find('.wikiEditor-ui-right').css('width',initialWidth+'px');context.$ui.find('.wikiEditor-ui-left').css('marginRight',(parseFloat(initialWidth)*-1)+'px').children().css('marginRight',initialWidth+'px');}}
170171 var outline=[],h=0;function traverseTextNodes(){if(this.nodeName!='#text'){$(this.childNodes).each(traverseTextNodes);return;}
171172 var text=this.nodeValue;var p=this;while(!p.previousSibling)

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59838Added resize triggers durring user-interaction with TOC resize handles.tparscal18:58, 8 December 2009
r59839Added UI resize triggers to expand and collapse actions on the TOC.tparscal19:07, 8 December 2009
r59841Fixed 1px wiggling effect on expand and collapse of TOC.tparscal19:25, 8 December 2009
r59843Made links in preview all link to # - to disable links.tparscal19:40, 8 December 2009
r59844Fixed unsafe testing for undefined.tparscal19:44, 8 December 2009
r59845Made table of contents links in preview still work.tparscal19:57, 8 December 2009

Status & tagging log