r59152 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59151‎ | r59152 | r59153 >
Date:23:26, 16 November 2009
Author:adam
Status:resolved (Comments)
Tags:
Comment:
migrating the toc resizing to use jquery ui resizable
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/css/wikiEditor.toc.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.toc.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -22,16 +22,16 @@
2323 array( 'src' => 'css/wikiEditor.css', 'version' => 6 ),
2424 array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 7 ),
2525 array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 2 ),
26 - array( 'src' => 'css/wikiEditor.toc.css', 'version' => 16 ),
 26+ array( 'src' => 'css/wikiEditor.toc.css', 'version' => 18 ),
2727 array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ),
2828 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
2929 ),
3030 'combined' => array(
31 - array( 'src' => 'css/combined.css', 'version' => 24 ),
 31+ array( 'src' => 'css/combined.css', 'version' => 25 ),
3232 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3333 ),
3434 'minified' => array(
35 - array( 'src' => 'css/combined.min.css', 'version' => 24 ),
 35+ array( 'src' => 'css/combined.min.css', 'version' => 25 ),
3636 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3737 ),
3838 )
@@ -73,14 +73,14 @@
7474 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 17 ),
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 29 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ),
77 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 36 ),
 77+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 37 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 3 ),
7979 ),
8080 'combined' => array(
81 - array( 'src' => 'js/plugins.combined.js', 'version' => 78 ),
 81+ array( 'src' => 'js/plugins.combined.js', 'version' => 79 ),
8282 ),
8383 'minified' => array(
84 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 78 ),
 84+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 79 ),
8585 ),
8686 ),
8787 );
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.css
@@ -47,6 +47,7 @@
4848 }
4949 .wikiEditor-ui .wikiEditor-ui-right {
5050 float: right;
 51+ overflow:hidden;
5152 }
5253 .wikiEditor-wikitext {
5354 float: left;
@@ -61,4 +62,4 @@
6263 .wikiEditor-buttons {
6364 float: right;
6465 width: 50%;
65 -}
\ No newline at end of file
 66+} */
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css
@@ -1,11 +1,7 @@
22 /* wikiEditor toc module */
3 -
4 -.wikiEditor-ui-text {
5 - /*border-right: solid silver 1px;*/
6 -}
73 body.rtl .wikiEditor-ui-text {
8 - /*border-right: none;*/
9 - /*border-left: solid silver 1px;*/
 4+ border-right: none;
 5+ border-left: solid silver 1px;
106 }
117 .wikiEditor-ui-toc {
128 /* height and width are set dynamically */
@@ -23,6 +19,7 @@
2420 */
2521 }
2622 .wikiEditor-ui-toc ul {
 23+ border-left: solid silver 1px;
2724 padding: 0;
2825 margin: 0;
2926 list-style: none;
@@ -32,6 +29,10 @@
3330 list-style-type: none;
3431 width: 100%;
3532 }
 33+body.rtl .wikiEditor-ui-toc ul {
 34+ border-left: none;
 35+ border-right: solid silver 1px;
 36+}
