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

- old
+ new

@@ -1,2 +1,4 @@ -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}}) +/* See license.txt for terms of usage */ + +define("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}return ToolTip.prototype=domplate({tag:DIV({"class":"toolTip"},DIV()),show:function(e,t){currentToolTip&&currentToolTip.hide(),this.target=e,this.addListeners();var n=Lib.getBody(document);this.element=this.tag.append({options:t},n,this);var r=Lib.getElementBox(this.target);return this.element.style.top=r.top+r.height+"px",this.element.style.left=r.left+r.width+"px",this.element.style.display="block",currentToolTip=this,this.element},hide:function(){if(!this.element)return;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(e){var t=Lib.fixEvent(e),n=Lib.getAncestorByClass(t.target,"toolTip");if(n)return;var r=e.clientX,i=e.clientY,s=Lib.getElementBox(this.element);e.type!="click"&&e.type!="mousedown"&&(s=Lib.inflateRect(s,10,10));if(Lib.pointInRect(s,r,i)){Lib.cancelEvent(t);return}if(Lib.isAncestor(t.target,this.target)){Lib.cancelEvent(t);return}this.hide(),Lib.cancelEvent(t)}}),ToolTip}}); \ No newline at end of file