Author: nbelaevski
Date: 2008-01-18 21:52:39 -0500 (Fri, 18 Jan 2008)
New Revision: 5480
Modified:
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
http://jira.jboss.com/jira/browse/RF-1939
Modified:
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
---
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-19
01:48:48 UTC (rev 5479)
+++
trunk/ui/menu-components/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2008-01-19
02:52:39 UTC (rev 5480)
@@ -975,18 +975,27 @@
}
// if($(topLevel)){ CH-1518
- var onmouseover = function(e){
- if (!e) {
- e = window.event;
- }
-
+ var menuOn = function(e) {
RichFaces.Menu.Layers.showDropDownLayer(this.id, topLevel,
e,this.delay);
+ };
+
+ var mouseover = function(e) {
if (options.disabled == false && !RichFaces.Menu.isWithin(e,
$(topLevel))) {
this.highlightLabel();
}
-
- }.bindAsEventListener(this);
+ };
+ var menuOff = function(e) {
+ RichFaces.Menu.Layers.setLMTO(this.hideDelay);
+ RichFaces.Menu.Layers.clearPopUpTO();
+ };
+
+ var mouseout = function(e){
+ if (options.disabled == false && !RichFaces.Menu.isWithin(e,
$(topLevel))) {
+ this.unHighlightLabel();
+ }
+ };
+
if(!onEvt){
onEvt = 'onmouseover';
}
@@ -996,24 +1005,32 @@
}
offEvt = this.eventJsToPrototype(offEvt);
- var dis = this;
- var onmouseout =
- function(e){
- RichFaces.Menu.Layers.setLMTO(this.hideDelay);
- RichFaces.Menu.Layers.clearPopUpTO();
- if (options.disabled == false && !RichFaces.Menu.isWithin(e,
$(topLevel))) {
- this.unHighlightLabel();
- }
- }.bindAsEventListener(this);
+ var addBinding = function(eventName, handler) {
+ var binding = new RichFaces.Menu.Layer.Binding(topLevel, eventName, handler);
+ this.bindings.push(binding);
+ binding.refresh();
+ }.bind(this);
-// var item = $(topLevel);
- var binding = new RichFaces.Menu.Layer.Binding(topLevel,onEvt, onmouseover);
- this.bindings.push(binding);
- binding.refresh();
- binding = new RichFaces.Menu.Layer.Binding (topLevel, offEvt, onmouseout);
- this.bindings.push(binding);
- binding.refresh();
-
+ if (onEvt == 'mouseover') {
+ addBinding(onEvt, function(e) {
+ menuOn.call(this, e);
+ mouseover.call(this, e);
+ }.bindAsEventListener(this));
+ } else {
+ addBinding(onEvt, menuOn.bindAsEventListener(this));
+ addBinding('mouseover', mouseover.bindAsEventListener(this));
+ }
+
+ if (offEvt == 'mouseout') {
+ addBinding(offEvt, function(e) {
+ menuOff.call(this, e);
+ mouseout.call(this, e);
+ }.bindAsEventListener(this));
+ } else {
+ addBinding(offEvt, menuOff.bindAsEventListener(this));
+ addBinding('mouseout', mouseout.bindAsEventListener(this));
+ }
+
RichFaces.Menu.Layers.horizontals[this.id] = topLevel;
// }
return this;