3637 .tab-toc {
3738 /* Should match the toolbar */
3839 background-image: url(../images/wikiEditor/toolbar/base.png);
@@ -42,6 +43,8 @@
4344 line-height: 26px;
4445 padding-left: 1em;
4546 border-bottom: solid 1px silver;
 47+ white-space:nowrap;
 48+ overflow:hidden;
4649 }
4750 .tab-toc a{
4851 outline:none;
@@ -126,7 +129,8 @@
127130 }
128131
129132 /* Resizing Changes */
130 -#wikiEditor-ui-toc-resize-vertical{
 133+.wikiEditor-ui-toc-resize-vertical,
 134+.ui-resizable-w{
131135 width:4px;
132136 position:absolute;
133137 top:0;
@@ -134,22 +138,32 @@
135139 height:100%;
136140 cursor:ew-resize;
137141 }
138 -#wikiEditor-ui-toc-resize-grip{
 142+.wikiEditor-ui .wikiEditor-ui-right {
 143+ overflow:visible;
 144+}
 145+.wikiEditor-ui-right .ui-resizable-w{
 146+ left: 0px !important;
 147+}
 148+
 149+.wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip{
139150 width:5px;
140151 height:12px;
141152 padding:3px;
142153 position:absolute;
143154 top:7px;
144 - right:2px;
 155+ left:-12px !important;
145156 cursor:ew-resize;
146157 background:url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat;
147158 }
148 -#wikiEditor-ui-toolbar .tab-toc{
 159+.wikiEditor-ui-toolbar .tab-toc{
149160 float:right;
150161 margin:3px 16px 3px 3px;
151162 line-height:26px;
152163 }
153 -#wikiEditor-ui-text textarea{
 164+.wikiEditor-ui-text textarea{
154165 resize:none;
155166 }
156 -#wikiEditor-ui-text textarea:focus {outline:none;}
\ No newline at end of file
 167+.wikiEditor-ui-text textarea:focus {outline:none;}
 168+.wikiEditor-ui-right{
 169+ left: 0px !important;
 170+}
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -97,6 +97,7 @@
9898 }
9999 .wikiEditor-ui .wikiEditor-ui-right {
100100 float: right;
 101+ overflow:hidden;
101102 }
102103 .wikiEditor-wikitext {
103104 float: left;
@@ -111,7 +112,7 @@
112113 .wikiEditor-buttons {
113114 float: right;
114115 width: 50%;
115 -}/* wikiEditor dialogs module */
 116+} *//* wikiEditor dialogs module */
116117
117118 .ui-widget table {
118119 margin-top: 0.75em;
@@ -127,13 +128,9 @@
128129 z-index: 1099;
129130 }
130131 /* wikiEditor toc module */
131 -
132 -.wikiEditor-ui-text {
133 - /*border-right: solid silver 1px;*/
134 -}
135132 body.rtl .wikiEditor-ui-text {
136 - /*border-right: none;*/
137 - /*border-left: solid silver 1px;*/
 133+ border-right: none;
 134+ border-left: solid silver 1px;
138135 }
139136 .wikiEditor-ui-toc {
140137 /* height and width are set dynamically */
@@ -151,6 +148,7 @@
152149 */
153150 }
154151 .wikiEditor-ui-toc ul {
 152+ border-left: solid silver 1px;
155153 padding: 0;
156154 margin: 0;
157155 list-style: none;
@@ -160,6 +158,10 @@
161159 list-style-type: none;
162160 width: 100%;
163161 }
 162+body.rtl .wikiEditor-ui-toc ul {
 163+ border-left: none;
 164+ border-right: solid silver 1px;
 165+}
164166 .tab-toc {
165167 /* Should match the toolbar */
166168 background-image: url(../images/wikiEditor/toolbar/base.png);
@@ -170,6 +172,8 @@
171173 line-height: 26px;
172174 padding-left: 1em;
173175 border-bottom: solid 1px silver;
 176+ white-space:nowrap;
 177+ overflow:hidden;
174178 }
175179 .tab-toc a{
176180 outline:none;
@@ -254,7 +258,8 @@
255259 }
256260
257261 /* Resizing Changes */
258 -#wikiEditor-ui-toc-resize-vertical{
 262+.wikiEditor-ui-toc-resize-vertical,
 263+.ui-resizable-w{
259264 width:4px;
260265 position:absolute;
261266 top:0;
@@ -262,25 +267,36 @@
263268 height:100%;
264269 cursor:ew-resize;
265270 }
266 -#wikiEditor-ui-toc-resize-grip{
 271+.wikiEditor-ui .wikiEditor-ui-right {
 272+ overflow:visible;
 273+}
 274+.wikiEditor-ui-right .ui-resizable-w{
 275+ left: 0px !important;
 276+}
 277+
 278+.wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip{
267279 width:5px;
268280 height:12px;
269281 padding:3px;
270282 position:absolute;
271283 top:7px;
272 - right:2px;
 284+ left:-12px !important;
273285 cursor:ew-resize;
274286 background:url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat;
275287 }
276 -#wikiEditor-ui-toolbar .tab-toc{
 288+.wikiEditor-ui-toolbar .tab-toc{
277289 float:right;
278290 margin:3px 16px 3px 3px;
279291 line-height:26px;
280292 }
281 -#wikiEditor-ui-text textarea{
 293+.wikiEditor-ui-text textarea{
282294 resize:none;
283295 }
284 -#wikiEditor-ui-text textarea:focus {outline:none;}/* wikiEditor toolbar module */
 296+.wikiEditor-ui-text textarea:focus {outline:none;}
 297+.wikiEditor-ui-right{
 298+ left: 0px !important;
 299+}
 300+/* wikiEditor toolbar module */
