Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -74,15 +74,15 @@ |
75 | 75 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 35 ), |
77 | 77 | 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 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ), |
81 | 81 | ), |
82 | 82 | 'combined' => array( |
83 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 98 ), |
| 83 | + array( 'src' => 'js/plugins.combined.js', 'version' => 99 ), |
84 | 84 | ), |
85 | 85 | 'minified' => array( |
86 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 98 ), |
| 86 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 99 ), |
87 | 87 | ), |
88 | 88 | ), |
89 | 89 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -2217,15 +2217,17 @@ |
2218 | 2218 | }, |
2219 | 2219 | function( data ) { |
2220 | 2220 | 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' |
2224 | 2224 | ) { |
2225 | 2225 | return; |
2226 | 2226 | } |
2227 | 2227 | context.modules.preview.previousText = wikitext; |
2228 | 2228 | 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', '#' ); |
2230 | 2232 | }, |
2231 | 2233 | 'json' |
2232 | 2234 | ); |
— | — | @@ -2488,15 +2490,18 @@ |
2489 | 2491 | var $this = $( this ), context = $this.data( 'context' ), |
2490 | 2492 | pT = $this.parent().position().top - 1; |
2491 | 2493 | $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 } ) |
2494 | 2495 | .fadeOut( 'fast', function() { |
2495 | 2496 | $( this ).hide() |
2496 | | - .css( 'width', '1px' ); |
| 2497 | + .css( { 'marginTop': '0', 'width': '1px' } ); |
2497 | 2498 | context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).fadeIn( 'fast' ); |
2498 | 2499 | } ) |
2499 | 2500 | .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 | + } ) |
2501 | 2506 | .children() |
2502 | 2507 | .animate( { 'marginRight': '1px' }, 'fast', function() { $( this ).css( 'marginRight', 0 ); } ); |
2503 | 2508 | $.cookie( 'wikiEditor-' + context.instance + '-toc-width', 0 ); |
— | — | @@ -2515,9 +2520,12 @@ |
2516 | 2521 | context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide(); |
2517 | 2522 | $this.parent() |
2518 | 2523 | .show() |
| 2524 | + .css( 'marginTop', '1px' ) |
2519 | 2525 | .animate( { 'width' : openWidth }, 'fast', function() { |
2520 | 2526 | 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' ); |
2522 | 2530 | } ) |
2523 | 2531 | .prev() |
2524 | 2532 | .animate( { 'marginRight': ( parseFloat( openWidth ) * -1 ) }, 'fast' ) |
— | — | @@ -2640,6 +2648,8 @@ |
2641 | 2649 | $( this ).css( { 'width': ui.size.width, 'top': 'auto', 'height': 'auto' } ) |
2642 | 2650 | .data( 'wikiEditor-ui-left' ).css( 'marginRight', ( -1 * ui.size.width ) ) |
2643 | 2651 | .children().css( 'marginRight', ui.size.width ); |
| 2652 | + // Let the UI know things have moved around |
| 2653 | + context.fn.trigger( 'resize' ); |
2644 | 2654 | }, |
2645 | 2655 | stop: function ( e, ui ) { |
2646 | 2656 | context.$ui.find( '.wikiEditor-ui-resize-mask' ).remove(); |
— | — | @@ -2650,6 +2660,8 @@ |
2651 | 2661 | context.modules.$toc.data( 'openWidth', ui.size.width ); |
2652 | 2662 | $.cookie( 'wikiEditor-' + context.instance + '-toc-width', ui.size.width ); |
2653 | 2663 | } |
| 2664 | + // Let the UI know things have moved around |
| 2665 | + context.fn.trigger( 'resize' ); |
2654 | 2666 | } |
2655 | 2667 | }); |
2656 | 2668 | // Convert our east resize handle into a secondary west resize handle |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -125,8 +125,8 @@ |
126 | 126 | (wrapper.width()-oldWidth)/2);} |
127 | 127 | $(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;} |
128 | 128 | 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:'\ |
131 | 131 | <div class="wikiEditor-dialog-copywarn"></div>\ |
132 | 132 | <div class="wikiEditor-dialog-editoptions">\ |
133 | 133 | <form>\ |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | section=Math.max(0,section);} |
157 | 157 | 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) |
158 | 158 | 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;} |
160 | 160 | sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}} |
161 | 161 | return sections;} |
162 | 162 | 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 @@ |
165 | 165 | list.append(item);} |
166 | 166 | return list;} |
167 | 167 | 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)) |
169 | 170 | 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');}} |
170 | 171 | var outline=[],h=0;function traverseTextNodes(){if(this.nodeName!='#text'){$(this.childNodes).each(traverseTextNodes);return;} |
171 | 172 | var text=this.nodeValue;var p=this;while(!p.previousSibling) |