Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js |
— | — | @@ -119,9 +119,6 @@ |
120 | 120 | } |
121 | 121 | } |
122 | 122 | }, |
123 | | - modifyTool : function( context, data ){ |
124 | | - |
125 | | - }, |
126 | 123 | removeFromToolbar : function( context, data ) { |
127 | 124 | js_log("f:removeFromToolbar"); |
128 | 125 | if ( typeof data.section == 'string' ) { |
— | — | @@ -485,6 +482,7 @@ |
486 | 483 | ); |
487 | 484 | }, |
488 | 485 | buildSection : function( context, id, section ) { |
| 486 | + context.$textarea.trigger( 'wikiEditor-toolbar-buildSection-' + id, [section] ); |
489 | 487 | var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
490 | 488 | var $section; |
491 | 489 | switch ( section.type ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1639,9 +1639,6 @@ |
1640 | 1640 | } |
1641 | 1641 | } |
1642 | 1642 | }, |
1643 | | - modifyTool : function( context, data ){ |
1644 | | - |
1645 | | - }, |
1646 | 1643 | removeFromToolbar : function( context, data ) { |
1647 | 1644 | js_log("f:removeFromToolbar"); |
1648 | 1645 | if ( typeof data.section == 'string' ) { |
— | — | @@ -2005,6 +2002,7 @@ |
2006 | 2003 | ); |
2007 | 2004 | }, |
2008 | 2005 | buildSection : function( context, id, section ) { |
| 2006 | + context.$textarea.trigger( 'wikiEditor-toolbar-buildSection-' + id, [section] ); |
2009 | 2007 | var selected = $.cookie( 'wikiEditor-' + context.instance + '-toolbar-section' ); |
2010 | 2008 | var $section; |
2011 | 2009 | switch ( section.type ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | var $table=context.modules.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.page+'].page table');for(row in data[type]){$table.append($.wikiEditor.modules.toolbar.fn.buildRow(context,data[type][row]));} |
108 | 108 | break;case'characters':if(!('section'in data&&'page'in data)){continue;} |
109 | 109 | $characters=context.modules.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.page+'].page div');var actions=$characters.data('actions');for(character in data[type]){$characters.append($($.wikiEditor.modules.toolbar.fn.buildCharacter(data[type][character],actions)).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).parent().data('context'),$(this).parent().data('actions')[$(this).attr('rel')]);return false;}));} |
110 | | -break;default:break;}}},modifyTool:function(context,data){},removeFromToolbar:function(context,data){js_log("f:removeFromToolbar");if(typeof data.section=='string'){var tab='div.tabs span[rel='+data.section+'].tab';var target='div[rel='+data.section+'].section';if(typeof data.group=='string'){target+=' div[rel='+data.group+'].group';if(typeof data.tool=='string'){target+=' div[rel='+data.tool+'].tool';}}else if(typeof data.page=='string'){var index=target+' div.index div[rel='+data.page+']';target+=' div.pages div[rel='+data.page+'].page';if(typeof data.character=='string'){target+=' a[rel='+data.character+']';}else if(typeof data.row=='number'){target+=' table tr:not(:has(th)):eq('+data.row+')';}else{context.modules.$toolbar.find(index).remove();$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,null,context.modules.$toolbar.find(target),context.modules.$toolbar.find(index));}}else{context.modules.$toolbar.find(tab).remove();} |
| 110 | +break;default:break;}}},removeFromToolbar:function(context,data){js_log("f:removeFromToolbar");if(typeof data.section=='string'){var tab='div.tabs span[rel='+data.section+'].tab';var target='div[rel='+data.section+'].section';if(typeof data.group=='string'){target+=' div[rel='+data.group+'].group';if(typeof data.tool=='string'){target+=' div[rel='+data.tool+'].tool';}}else if(typeof data.page=='string'){var index=target+' div.index div[rel='+data.page+']';target+=' div.pages div[rel='+data.page+'].page';if(typeof data.character=='string'){target+=' a[rel='+data.character+']';}else if(typeof data.row=='number'){target+=' table tr:not(:has(th)):eq('+data.row+')';}else{context.modules.$toolbar.find(index).remove();$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,null,context.modules.$toolbar.find(target),context.modules.$toolbar.find(index));}}else{context.modules.$toolbar.find(tab).remove();} |
111 | 111 | js_log('target is: '+target);context.modules.$toolbar.find(target).remove();}}},fn:{create:function(context,config){if('$toolbar'in context.modules){return;} |
112 | 112 | context.modules.$toolbar=$('<div />').addClass('wikiEditor-ui-toolbar').attr('id','wikiEditor-ui-toolbar');$.wikiEditor.modules.toolbar.fn.build(context,config);context.$ui.find('.wikiEditor-ui-top').append(context.modules.$toolbar);},doAction:function(context,action,source){if($.trackAction!=undefined&&source.closest('.wikiEditor-ui-toolbar').size()){var rels=[];var step=source;var i=0;while(!step.hasClass('wikiEditor-ui-toolbar')){if(i>25){break;} |
113 | 113 | i++;var rel=step.attr('rel');if(rel){rels.push(step.attr('rel'));} |
— | — | @@ -134,7 +134,7 @@ |
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 | 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 | | -$.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]));}} |
| 138 | +$.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);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]));}} |
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 | 141 | if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');} |