285301
286302 .wikiEditor-ui-toolbar {
287303 position: relative;
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -90,6 +90,7 @@
9191 }
9292 .wikiEditor-ui .wikiEditor-ui-right{
9393 float:right;
 94+overflow:hidden;
9495 }
9596 .wikiEditor-wikitext{
9697 float:left;
@@ -104,7 +105,7 @@
105106 .wikiEditor-buttons{
106107 float:right;
107108 width:50%;
108 -}
 109+} */
109110 .ui-widget table{
110111 margin-top:0.75em;
111112 }
@@ -116,9 +117,9 @@
117118 div.suggestions{
118119 z-index:1099;
119120 }
120 -.wikiEditor-ui-text{
121 -}
122121 body.rtl .wikiEditor-ui-text{
 122+border-right:none;
 123+border-left:solid silver 1px;
123124 }
124125 .wikiEditor-ui-toc{
125126 padding:0;
@@ -134,6 +135,7 @@
135136 */
136137 }
137138 .wikiEditor-ui-toc ul{
 139+border-left:solid silver 1px;
138140 padding:0;
139141 margin:0;
140142 list-style:none;
@@ -142,6 +144,10 @@
143145 list-style-type:none;
144146 width:100%;
145147 }
 148+body.rtl .wikiEditor-ui-toc ul{
 149+border-left:none;
 150+border-right:solid silver 1px;
 151+}
146152 .tab-toc{
147153 background-image:url(../images/wikiEditor/toolbar/base.png);
148154 background-position:left top;
@@ -151,6 +157,8 @@
152158 line-height:26px;
153159 padding-left:1em;
154160 border-bottom:solid 1px silver;
 161+white-space:nowrap;
 162+overflow:hidden;
155163 }
156164 .tab-toc a{
157165 outline:none;
@@ -228,7 +236,8 @@
229237 .wikiEditor-ui-toc-collapse-closed{
230238 background:#f3f3f3 url(../images/wikiEditor/toc/open.png) 4px 50% no-repeat;
231239 }
232 -#wikiEditor-ui-toc-resize-vertical{
 240+.wikiEditor-ui-toc-resize-vertical,
 241+.ui-resizable-w{
233242 width:4px;
234243 position:absolute;
235244 top:0;
@@ -236,25 +245,34 @@
237246 height:100%;
238247 cursor:ew-resize;
239248 }
240 -#wikiEditor-ui-toc-resize-grip{
 249+.wikiEditor-ui .wikiEditor-ui-right{
 250+overflow:visible;
 251+}
 252+.wikiEditor-ui-right .ui-resizable-w{
 253+left:0px !important;
 254+}
 255+.wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip{
241256 width:5px;
242257 height:12px;
243258 padding:3px;
244259 position:absolute;
245260 top:7px;
246 -right:2px;
 261+left:-12px !important;
247262 cursor:ew-resize;
248263 background:url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat;
249264 }
250 -#wikiEditor-ui-toolbar .tab-toc{
 265+.wikiEditor-ui-toolbar .tab-toc{
251266 float:right;
252267 margin:3px 16px 3px 3px;
253268 line-height:26px;
254269 }
255 -#wikiEditor-ui-text textarea{
 270+.wikiEditor-ui-text textarea{
256271 resize:none;
257272 }
258 -#wikiEditor-ui-text textarea:focus{outline:none;}
 273+.wikiEditor-ui-text textarea:focus{outline:none;}
 274+.wikiEditor-ui-right{
 275+left:0px !important;
 276+}
259277 .wikiEditor-ui-toolbar{
260278 position:relative;
261279 width:100%;
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js
@@ -478,12 +478,15 @@
479479 $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) );
480480 var show = $section.css( 'display' ) == 'none';
481481 $previousSections = $section.parent().find( '.section:visible' );
 482+ var dH = $previousSections.outerHeight();
