Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -71,16 +71,16 @@ |
72 | 72 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 20 ), |
74 | 74 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 15 ), |
75 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 24 ), |
| 75 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 25 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 35 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 3 ), |
79 | 79 | ), |
80 | 80 | 'combined' => array( |
81 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 72 ), |
| 81 | + array( 'src' => 'js/plugins.combined.js', 'version' => 73 ), |
82 | 82 | ), |
83 | 83 | 'minified' => array( |
84 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 72 ), |
| 84 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 73 ), |
85 | 85 | ), |
86 | 86 | ), |
87 | 87 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js |
— | — | @@ -250,12 +250,18 @@ |
251 | 251 | if ( label ) { |
252 | 252 | $group.append( '<div class="label">' + label + '</div>' ) |
253 | 253 | } |
| 254 | + |
| 255 | + var empty = true; |
254 | 256 | if ( 'tools' in group ) { |
255 | 257 | for ( tool in group.tools ) { |
256 | | - $group.append( $.wikiEditor.modules.toolbar.fn.buildTool( context, tool, group.tools[tool] ) ); |
| 258 | + var tool = $.wikiEditor.modules.toolbar.fn.buildTool( context, tool, group.tools[tool] ); |
| 259 | + if ( tool ) { |
| 260 | + empty = false; |
| 261 | + $group.append( tool ); |
| 262 | + } |
257 | 263 | } |
258 | 264 | } |
259 | | - return $group; |
| 265 | + return empty ? null : $group; |
260 | 266 | }, |
261 | 267 | buildTool : function( context, id, tool ) { |
262 | 268 | if ( 'filters' in tool ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -2159,12 +2159,18 @@ |
2160 | 2160 | if ( label ) { |
2161 | 2161 | $group.append( '<div class="label">' + label + '</div>' ) |
2162 | 2162 | } |
| 2163 | + |
| 2164 | + var empty = true; |
2163 | 2165 | if ( 'tools' in group ) { |
2164 | 2166 | for ( tool in group.tools ) { |
2165 | | - $group.append( $.wikiEditor.modules.toolbar.fn.buildTool( context, tool, group.tools[tool] ) ); |
| 2167 | + var tool = $.wikiEditor.modules.toolbar.fn.buildTool( context, tool, group.tools[tool] ); |
| 2168 | + if ( tool ) { |
| 2169 | + empty = false; |
| 2170 | + $group.append( tool ); |
| 2171 | + } |
2166 | 2172 | } |
2167 | 2173 | } |
2168 | | - return $group; |
| 2174 | + return empty ? null : $group; |
2169 | 2175 | }, |
2170 | 2176 | buildTool : function( context, id, tool ) { |
2171 | 2177 | if ( 'filters' in tool ) { |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -127,8 +127,8 @@ |
128 | 128 | if('regex'in action.options&&'regexReplace'in action.options){var selection=context.$textarea.textSelection('getSelection');if(selection!=''&&selection.match(action.options.regex)){parts.peri=selection.replace(action.options.regex,action.options.regexReplace);parts.pre=parts.post='';}} |
129 | 129 | context.$textarea.textSelection('encapsulateSelection',$.extend(action.options,parts,{'replace':action.type=='replace'}));break;case'callback':if(typeof action.execute=='function'){action.execute(context);} |
130 | 130 | break;case'dialog':context.$textarea.wikiEditor('openDialog',action.module);break;default:break;}},buildGroup:function(context,id,group){var $group=$('<div />').attr({'class':'group group-'+id,'rel':id});var label=$.wikiEditor.autoMsg(group,'label');if(label){$group.append('<div class="label">'+label+'</div>')} |
131 | | -if('tools'in group){for(tool in group.tools){$group.append($.wikiEditor.modules.toolbar.fn.buildTool(context,tool,group.tools[tool]));}} |
132 | | -return $group;},buildTool:function(context,id,tool){if('filters'in tool){for(filter in tool.filters){if($(tool.filters[filter]).size()==0){return null;}}} |
| 131 | +var empty=true;if('tools'in group){for(tool in group.tools){var tool=$.wikiEditor.modules.toolbar.fn.buildTool(context,tool,group.tools[tool]);if(tool){empty=false;$group.append(tool);}}} |
| 132 | +return empty?null:$group;},buildTool:function(context,id,tool){if('filters'in tool){for(filter in tool.filters){if($(tool.filters[filter]).size()==0){return null;}}} |
133 | 133 | var label=$.wikiEditor.autoMsg(tool,'label');switch(tool.type){case'button':var src=tool.icon;if(src.indexOf('http://')!==0&&src.indexOf('https://')!==0){src=$.wikiEditor.imgPath+'toolbar/'+src;} |
134 | 134 | $button=$('<img />').attr({'src':src,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-button'});if('action'in tool){$button.data('action',tool.action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));return false;});} |
135 | 135 | return $button;case'select':var $select=$('<div />').attr({'rel':id,'class':'tool tool-select'}).click(function(){var $options=$(this).find('.options');$options.animate({'opacity':'toggle'},'fast');});$options=$('<div />').addClass('options');if('list'in tool){for(option in tool.list){var optionLabel=$.wikiEditor.autoMsg(tool.list[option],'label');$options.append($('<a />').data('action',tool.list[option].action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));}).text(optionLabel).addClass('option').attr('rel',option));}} |