keep custom events from bubbling up
This commit is contained in:
parent
5bd21769ed
commit
62416c0b0d
|
@ -144,8 +144,6 @@ requires
|
|||
return false;
|
||||
}
|
||||
});
|
||||
if (!userAgent && navigator.userAgent.indexOf('Gecko') > -1)
|
||||
userAgent = 'Firefox';
|
||||
return userAgent;
|
||||
}
|
||||
|
||||
|
@ -908,6 +906,13 @@ requires
|
|||
})();
|
||||
|
||||
// private
|
||||
function eventCallback(fn) {
|
||||
return function(event, data) {
|
||||
event.stopPropagation();
|
||||
fn(event, data);
|
||||
};
|
||||
}
|
||||
|
||||
function wrapjQuery() {
|
||||
$.each(oxui.jQueryFunctions, function(i, fn) {
|
||||
that[fn] = function() {
|
||||
|
@ -983,11 +988,11 @@ requires
|
|||
if (arguments.length == 1) {
|
||||
$.each(arguments[0], function(event, fn) {
|
||||
Ox.print(that.id, 'bind', event);
|
||||
that.bind('ox_' + event, fn);
|
||||
that.bind('ox_' + event, eventCallback(fn));
|
||||
});
|
||||
} else {
|
||||
Ox.print(that.id, 'bind', arguments[0]);
|
||||
that.bind('ox_' + arguments[0], arguments[1]);
|
||||
that.bind('ox_' + arguments[0], eventCallback(arguments[1]));
|
||||
}
|
||||
return that;
|
||||
}
|
||||
|
@ -1079,31 +1084,16 @@ requires
|
|||
*/
|
||||
if (Ox.isObject(arguments[0])) {
|
||||
$.each(arguments[0], function(event, data) {
|
||||
Ox.print(that.id, 'trigger', event, data);
|
||||
Ox.print(that.id, self.options.id, 'trigger', event, data);
|
||||
that.trigger('ox_' + event, data);
|
||||
});
|
||||
} else {
|
||||
Ox.print(that.id, 'trigger', arguments[0], arguments[1] || {});
|
||||
Ox.print(that.id, self.options ? self.options.id : '', 'trigger', arguments[0], arguments[1] || {});
|
||||
that.trigger('ox_' + arguments[0], arguments[1] || {});
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
that.triggerEvent_ = function() {
|
||||
/*
|
||||
triggers an event
|
||||
triggerEvent(event) or triggerEvent(event, data) or triggerEvent({event0: data, event1: data, ...})
|
||||
*/
|
||||
if (Ox.isObject(arguments[0])) {
|
||||
$.each(arguments[0], function(event, data) {
|
||||
Ox.Event.trigger(self.options.id, event, data);
|
||||
});
|
||||
} else {
|
||||
Ox.Event.trigger(self.options.id, arguments[0], arguments[1] || {});
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
that.unbindEvent = function() {
|
||||
/*
|
||||
unbinds an event
|
||||
|
@ -1112,26 +1102,11 @@ requires
|
|||
if (arguments.length == 1) {
|
||||
$.each(arguments[0], function(event, fn) {
|
||||
Ox.print(that.id, 'unbind', arguments[0]);
|
||||
that.unbind('ox_' + event, fn);
|
||||
that.unbind('ox_' + event, eventCallback(fn));
|
||||
});
|
||||
} else {
|
||||
Ox.print(that.id, 'unbind', arguments[0]);
|
||||
that.unbind('ox_' + arguments[0], arguments[1]);
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
that.unbindEvent_ = function() {
|
||||
/*
|
||||
unbinds an event
|
||||
unbindEvent(event, fn) or unbindEvent({event0: fn0, event1: fn1, ...})
|
||||
*/
|
||||
if (arguments.length == 1) {
|
||||
$.each(arguments[0], function(event, fn) {
|
||||
Ox.Event.unbind(self.options.id, event, fn);
|
||||
});
|
||||
} else {
|
||||
Ox.Event.unbind(self.options.id, arguments[0], arguments[1]);
|
||||
that.unbind('ox_' + arguments[0], eventCallback(arguments[1]));
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
@ -1516,8 +1491,7 @@ requires
|
|||
|
||||
function toggle() {
|
||||
if (self.options.collapsible) {
|
||||
var i = (self.options.edge == 'left' || self.options.edge == 'top') ? 0 : 1;
|
||||
self.options.parent.toggle(self.ids[i]);
|
||||
self.options.parent.toggle(self.ids[self.leftOrTop ? 0 : 1]);
|
||||
self.options.collapsed = !self.options.collapsed;
|
||||
}
|
||||
/*
|
||||
|
@ -9180,6 +9154,7 @@ requires
|
|||
});
|
||||
})
|
||||
Ox.print(self.options.elements[pos])
|
||||
return that;
|
||||
};
|
||||
|
||||
that.replaceElements = function(elements) {
|
||||
|
@ -9197,6 +9172,7 @@ requires
|
|||
that.replace(i, element.element);
|
||||
});
|
||||
self.options.elements = elements;
|
||||
return that;
|
||||
}
|
||||
|
||||
that.size = function(id, size) {
|
||||
|
@ -9205,9 +9181,10 @@ requires
|
|||
element = self.options.elements[pos];
|
||||
Ox.print('pos', pos, 'size', size);
|
||||
if (arguments.length == 1) {
|
||||
Ox.print('size', element.element[self.dimensions[0]](), !that.isCollapsed(pos))
|
||||
Ox.print('get size', self.options.id, id, element.element[self.dimensions[0]]() * !that.isCollapsed(pos))
|
||||
return element.element[self.dimensions[0]]() * !that.isCollapsed(pos);
|
||||
} else {
|
||||
Ox.print('set size', self.options.id, id, size)
|
||||
element.size = size;
|
||||
setSizes();
|
||||
return that;
|
||||
|
@ -9233,12 +9210,13 @@ requires
|
|||
element.element[self.dimensions[0]]() *
|
||||
(element.collapsed ? 1 : -1),
|
||||
animate = {};
|
||||
Ox.print(parseInt(that.css(self.edges[0])), element.element[self.dimensions[0]]())
|
||||
Ox.print('===', parseInt(that.css(self.edges[0])), element.element[self.dimensions[0]]())
|
||||
animate[self.edges[pos == 0 ? 0 : 1]] = value;
|
||||
Ox.print('animate', animate, 'value', value)
|
||||
that.animate(animate, 200, function() {
|
||||
var element = self.options.elements[pos == 0 ? 1 : pos - 1].element;
|
||||
self.options.elements[pos].collapsed = !self.options.elements[pos].collapsed;
|
||||
Ox.print('after animation, element', element, element.id, element.options('id'))
|
||||
element.triggerEvent(
|
||||
'resize',
|
||||
element[self.dimensions[0]]()
|
||||
|
@ -9249,6 +9227,7 @@ requires
|
|||
that.updateSize = function(id, size) {
|
||||
// this is called from resizebar
|
||||
// one can pass pos instead of id
|
||||
Ox.print('updateSize', self.options.id, id, size);
|
||||
var pos = Ox.isNumber(id) ? id : getPositionById(id);
|
||||
self.options.elements[pos].size = size;
|
||||
}
|
||||
|
@ -10258,6 +10237,7 @@ requires
|
|||
|
||||
self.onChange = function(key, value) {
|
||||
if (key == 'width' || key == 'height') {
|
||||
Ox.print('XXXX setSizes', key, value, self.options.width, self.options.height)
|
||||
setSizes();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user