lib/har/viewer/scripts/domplate/toolbar.js in har-0.0.9 vs lib/har/viewer/scripts/domplate/toolbar.js in har-0.1.0
- old
+ new
@@ -1,3 +2 @@
-require.def("domplate/toolbar",["domplate/domplate","core/lib","core/trace"],function(c,e){with(c){var d=domplate({tag:DIV({"class":"toolbar",onclick:"$onClick"}),buttonTag:SPAN({"class":"$button.className toolbarButton",title:"$button.tooltiptext",$text:"$button|hasLabel",onclick:"$button|getCommand"},"$button|getLabel"),separatorTag:SPAN({"class":"toolbarSeparator",style:"color: gray;"},"|"),hasLabel:function(a){return a.label?true:false},getLabel:function(a){return a.label?a.label:""},getCommand:function(a){return a.command?
-a.command:function(){}},onClick:function(a){a=$.event.fix(a||window.event);e.cancelEvent(a)}});c=function(){this.buttons=[]};c.prototype={addButton:function(a){a.tooltiptext||(tooltiptext="");this.buttons.push(a)},getButton:function(a){for(var b=0;b<this.buttons.length;b++)if(this.buttons[b].id==a)return this.buttons[b]},render:function(a){if(this.element)a=this.element.parentNode;this.element=d.tag.replace({},a);for(a=0;a<this.buttons.length;a++){var b=this.buttons[a];(b.tag?b.tag:d.buttonTag).append({button:b},
-this.element);a<this.buttons.length-1&&d.separatorTag.append({},this.element)}return this.element}};return c}});
+require.def("domplate/toolbar",["domplate/domplate","core/lib","core/trace","domplate/popupMenu"],function(Domplate,Lib,Trace,Menu){with(Domplate){var ToolbarTempl=domplate({tag:DIV({"class":"toolbar",onclick:"$onClick"}),buttonTag:SPAN({"class":"$button|getClassName toolbarButton",title:"$button.tooltiptext",$text:"$button|hasLabel",onclick:"$button|getCommand"},"$button|getLabel"),dropDownTag:SPAN({"class":"$button|getClassName toolbarButton dropDown",_repObject:"$button",title:"$button.tooltiptext",$text:"$button|hasLabel",onclick:"$onDropDown"},"$button|getLabel",SPAN({"class":"arrow"})),separatorTag:SPAN({"class":"toolbarSeparator",style:"color: gray;"},"|"),hasLabel:function(a){return a.label?!0:!1},getLabel:function(a){return a.label?a.label:""},getClassName:function(a){return a.className?a.className:""},getCommand:function(a){return a.command?a.command:function(){}},onClick:function(a){var b=$.event.fix(a||window.event);Lib.cancelEvent(b)},onDropDown:function(a){var b=$.event.fix(a||window.event),c=b.target,d=Lib.getAncestorByClass(c,"toolbarButton"),e=d.repObject.items,f=new Menu({id:"toolbarContextMenu",items:e});f.showPopup(d)}});function Toolbar(){this.buttons=[]}Toolbar.prototype={addButton:function(a){a.tooltiptext||(tooltiptext=""),this.buttons.push(a)},removeButton:function(a){for(var b=0;b<this.buttons.length;b++)if(this.buttons[b].id==a){this.buttons.splice(b,1);break}},addButtons:function(a){for(var b=0;b<a.length;b++)this.addButton(a[b])},getButton:function(a){for(var b=0;b<this.buttons.length;b++)if(this.buttons[b].id==a)return this.buttons[b]},render:function(a){if(this.buttons.length){this.element&&(a=this.element.parentNode),this.element=ToolbarTempl.tag.replace({},a);for(var b=0;b<this.buttons.length;b++){var c=this.buttons[b],d=c.items?ToolbarTempl.dropDownTag:ToolbarTempl.buttonTag,e=c.tag?c.tag:d,f=e.append({button:c},this.element);c.initialize&&c.initialize(f),b<this.buttons.length-1&&ToolbarTempl.separatorTag.append({},this.element)}return this.element}}};return Toolbar}})
\ No newline at end of file