482483 $previousSections.css( 'position', 'absolute' );
483484 $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } );
484485 $(this).parent().parent().find( 'a' ).removeClass( 'current' );
485486 $sections.css('overflow', 'hidden');
486487 if ( show ) {
487488 $section.fadeIn( 'fast' );
 489+ dH = $section.outerHeight() - dH;
 490+ context.modules.$toc.animate({'height': "+="+dH}, $section.outerHeight() * 2);
488491 $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() {
489492 $(this).css('overflow', 'visible').css('height', 'auto');
490493 } );
@@ -493,6 +496,7 @@
494497 .animate( { 'height': 0 }, $section.outerHeight() * 2, function() {
495498 $(this).css('overflow', 'visible');
496499 } );
 500+ context.modules.$toc.animate({'height': "-="+$section.outerHeight()}, $section.outerHeight() * 2);
497501 }
498502 // Click tracking
499503 if($.trackAction != undefined){
@@ -562,33 +566,6 @@
563567 },
564568 build : function( context, config ) {
565569 var $tabs = $( '<div />' ).addClass( 'tabs' ).appendTo( context.modules.$toolbar );
566 - /*
567 - if( wgNavigableTOCCollapseEnable ) {
568 - // FIXME: This code is duplicated from the TOC plugin and doesn't belong here;
569 - // the TOC drag thingy should be in the TOC plugin instead
570 - // placeholder for drag control creation code
571 - $dragControl = $( '<div />' ).addClass( 'tab' ).attr( 'id', 'wikiEditor-ui-toc-resize-grip' )
572 - .append( '<a href="#" title="Drag to resize"></a>' )
573 - .mousedown( function() {
574 - context.modules.$toc
575 - .data( 'openWidth', $( '#wikiEditor-ui-toc' ).width() );
576 - $()
577 - .bind( 'mousemove', context, $.wikiEditor.modules.toc.fn.drag )
578 - .bind( 'mouseup', context, $.wikiEditor.modules.toc.fn.stopDrag );
579 - $( context.$iframe[0].contentWindow.document )
580 - .mousemove( function() {
581 - parent.top.$j().trigger( 'mousemove', e.pageX );
582 - return false;
583 - } )
584 - .mouseup( function() {
585 - parent.top.$j().trigger( 'mouseup' );
586 - return false;
587 - });
588 - return false;
589 - })
590 - context.modules.$toolbar.append( $dragControl );
591 - }
592 - */
593570 var $sections = $( '<div />' ).addClass( 'sections' ).appendTo( context.modules.$toolbar );
594571 context.modules.$toolbar.append( $( '<div />' ).css( 'clear', 'both' ) );
595572 var sectionQueue = [];
@@ -619,7 +596,12 @@
620597 s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) );
621598 var $section = s.$sections.find( '.section:visible' );
622599 if ( $section.size() ) {
623 - $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 );
 600+ $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function( ) {
 601+ context.modules.$toc.height(
 602+ context.$ui.find( '.wikiEditor-ui-left' )
 603+ .outerHeight() - context.$ui.find( '.tab-toc' ).outerHeight()
 604+ );
 605+ } );
624606 }
625607 }
626608 } );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -125,6 +125,8 @@
126126 * @param {Object} event Event object with context as data
127127 */
128128 collapse: function( event ) {
 129+ /*
 130+ FIXME: Needs rewritten to deal with all of the recent changes
129131 var context = event.data;
130132 var $toc = context.modules.$toc;
131133 if( !$toc.data( 'openWidth' ) ) {
@@ -142,6 +144,7 @@
143145 //.prev()
144146 //.animate( {'marginRight': '1px'}, 'fast', function() { $(this).css('marginRight', '-1px'); } );
145147 $.cookie( 'wikiEditor-' + context.instance + '-toc-width', 1 );
 148+ */
146149 return false;
147150 },
148151
@@ -151,6 +154,8 @@
152155 * @param {Object} event Event object with context as data
153156 */
154157 expand: function( event) {
 158+ /*
 159+ FIXME: Needs rewritten to deal with all of the recent changes
155160 var context = event.data;
156161 context.$ui.find( '.tab-toc' )
157162 .unbind( 'click', $.wikiEditor.modules.toc.fn.expand )
@@ -166,8 +171,18 @@
167172 //.prev()
168173 //.animate( { 'marginRight': context.modules.$toc.data( 'openWidth' ) }, 'fast' );
169174 $.cookie( 'wikiEditor-' + context.instance + '-toc-width', context.modules.$toc.data( 'openWidth' ) );
 175+ */
170176 return false;
171177 },
 178+ startResize: function ( event, ui ){
 179+
 180+ },
 181+ resize: function( event, ui ) {
 182+
 183+ },
 184+ stopResize: function( event, ui ){
 185+
 186+ },
