Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css |
— | — | @@ -10,6 +10,8 @@ |
11 | 11 | float: left; |
12 | 12 | width: 100%; |
13 | 13 | clear: both; |
| 14 | + height: 0; |
| 15 | + overflow: hidden; |
14 | 16 | } |
15 | 17 | body.rtl .wikiEditor-ui-toolbar .sections { |
16 | 18 | float: right; |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -167,6 +167,8 @@ |
168 | 168 | float: left; |
169 | 169 | width: 100%; |
170 | 170 | clear: both; |
| 171 | + height: 0; |
| 172 | + overflow: hidden; |
171 | 173 | } |
172 | 174 | body.rtl .wikiEditor-ui-toolbar .sections { |
173 | 175 | float: right; |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -151,6 +151,8 @@ |
152 | 152 | float:left; |
153 | 153 | width:100%; |
154 | 154 | clear:both; |
| 155 | +height:0; |
| 156 | +overflow:hidden; |
155 | 157 | } |
156 | 158 | body.rtl .wikiEditor-ui-toolbar .sections{ |
157 | 159 | float:right; |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js |
— | — | @@ -440,44 +440,47 @@ |
441 | 441 | } |
442 | 442 | }, |
443 | 443 | buildTab : function( context, id, section ) { |
444 | | - var selected = $ |
445 | | - .cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
| 444 | + var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
446 | 445 | return $( '<span />' ) |
447 | | - .attr( { 'class' : 'tab tab-' + id, 'rel' : id } ) |
448 | | - .append( |
449 | | - $( '<a />' ) |
450 | | - .addClass( selected == id ? 'current' : null ) |
451 | | - .attr( 'href', '#' ) |
452 | | - .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
453 | | - .data( 'context', context ) |
454 | | - .click( function() { |
455 | | - var $section = |
456 | | - $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
457 | | - $(this).blur(); |
458 | | - var show = $section.css( 'display' ) == 'none'; |
459 | | - $section.parent().children().hide("fast"); |
460 | | - $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
461 | | - if ( show ) { |
462 | | - $section.show("fast"); |
463 | | - $(this).addClass( 'current' ); |
464 | | - } |
465 | | - |
466 | | - //click tracking |
467 | | - if($.trackAction != undefined){ |
468 | | - $.trackAction($section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); |
469 | | - } |
470 | | - |
471 | | - $.cookie( |
472 | | - 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
473 | | - show ? $section.attr( 'rel' ) : null |
474 | | - ); |
475 | | - return false; |
476 | | - } ) |
477 | | - ); |
| 446 | + .attr( { 'class' : 'tab tab-' + id, 'rel' : id } ) |
| 447 | + .append( |
| 448 | + $( '<a />' ) |
| 449 | + .addClass( selected == id ? 'current' : null ) |
| 450 | + .attr( 'href', '#' ) |
| 451 | + .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
| 452 | + .data( 'context', context ) |
| 453 | + .click( function() { |
| 454 | + var $sections = $(this).data( 'context' ).$ui.find( '.sections' ); |
| 455 | + var $section = |
| 456 | + $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
| 457 | + $(this).blur(); |
| 458 | + var show = $section.css( 'display' ) == 'none'; |
| 459 | + $previousSections = $section.parent().find( '.section:visible' ); |
| 460 | + $previousSections.css( 'position', 'absolute' ); |
| 461 | + $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } ); |
| 462 | + $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
| 463 | + if ( show ) { |
| 464 | + $section.fadeIn( 'fast' ); |
| 465 | + $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 466 | + $(this).addClass( 'current' ); |
| 467 | + } else { |
| 468 | + $sections.animate( { 'height': 0 } ); |
| 469 | + } |
| 470 | + // Click tracking |
| 471 | + if($.trackAction != undefined){ |
| 472 | + $.trackAction($section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); |
| 473 | + } |
| 474 | + // |
| 475 | + $.cookie( |
| 476 | + 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
| 477 | + show ? $section.attr( 'rel' ) : null |
| 478 | + ); |
| 479 | + return false; |
| 480 | + } ) |
| 481 | + ); |
478 | 482 | }, |
479 | 483 | buildSection : function( context, id, section ) { |
480 | | - var selected = $ |
481 | | - .cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
| 484 | + var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
482 | 485 | var $section; |
483 | 486 | switch ( section.type ) { |
484 | 487 | case 'toolbar': |
— | — | @@ -510,7 +513,8 @@ |
511 | 514 | break; |
512 | 515 | } |
513 | 516 | if ( $section !== null && id !== 'main' ) { |
514 | | - $section.css( 'display', selected == id ? 'block' : 'none' ); |
| 517 | + var show = selected == id; |
| 518 | + $section.css( 'display', show ? 'block' : 'none' ); |
515 | 519 | } |
516 | 520 | return $section; |
517 | 521 | }, |
— | — | @@ -558,6 +562,10 @@ |
559 | 563 | }, |
560 | 564 | 'loop' : function( i, s ) { |
561 | 565 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
| 566 | + var $section = s.$sections.find( '.section:visible' ); |
| 567 | + if ( $section.size() ) { |
| 568 | + $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 569 | + } |
562 | 570 | } |
563 | 571 | } ); |
564 | 572 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1960,44 +1960,47 @@ |
1961 | 1961 | } |
1962 | 1962 | }, |
1963 | 1963 | buildTab : function( context, id, section ) { |
1964 | | - var selected = $ |
1965 | | - .cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
| 1964 | + var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
1966 | 1965 | return $( '<span />' ) |
1967 | | - .attr( { 'class' : 'tab tab-' + id, 'rel' : id } ) |
1968 | | - .append( |
1969 | | - $( '<a />' ) |
1970 | | - .addClass( selected == id ? 'current' : null ) |
1971 | | - .attr( 'href', '#' ) |
1972 | | - .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
1973 | | - .data( 'context', context ) |
1974 | | - .click( function() { |
1975 | | - var $section = |
1976 | | - $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
1977 | | - $(this).blur(); |
1978 | | - var show = $section.css( 'display' ) == 'none'; |
1979 | | - $section.parent().children().hide("fast"); |
1980 | | - $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
1981 | | - if ( show ) { |
1982 | | - $section.show("fast"); |
1983 | | - $(this).addClass( 'current' ); |
1984 | | - } |
1985 | | - |
1986 | | - //click tracking |
1987 | | - if($.trackAction != undefined){ |
1988 | | - $.trackAction($section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); |
1989 | | - } |
1990 | | - |
1991 | | - $.cookie( |
1992 | | - 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
1993 | | - show ? $section.attr( 'rel' ) : null |
1994 | | - ); |
1995 | | - return false; |
1996 | | - } ) |
1997 | | - ); |
| 1966 | + .attr( { 'class' : 'tab tab-' + id, 'rel' : id } ) |
| 1967 | + .append( |
| 1968 | + $( '<a />' ) |
| 1969 | + .addClass( selected == id ? 'current' : null ) |
| 1970 | + .attr( 'href', '#' ) |
| 1971 | + .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
| 1972 | + .data( 'context', context ) |
| 1973 | + .click( function() { |
| 1974 | + var $sections = $(this).data( 'context' ).$ui.find( '.sections' ); |
| 1975 | + var $section = |
| 1976 | + $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
| 1977 | + $(this).blur(); |
| 1978 | + var show = $section.css( 'display' ) == 'none'; |
| 1979 | + $previousSections = $section.parent().find( '.section:visible' ); |
| 1980 | + $previousSections.css( 'position', 'absolute' ); |
| 1981 | + $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } ); |
| 1982 | + $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
| 1983 | + if ( show ) { |
| 1984 | + $section.fadeIn( 'fast' ); |
| 1985 | + $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 1986 | + $(this).addClass( 'current' ); |
| 1987 | + } else { |
| 1988 | + $sections.animate( { 'height': 0 } ); |
| 1989 | + } |
| 1990 | + // Click tracking |
| 1991 | + if($.trackAction != undefined){ |
| 1992 | + $.trackAction($section.attr('rel') + '.' + ( show ? 'show': 'hide' ) ); |
| 1993 | + } |
| 1994 | + // |
| 1995 | + $.cookie( |
| 1996 | + 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
| 1997 | + show ? $section.attr( 'rel' ) : null |
| 1998 | + ); |
| 1999 | + return false; |
| 2000 | + } ) |
| 2001 | + ); |
1998 | 2002 | }, |
1999 | 2003 | buildSection : function( context, id, section ) { |
2000 | | - var selected = $ |
2001 | | - .cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
| 2004 | + var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
2002 | 2005 | var $section; |
2003 | 2006 | switch ( section.type ) { |
2004 | 2007 | case 'toolbar': |
— | — | @@ -2030,7 +2033,8 @@ |
2031 | 2034 | break; |
2032 | 2035 | } |
2033 | 2036 | if ( $section !== null && id !== 'main' ) { |
2034 | | - $section.css( 'display', selected == id ? 'block' : 'none' ); |
| 2037 | + var show = selected == id; |
| 2038 | + $section.css( 'display', show ? 'block' : 'none' ); |
2035 | 2039 | } |
2036 | 2040 | return $section; |
2037 | 2041 | }, |
— | — | @@ -2078,6 +2082,10 @@ |
2079 | 2083 | }, |
2080 | 2084 | 'loop' : function( i, s ) { |
2081 | 2085 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
| 2086 | + var $section = s.$sections.find( '.section:visible' ); |
| 2087 | + if ( $section.size() ) { |
| 2088 | + $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 2089 | + } |
2082 | 2090 | } |
2083 | 2091 | } ); |
2084 | 2092 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -132,15 +132,15 @@ |
133 | 133 | return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+ |
134 | 134 | $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';} |
135 | 135 | 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]}}};} |
136 | | -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).click(function(){var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));$(this).blur();var show=$section.css('display')=='none';$section.parent().children().hide("fast");$(this).parent().parent().find('a').removeClass('current');if(show){$section.show("fast");$(this).addClass('current');} |
| 136 | +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).click(function(){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));$(this).blur();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');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},'fast');$(this).addClass('current');}else{$sections.animate({'height':0});} |
137 | 137 | if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));} |
138 | 138 | $.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;}));},buildSection:function(context,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]));}} |
139 | 139 | 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]));}} |
140 | 140 | $section=$('<div />').attr({'class':'booklet section section-'+id,'rel':id}).append($index).append($pages);$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;} |
141 | | -if($section!==null&&id!=='main'){$section.css('display',selected==id?'block':'none');} |
| 141 | +if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');} |
142 | 142 | 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);} |
143 | 143 | $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]));}} |
144 | | -$.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));}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
| 144 | +$.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()},'fast');}}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
145 | 145 | context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');var height=context.$ui.find('.wikiEditor-ui-bottom').height() |
146 | 146 | context.$ui.find('.wikiEditor-ui-bottom').append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-bottom').height());context.modules.$toc.css({'width':'12em','marginTop':-(height)});context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context,config);context.$textarea.delayedBind(1000,'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);}});}).bind('mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('a').removeClass('currentSelection');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.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++;} |
147 | 147 | section=Math.max(0,section);} |