lib/har/viewer/scripts/domplate/toolbar.js in har-0.1.0 vs lib/har/viewer/scripts/domplate/toolbar.js in har-0.1.1
- old
+ new
@@ -1,2 +1,4 @@
-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}})
+/* See license.txt for terms of usage */
+
+define("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(e){return e.label?!0:!1},getLabel:function(e){return e.label?e.label:""},getClassName:function(e){return e.className?e.className:""},getCommand:function(e){return e.command?e.command:function(){}},onClick:function(e){var t=$.event.fix(e||window.event);Lib.cancelEvent(t)},onDropDown:function(e){var t=$.event.fix(e||window.event),n=t.target,r=Lib.getAncestorByClass(n,"toolbarButton"),i=r.repObject.items,s=new Menu({id:"toolbarContextMenu",items:i});s.showPopup(r)}});function Toolbar(){this.buttons=[]}return Toolbar.prototype={addButton:function(e){e.tooltiptext||(tooltiptext=""),this.buttons.push(e)},removeButton:function(e){for(var t=0;t<this.buttons.length;t++)if(this.buttons[t].id==e){this.buttons.splice(t,1);break}},addButtons:function(e){for(var t=0;t<e.length;t++)this.addButton(e[t])},getButton:function(e){for(var t=0;t<this.buttons.length;t++)if(this.buttons[t].id==e)return this.buttons[t]},render:function(e){if(!this.buttons.length)return;this.element&&(e=this.element.parentNode),this.element=ToolbarTempl.tag.replace({},e);for(var t=0;t<this.buttons.length;t++){var n=this.buttons[t],r=n.items?ToolbarTempl.dropDownTag:ToolbarTempl.buttonTag,i=n.tag?n.tag:r,s=i.append({button:n},this.element);n.initialize&&n.initialize(s),t<this.buttons.length-1&&ToolbarTempl.separatorTag.append({},this.element)}return this.element}},Toolbar}});
\ No newline at end of file