172187 /**
173188 * Handles drag events on the contents module
174189 *
@@ -180,10 +195,13 @@
181196 // returned NaN in some cases. Even this seems to be buggy in that .offset().left
182197 // is sometimes 0.
183198 // FIXME: We should ditch the whole thing and use jQuery UI Resizable if possible
 199+
 200+
184201 if ( pageX )
185202 mR = pageX;
186203 else
187204 mR = e.pageX - context.$ui.find( '.wikiEditor.ui-left' ).offset().left;
 205+ console.log(mR);
188206 mR = context.$ui.find( '.wikiEditor-ui-left' ).width() - mR;
189207 if( mR < 26 || mR > context.$ui.find( '.wikiEditor-ui-left' ).width() - 250)
190208 return false;
@@ -274,10 +292,10 @@
275293 return list;
276294 }
277295 function buildCollapseBar() {
278 - // FIXME: Move this to a .css file
 296+ /* FIXME: Move this to a .css file
279297 context.modules.$toc.find( 'ul:first' ).css( 'width', '147px' )
280 - .css( 'margin-left', '19px' ).css( 'border-left', '1px solid #DDDDDD' );
281 - var $collapseBar = $( '<div />' )
 298+ .css( 'margin-left', '19px' ).css( 'border-left', '1px solid #DDDDDD' ); */
 299+ return $( '<div />' )
282300 .addClass( 'wikiEditor-ui-toc-collapse-open' )
283301 .attr( 'id', 'wikiEditor-ui-toc-collapse' )
284302 .data( 'openWidth', $.wikiEditor.modules.toc.defaultWidth )
@@ -307,29 +325,13 @@
308326 }
309327
310328 });
311 - return $collapseBar;
312329 }
313330 function buildResizeControls() {
314 - var $resizeControlVertical = $( '<div />' )
315 - .attr( 'id', 'wikiEditor-ui-toc-resize-vertical')
316 - .mousedown( function() {
317 - context.modules.$toc
318 - .data( 'openWidth', context.modules.$toc.width() );
319 - $()
320 - .bind( 'mousemove', context, $.wikiEditor.modules.toc.fn.drag )
321 - .bind( 'mouseup', context, $.wikiEditor.modules.toc.fn.stopDrag );
322 - $( context.$iframe[0].contentWindow.document )
323 - .mousemove( function( e ) {
324 - parent.top.$j().trigger( 'mousemove', e.pageX );
325 - return false;
326 - } )
327 - .bind( 'mouseup', function() {
328 - parent.top.$j().trigger( 'mouseup' );
329 - return false;
330 - });
331 - return false;
332 - });
333 -
 331+ context.$ui.find( '.ui-resizable-e' )
 332+ .removeClass( 'ui-resizable-e' )
 333+ .addClass( 'ui-resizable-w' )
 334+ .addClass( 'wikiEditor-ui-toc-resize-grip' )
 335+ .appendTo(context.$ui.find( '.wikiEditor-ui-right' ));
334336 var $collapseControl = $( '<div />' ).addClass( 'tab' ).addClass( 'tab-toc' )
335337 .append( '<a href="#" />' );
336338 if( $.cookie( 'wikiEditor-' + context.instance + '-toc-width' ) != 1 ) {
@@ -347,7 +349,7 @@
348350 }
349351 if ( context.initialWidth == 1 )
350352 $.wikiEditor.modules.toc.fn.collapse( { data: context } );
351 - return $resizeControlVertical;
 353+ return "";
352354 }
353355
354356 // Build outline from wikitext
@@ -409,11 +411,38 @@
410412 'wrapper': div } );
411413 }
412414 context.modules.$toc.html( buildList( structure ) );
413 -
414415 if(wgNavigableTOCResizable) {
 416+ context.$ui.find( '.wikiEditor-ui-right' )
 417+ .data( 'wikiEditor-ui-left', context.$ui.find( '.wikiEditor-ui-left' ))
 418+ .resizable( {handles: 'w,e', minWidth: 50,
 419+ start: function( e, ui ) {
 420+ $( '<div />' ).addClass( 'wikiEditor-ui-resize-mask' )
 421+ .css( 'position', 'absolute' )
 422+ .css( 'z-index', 2 )
 423+ .css( 'left', 0 ).css( 'top', 0 ).css( 'bottom', 0 ).css( 'right', 0 )
 424+ .appendTo(context.$ui.find( '.wikiEditor-ui-left' ));
 425+ },
 426+ resize: function( e, ui ) {
 427+ /*
 428+ * FIXME: Currently setting a heigh property on the resizable with ever mousemove event
 429+ * which breaks our height resizing code in jquery.wikiEditor.toolbar.js
 430+ */
 431+
 432+ // for some odd reason, ui.size.width seems a step ahead of what the *actual* width of
 433+ // the resizable is
 434+ $( this ).css( 'width' , ui.size.width )
 435+ .data( 'wikiEditor-ui-left' ).css( 'marginRight', ( -1 * ui.size.width ) )
 436+ .children( ).css( 'marginRight', ui.size.width );
 437+ },
 438+ stop: function ( e, ui ) {
 439+ context.$ui.find( '.wikiEditor-ui-resize-mask' ).remove();
 440+ if( ui.size.width < 70 ){
 441+ // collapse
 442+ }
 443+ }
 444+ });
 445+
415446 context.modules.$toc.append( buildResizeControls() );
416 - } else if(wgNavigableTOCCollapseEnable) {
417 - context.modules.$toc.append( buildCollapseBar() );
418447 }
419448 context.modules.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } );
420449 // Cache the outline for later use
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2390,12 +2390,15 @@
23912391 $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) );
23922392 var show = $section.css( 'display' ) == 'none';
23932393 $previousSections = $section.parent().find( '.section:visible' );
 2394+ var dH = $previousSections.outerHeight();
