Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -72,13 +72,13 @@ |
73 | 73 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 12 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 6 ), |
76 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 21 ), |
| 76 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 22 ), |
77 | 77 | ), |
78 | 78 | 'combined' => array( |
79 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 47 ), |
| 79 | + array( 'src' => 'js/plugins.combined.js', 'version' => 48 ), |
80 | 80 | ), |
81 | 81 | 'minified' => array( |
82 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 47 ), |
| 82 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 48 ), |
83 | 83 | ), |
84 | 84 | ), |
85 | 85 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | // Add the TOC to the document |
41 | 41 | $.wikiEditor.modules.toc.fn.build( context, config ); |
42 | 42 | context.$textarea |
43 | | - .delayedBind( 1000, 'keyup encapsulateSelection change', |
| 43 | + .delayedBind( 250, 'mouseup scrollToPosition focus keyup encapsulateSelection change', |
44 | 44 | function( event ) { |
45 | 45 | var context = $(this).data( 'wikiEditor-context' ); |
46 | 46 | $(this).eachAsync( { |
— | — | @@ -51,19 +51,10 @@ |
52 | 52 | } ); |
53 | 53 | } |
54 | 54 | ) |
55 | | - .bind( 'mouseup scrollToPosition focus keyup encapsulateSelection change', |
56 | | - function( event ) { |
57 | | - var context = $(this).data( 'wikiEditor-context' ); |
58 | | - $(this).eachAsync( { |
59 | | - bulk: 0, |
60 | | - loop: function() { |
61 | | - $.wikiEditor.modules.toc.fn.update( context ); |
62 | | - } |
63 | | - } ); |
64 | | - } |
65 | | - ) |
66 | 55 | .blur( function() { |
67 | 56 | var context = $(this).data( 'wikiEditor-context' ); |
| 57 | + context.$textarea.delayedBindCancel( 250, |
| 58 | + 'mouseup scrollToPosition focus keyup encapsulateSelection change' ); |
68 | 59 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
69 | 60 | }); |
70 | 61 | }, |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -2238,7 +2238,7 @@ |
2239 | 2239 | // Add the TOC to the document |
2240 | 2240 | $.wikiEditor.modules.toc.fn.build( context, config ); |
2241 | 2241 | context.$textarea |
2242 | | - .delayedBind( 1000, 'keyup encapsulateSelection change', |
| 2242 | + .delayedBind( 250, 'mouseup scrollToPosition focus keyup encapsulateSelection change', |
2243 | 2243 | function( event ) { |
2244 | 2244 | var context = $(this).data( 'wikiEditor-context' ); |
2245 | 2245 | $(this).eachAsync( { |
— | — | @@ -2250,19 +2250,10 @@ |
2251 | 2251 | } ); |
2252 | 2252 | } |
2253 | 2253 | ) |
2254 | | - .bind( 'mouseup scrollToPosition focus keyup encapsulateSelection change', |
2255 | | - function( event ) { |
2256 | | - var context = $(this).data( 'wikiEditor-context' ); |
2257 | | - $(this).eachAsync( { |
2258 | | - bulk: 0, |
2259 | | - loop: function() { |
2260 | | - $.wikiEditor.modules.toc.fn.update( context ); |
2261 | | - } |
2262 | | - } ); |
2263 | | - } |
2264 | | - ) |
2265 | 2254 | .blur( function() { |
2266 | 2255 | var context = $(this).data( 'wikiEditor-context' ); |
| 2256 | + context.$textarea.delayedBindCancel( 250, |
| 2257 | + 'mouseup scrollToPosition focus keyup encapsulateSelection change' ); |
2267 | 2258 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
2268 | 2259 | }); |
2269 | 2260 | }, |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | $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]));}} |
143 | 143 | $.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:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
144 | 144 | context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');var height=context.$ui.find('.wikiEditor-ui-bottom').height() |
145 | | -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('div').removeClass('current');},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++;} |
| 145 | +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(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.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++;} |
146 | 146 | section=Math.max(0,section);} |
147 | 147 | 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) |
148 | 148 | context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |