Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -15,13 +15,13 @@ |
16 | 16 | array( 'src' => 'Modules/Highlight/Highlight.js', 'version' => 1 ), |
17 | 17 | array( 'src' => 'Modules/Preview/Preview.js', 'version' => 1 ), |
18 | 18 | array( 'src' => 'Modules/Toc/Toc.js', 'version' => 1 ), |
19 | | - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 5 ), |
| 19 | + array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 6 ), |
20 | 20 | ), |
21 | 21 | 'combined' => array( |
22 | | - array( 'src' => 'WikiEditor.combined.js', 'version' => 3 ), |
| 22 | + array( 'src' => 'WikiEditor.combined.js', 'version' => 4 ), |
23 | 23 | ), |
24 | 24 | 'minified' => array( |
25 | | - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 3 ), |
| 25 | + array( 'src' => 'WikiEditor.combined.min.js', 'version' => 4 ), |
26 | 26 | ), |
27 | 27 | ); |
28 | 28 | static $modules = array( |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -2642,10 +2642,14 @@ |
2643 | 2643 | */ |
2644 | 2644 | collapse: function( event ) { |
2645 | 2645 | var $this = $( this ), context = $this.data('context'); |
| 2646 | + var pT = $this.parent().position().top - 1; |
2646 | 2647 | $this.parent() |
2647 | | - .animate( { 'width' : '1px' }, 'fast', function() { |
2648 | | - $(this).hide(); |
2649 | | - context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).show( 'fast' ); |
| 2648 | + .css( 'position', 'absolute' ) |
| 2649 | + .css( {'left': 'auto', 'right': 0, 'top': pT}) |
| 2650 | + .fadeOut( 'fast', function() { |
| 2651 | + $(this).hide() |
| 2652 | + .css( 'width', '1px' ); |
| 2653 | + context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).fadeIn( 'fast' ); |
2650 | 2654 | } ) |
2651 | 2655 | .prev() |
2652 | 2656 | .animate( { 'marginRight': '-1px'}, 'fast', function() { $(this).css( 'marginRight', 0 ); } ) |
— | — | @@ -2665,10 +2669,13 @@ |
2666 | 2670 | */ |
2667 | 2671 | expand: function( event) { |
2668 | 2672 | var $this = $( this ), context = $this.data('context'); |
2669 | | - context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide( 'fast' ); |
| 2673 | + context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide(); |
2670 | 2674 | $this.parent() |
2671 | 2675 | .show() |
2672 | | - .animate( { 'width' : '13em' }, 'fast' ) |
| 2676 | + .animate( { 'width' : '13em' }, 'fast', function() { |
| 2677 | + $(this) |
| 2678 | + .css( { 'position': 'relative', 'right': 'auto', 'top': 'auto' }); |
| 2679 | + } ) |
2673 | 2680 | .prev() |
2674 | 2681 | .animate( { 'marginRight': '-13em'}, 'fast' ) |
2675 | 2682 | .children() |
— | — | @@ -2857,13 +2864,16 @@ |
2858 | 2865 | if(wgNavigableTOCResizable) { |
2859 | 2866 | context.$ui.find( '.wikiEditor-ui-right' ) |
2860 | 2867 | .data( 'wikiEditor-ui-left', context.$ui.find( '.wikiEditor-ui-left' )) |
2861 | | - .resizable( {handles: 'w,e', minWidth: 50, |
| 2868 | + .resizable( {handles: 'w,e', dontScrewWithLeft: true, minWidth: 50, |
2862 | 2869 | start: function( e, ui ) { |
| 2870 | + $this = $( this ); |
| 2871 | + // Toss a transparent cover over our iframe |
2863 | 2872 | $( '<div />' ).addClass( 'wikiEditor-ui-resize-mask' ) |
2864 | 2873 | .css( 'position', 'absolute' ) |
2865 | 2874 | .css( 'z-index', 2 ) |
2866 | 2875 | .css( 'left', 0 ).css( 'top', 0 ).css( 'bottom', 0 ).css( 'right', 0 ) |
2867 | 2876 | .appendTo(context.$ui.find( '.wikiEditor-ui-left' )); |
| 2877 | + $this.resizable( 'option', 'maxWidth', $this.parent().width() - 450 ); |
2868 | 2878 | }, |
2869 | 2879 | resize: function( e, ui ) { |
2870 | 2880 | /* |
— | — | @@ -2873,14 +2883,14 @@ |
2874 | 2884 | |
2875 | 2885 | // for some odd reason, ui.size.width seems a step ahead of what the *actual* width of |
2876 | 2886 | // the resizable is |
2877 | | - $( this ).css( 'width' , ui.size.width ) |
| 2887 | + $( this ).css( { 'width': ui.size.width, 'top': 'auto' } ) |
2878 | 2888 | .data( 'wikiEditor-ui-left' ).css( 'marginRight', ( -1 * ui.size.width ) ) |
2879 | 2889 | .children( ).css( 'marginRight', ui.size.width ); |
2880 | 2890 | }, |
2881 | 2891 | stop: function ( e, ui ) { |
2882 | 2892 | context.$ui.find( '.wikiEditor-ui-resize-mask' ).remove(); |
2883 | 2893 | if( ui.size.width < 70 ){ |
2884 | | - // collapse |
| 2894 | + context.modules.$toc.trigger( 'collapse' ); |
2885 | 2895 | } |
2886 | 2896 | } |
2887 | 2897 | }); |
— | — | @@ -2894,7 +2904,18 @@ |
2895 | 2905 | } |
2896 | 2906 | } |
2897 | 2907 | |
2898 | | -}; } ) ( jQuery ); |
| 2908 | +}; |
| 2909 | + |
| 2910 | +/* |
| 2911 | + * Extending resizable to allow west resizing without altering the left position attribute |
| 2912 | + */ |
| 2913 | +$.ui.plugin.add("resizable", "dontScrewWithLeft", { |
| 2914 | + resize: function(event, ui){ |
| 2915 | + $(this).data("resizable").position.left=0; |
| 2916 | + } |
| 2917 | +}); |
| 2918 | + |
| 2919 | +} ) ( jQuery ); |
2899 | 2920 | /* Preview module for wikiEditor */ |
2900 | 2921 | ( function( $ ) { $.wikiEditor.modules.preview = { |
2901 | 2922 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | section=Math.max(0,section);} |
161 | 161 | 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) |
162 | 162 | context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |
163 | | -context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context');$this.parent().animate({'width':'1px'},'fast',function(){$(this).hide();context.$ui.find('.wikiEditor-ui-toc-expandControl').show('fast');}).prev().animate({'marginRight':'-1px'},'fast',function(){$(this).css('marginRight',0);}).children().animate({'marginRight':'1px'},'fast',function(){$(this).css('marginRight',0);});return false;},expand:function(event){var $this=$(this),context=$this.data('context');context.$ui.find('.wikiEditor-ui-toc-expandControl').hide('fast');$this.parent().show().animate({'width':'13em'},'fast').prev().animate({'marginRight':'-13em'},'fast').children().animate({'marginRight':'13em'},'fast');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;} |
| 163 | +context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context');var 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);});return false;},expand:function(event){var $this=$(this),context=$this.data('context');context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();$this.parent().show().animate({'width':'13em'},'fast',function(){$(this).css({'position':'relative','right':'auto','top':'auto'});}).prev().animate({'marginRight':'-13em'},'fast').children().animate({'marginRight':'13em'},'fast');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;} |
164 | 164 | sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}} |
165 | 165 | return sections;} |
166 | 166 | function buildList(structure){var list=$('<ul />');for(i in structure){var div=$('<div />').addClass('section-'+structure[i].index).data('wrapper',structure[i].wrapper).mousedown(function(event){context.fn.scrollToTop($(this).data('wrapper'));if(typeof $.trackAction!='undefined') |
— | — | @@ -181,8 +181,8 @@ |
182 | 182 | if(nLevel<=0){nLevel=1;} |
183 | 183 | outline[i].nLevel=nLevel;lastLevel=outline[i].level;} |
184 | 184 | var structure=buildStructure(outline);if($('input[name=wpSection]').val()==''){var div=$j('<div />').addClass('wikiEditor-toc-start').hide().prependTo(context.$content);structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'wrapper':div});} |
185 | | -context.modules.$toc.html(buildList(structure));if(wgNavigableTOCResizable){context.$ui.find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',minWidth:50,start:function(e,ui){$('<div />').addClass('wikiEditor-ui-resize-mask').css('position','absolute').css('z-index',2).css('left',0).css('top',0).css('bottom',0).css('right',0).appendTo(context.$ui.find('.wikiEditor-ui-left'));},resize:function(e,ui){$(this).css('width',ui.size.width).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();if(ui.size.width<70){}}});context.modules.$toc.append(buildResizeControls());buildCollapseControls();} |
186 | | -context.modules.$toc.find('div').autoEllipse({'position':'right','tooltip':true});context.data.outline=outline;}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){mvJsLoader.doLoad(['$j.ui','$j.ui.tabs'],function(){if('preview'in context.modules) |
| 185 | +context.modules.$toc.html(buildList(structure));if(wgNavigableTOCResizable){context.$ui.find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',dontScrewWithLeft:true,minWidth:50,start:function(e,ui){$this=$(this);$('<div />').addClass('wikiEditor-ui-resize-mask').css('position','absolute').css('z-index',2).css('left',0).css('top',0).css('bottom',0).css('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'}).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();if(ui.size.width<70){context.modules.$toc.trigger('collapse');}}});context.modules.$toc.append(buildResizeControls());buildCollapseControls();} |
| 186 | +context.modules.$toc.find('div').autoEllipse({'position':'right','tooltip':true});context.data.outline=outline;}}};$.ui.plugin.add("resizable","dontScrewWithLeft",{resize:function(event,ui){$(this).data("resizable").position.left=0;}});})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){mvJsLoader.doLoad(['$j.ui','$j.ui.tabs'],function(){if('preview'in context.modules) |
187 | 187 | return;var iframeHTML=context.$content.html();context.$ui.wrapInner($('<div />').addClass('wikiEditor-tab-edit').attr('id','wikiEditor-'+context.instance+'-tab-edit')).wrapInner($('<div />').addClass('wikiEditor-tabs'));var tabList=context.$ui.children();var editTab=tabList.children();var loadingMsg=gM('wikieditor-preview-loading');var previewTab=$('<div />').addClass('wikiEditor-tab-preview').attr('id','wikiEditor-'+context.instance+'-tab-preview').append($('<div />').addClass('wikiEditor-preview-spinner').append($('<img />').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','alt':loadingMsg,'title':loadingMsg}))).append($('<div />').addClass('wikiEditor-preview-contents')).insertAfter(editTab);var dialogID='wikiEditor-'+context.instance+'-savedialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-preview-savedialog-title',html:'\ |
188 | 188 | <div class="wikiEditor-savedialog-copywarn"></div>\ |
189 | 189 | <div class="wikiEditor-savedialog-editoptions">\ |