23942395 $previousSections.css( 'position', 'absolute' );
23952396 $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } );
23962397 $(this).parent().parent().find( 'a' ).removeClass( 'current' );
23972398 $sections.css('overflow', 'hidden');
23982399 if ( show ) {
23992400 $section.fadeIn( 'fast' );
 2401+ dH = $section.outerHeight() - dH;
 2402+ context.modules.$toc.animate({'height': "+="+dH}, $section.outerHeight() * 2);
24002403 $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() {
24012404 $(this).css('overflow', 'visible').css('height', 'auto');
24022405 } );
@@ -2405,6 +2408,7 @@
24062409 .animate( { 'height': 0 }, $section.outerHeight() * 2, function() {
24072410 $(this).css('overflow', 'visible');
24082411 } );
 2412+ context.modules.$toc.animate({'height': "-="+$section.outerHeight()}, $section.outerHeight() * 2);
24092413 }
24102414 // Click tracking
24112415 if($.trackAction != undefined){
@@ -2531,7 +2535,12 @@
25322536 s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) );
25332537 var $section = s.$sections.find( '.section:visible' );
25342538 if ( $section.size() ) {
2535 - $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 );
 2539+ $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function( ) {
 2540+ context.modules.$toc.height(
 2541+ context.$ui.find( '.wikiEditor-ui-left' )
 2542+ .outerHeight() - context.$ui.find( '.tab-toc' ).outerHeight()
 2543+ );
 2544+ } );
25362545 }
25372546 }
25382547 } );
@@ -2587,8 +2596,9 @@
25882597 .css( 'width', $.wikiEditor.modules.toc.defaultWidth )
25892598 .append( context.modules.$toc );
25902599 context.modules.$toc.height(
2591 - context.$ui.find( '.wikiEditor-ui-left' ).height()
 2600+ context.$ui.find( '.wikiEditor-ui-left' ).height() - 1
25922601 );
 2602+ context.modules.$toc
