lib/har/viewer/scripts/domplate/toolTip.js in har-0.0.9 vs lib/har/viewer/scripts/domplate/toolTip.js in har-0.1.0

- old
+ new

@@ -1,3 +2 @@ -require.def("domplate/toolTip",["domplate/domplate","core/lib","core/trace"],function(d,a){with(d){var e=null;d=function(){this.element=null};d.prototype=domplate({tag:DIV({"class":"toolTip"},DIV()),show:function(c,b){e&&e.hide();this.target=c;this.addListeners();c=a.getBody(document);this.element=this.tag.append({options:b},c,this);b=a.getElementBox(this.target);this.element.style.top=b.top+b.height+"px";this.element.style.left=b.left+b.width+"px";this.element.style.display="block";e=this;return this.element}, -hide:function(){if(this.element){this.removeListeners();this.element.parentNode.removeChild(this.element);e=this.element=null}},addListeners:function(){this.onMouseEvent=a.bind(this.onMouseEvent,this);$(document).bind("mousemove mouseover mousedown click mouseout",this.onMouseEvent,true)},removeListeners:function(){$(document).unbind("mousemove mouseover mousedown click mouseout",this.onMouseEvent,this,true)},onMouseEvent:function(c){var b=a.fixEvent(c);if(!a.getAncestorByClass(b.target,"toolTip")){var g= -c.clientX,h=c.clientY,f=a.getElementBox(this.element);if(c.type!="click"&&c.type!="mousedown")f=a.inflateRect(f,10,10);a.pointInRect(f,g,h)||a.isAncestor(b.target,this.target)||this.hide();a.cancelEvent(b)}}});return d}}); +require.def("domplate/toolTip",["domplate/domplate","core/lib","core/trace"],function(Domplate,Lib,Trace){with(Domplate){var mouseEvents="mousemove mouseover mousedown click mouseout",currentToolTip=null;function ToolTip(){this.element=null}ToolTip.prototype=domplate({tag:DIV({"class":"toolTip"},DIV()),show:function(a,b){currentToolTip&&currentToolTip.hide(),this.target=a,this.addListeners();var c=Lib.getBody(document);this.element=this.tag.append({options:b},c,this);var d=Lib.getElementBox(this.target);this.element.style.top=d.top+d.height+"px",this.element.style.left=d.left+d.width+"px",this.element.style.display="block",currentToolTip=this;return this.element},hide:function(){this.element&&(this.removeListeners(),this.element.parentNode.removeChild(this.element),currentToolTip=this.element=null)},addListeners:function(){this.onMouseEvent=Lib.bind(this.onMouseEvent,this),$(document).bind(mouseEvents,this.onMouseEvent,!0)},removeListeners:function(){$(document).unbind(mouseEvents,this.onMouseEvent,this,!0)},onMouseEvent:function(a){var b=Lib.fixEvent(a),c=Lib.getAncestorByClass(b.target,"toolTip");if(!c){var d=a.clientX,e=a.clientY,f=Lib.getElementBox(this.element);a.type!="click"&&a.type!="mousedown"&&(f=Lib.inflateRect(f,10,10));if(Lib.pointInRect(f,d,e)){Lib.cancelEvent(b);return}if(Lib.isAncestor(b.target,this.target)){Lib.cancelEvent(b);return}this.hide(),Lib.cancelEvent(b)}}});return ToolTip}}) \ No newline at end of file