25932603 context.$ui.find( '.wikiEditor-ui-left' )
25942604 .css( 'marginRight', "-" + $.wikiEditor.modules.toc.defaultWidth )
25952605 .children()
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -146,7 +146,7 @@
147147 $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';}
148148 html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'encapsulate','options':{'pre':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'encapsulate','options':{'pre':character[1]}}};}
149149 if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('mousedown',function(e){if(e.button!==0&&(e.button&1)==0){return true;}
150 -var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':0},$section.outerHeight()*2,function(){$(this).css('overflow','visible');});}
 150+var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');var dH=$previousSections.outerHeight();$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');dH=$section.outerHeight()-dH;context.modules.$toc.animate({'height':"+="+dH},$section.outerHeight()*2);$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':0},$section.outerHeight()*2,function(){$(this).css('overflow','visible');});context.modules.$toc.animate({'height':"-="+$section.outerHeight()},$section.outerHeight()*2);}
151151 if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));}
152152 $.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);}).click(function(){return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}}
153153 break;case'booklet':var $pages=$('<div />').addClass('pages');var $index=$('<div />').addClass('index');if('pages'in section){for(page in section.pages){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,section.pages[page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,section.pages[page]));}}
@@ -154,9 +154,10 @@
155155 if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');}
156156 return $section;},updateBookletSelection:function(context,id,$pages,$index){var cookie='wikiEditor-'+context.instance+'-booklet-'+id+'-page';var selected=$.cookie(cookie);var $selectedIndex=$index.find('*[rel='+selected+']');if($selectedIndex.size()==0){selected=$index.children().eq(0).attr('rel');$.cookie(cookie,selected);}
157157 $pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.$toolbar);var $sections=$('<div />').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}}
158 -$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2);}}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},defaultWidth:'13em',fn:{create:function(context,config){if('$toc'in context.modules){return;}
 158+$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').outerHeight()-context.$ui.find('.tab-toc').outerHeight());});}}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},defaultWidth:'13em',fn:{create:function(context,config){if('$toc'in context.modules){return;}
159159 context.initialWidth=$.wikiEditor.modules.toc.defaultWidth;if(wgNavigableTOCResizable){if(!$.cookie('wikiEditor-'+context.instance+'-toc-width')){$.cookie('wikiEditor-'+context.instance+'-toc-width',$.wikiEditor.modules.toc.defaultWidth);}else{context.initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');}}
160 -var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);$.wikiEditor.modules.toc.fn.build(context,config);context.$textarea.delayedBind(250,'mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');context.$textarea.delayedBindCancel(250,'mouseup scrollToPosition focus keyup encapsulateSelection change');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
 160+var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()-1);context.modules.$toc
 161+context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);$.wikiEditor.modules.toc.fn.build(context,config);context.$textarea.delayedBind(250,'mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');context.$textarea.delayedBindCancel(250,'mouseup scrollToPosition focus keyup encapsulateSelection change');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
161162 section=Math.max(0,section);}
162163 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)
163164 context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight)

Follow-up revisions

RevisionCommit summaryAuthorDate
r59153Missed a javascriot revision bump on r59152adam23:27, 16 November 2009
r59305Fix from r59152mrzman03:01, 21 November 2009
r59367temporary fix for the calls to context.modules. in jquery.wikiEditor.toolbar....adam20:02, 23 November 2009

Comments

#Comment by Mormegil (talk | contribs)   17:37, 20 November 2009

That “*/” forgotten in wikiEditor.css is redundant [1]

#Comment by Mormegil (talk | contribs)   17:43, 20 November 2009

And you cannot copy&paste context.modules.$toc into jquery.wikiEditor.toolbar.js, you need to use $toolbar there.

#Comment by Mr.Z-man (talk | contribs)   18:48, 21 November 2009

Added fixme, this is broken if the navigable TOC isn't enabled

#Comment by Catrope (talk | contribs)   22:08, 22 November 2009

The toolbar module shouldn't assume the TOC's presence (at the very least check for it), and ideally TOC-specific code would be in the TOC module. Also, please give some thought as to where you're gonna place the show/hide link if the toolbar is indeed not present.

#Comment by Catrope (talk | contribs)   20:33, 12 February 2010

These issues were resolved later.

Status & tagging log