Ox.elements -> Ox.

This commit is contained in:
rlx 2014-09-25 18:47:29 +02:00
parent 775aa607c8
commit 8e335ba4f6
8 changed files with 21 additions and 21 deletions

View file

@ -124,7 +124,7 @@
that.self = function _self() {
return arguments[0] === _ ? self : {};
};
Ox.elements[that.oxid] = that;
Ox.$elements[that.oxid] = that;
if (self.options.element == '<iframe>') {
self.messageCallbacks = self.messageCallbacks || {};
@ -357,8 +357,8 @@
// return the Ox Element instead, so that we can do
// oxObj.jqFn().oxFn()
return ret && ret.jquery && ret.length == 1
&& Ox.elements[oxid = ret.data('oxid')]
? Ox.elements[oxid] : ret;
&& Ox.$elements[oxid = ret.data('oxid')]
? Ox.$elements[oxid] : ret;
};
});
@ -648,9 +648,9 @@
Ox.Focus.removeElement(this.oxid);
this.self(_).unbindKeyboard();
this.$tooltip && this.$tooltip.remove();
delete Ox.elements[this.oxid];
delete Ox.$elements[this.oxid];
// If setElement($element) was used, delete $element too
delete Ox.elements[this.$element.oxid];
delete Ox.$elements[this.$element.oxid];
return this;
};

View file

@ -66,10 +66,10 @@
Ox.$parent.postMessage('init', {})
} else if (message.target) {
// The outer window receives init from iframe
Ox.elements[message.target].triggerEvent('init');
Ox.$elements[message.target].triggerEvent('init');
}
} else {
(message.target ? Ox.elements[message.target] : Ox.$parent)
(message.target ? Ox.$elements[message.target] : Ox.$parent)
.triggerMessage(message.event, message.data);
}
}

View file

@ -10,7 +10,7 @@ Ox.Focus = (function() {
that = {
focusedElement: function() {
return Ox.elements[Ox.last(stack)];
return Ox.$elements[Ox.last(stack)];
},
focusedElementIsInput: function() {
var $element = that.focusedElement();
@ -49,7 +49,7 @@ Ox.Focus = (function() {
.removeClass('OxFocus')
.triggerEvent('losefocus');
if (stack.length) {
Ox.elements[Ox.last(stack)]
Ox.$elements[Ox.last(stack)]
.addClass('OxFocus')
.triggerEvent('gainfocus');
}

View file

@ -12,17 +12,17 @@ Ox.GarbageCollection = (function() {
timeout;
that.collect = function() {
var len = Ox.len(Ox.elements);
Object.keys(Ox.elements).forEach(function(id) {
var $element = Ox.elements[id];
var len = Ox.len(Ox.$elements);
Object.keys(Ox.$elements).forEach(function(id) {
var $element = Ox.$elements[id];
if ($element && Ox.isUndefined($element.data('oxid'))) {
$element.remove();
delete Ox.elements[id];
delete Ox.$elements[id];
}
});
timeout && clearTimeout(timeout);
timeout = setTimeout(that.collect, 60000);
Ox.Log('GC', len, '-->', Ox.len(Ox.elements));
Ox.Log('GC', len, '-->', Ox.len(Ox.$elements));
};
/*@
@ -31,7 +31,7 @@ Ox.GarbageCollection = (function() {
@*/
that.debug = function() {
var classNames = {}, sorted = [];
Ox.forEach(Ox.elements, function($element, id) {
Ox.forEach(Ox.$elements, function($element, id) {
var className = $element[0].className;
classNames[className] = (classNames[className] || 0) + 1;
});

View file

@ -38,8 +38,8 @@ Ox.SCROLLBAR_SIZE = Ox.UI.SCROLLBAR_SIZE = $.browser.webkit ? 8 : (function() {
//@ Ox.UI_PATH <str> Path of Ox UI
Ox.UI_PATH = Ox.UI.PATH = Ox.PATH + 'Ox.UI/';
//@ Ox.elements <o> Reference to all Ox Elements
Ox.elements = Ox.$elements = Ox.UI.elements = {};
//@ Ox.$elements <o> Reference to all Ox Elements
Ox.$elements = Ox.UI.elements = {};
/*@
Ox.getImageData <f> Returns properties of an Ox UI image
@ -109,7 +109,7 @@ Ox.getImageURL = Ox.cache(function(name, color, theme) {
//@ Ox.getOxElement <f> Returns the Ox.Element of a DOM element, or `undefined`
Ox.getOxElement = function(element) {
return Ox.elements[$(element).data('oxid')];
return Ox.$elements[$(element).data('oxid')];
};
/*@

View file

@ -598,7 +598,7 @@ Ox.Map = function(options, self) {
function centerChanged() {
var tooltip = $('.OxMapMarkerTooltip');
tooltip.length && Ox.elements[$(tooltip[0]).data('oxid')].hide();
tooltip.length && Ox.$elements[$(tooltip[0]).data('oxid')].hide();
self.center = self.map.getCenter();
self.centerChanged = true;
}

View file

@ -206,7 +206,7 @@ Ox.AnnotationPanel = function(options, self) {
var id = data.id;
Ox.InsertHTMLDialog(Ox.extend({
callback: function(data) {
Ox.elements[id]
Ox.$elements[id]
.value(data.value)
.focusInput(data.position)
.triggerEvent('change', data.value);

View file

@ -1274,7 +1274,7 @@ Ox.VideoAnnotationPanel = function(options, self) {
if (Ox.isUndefined(data)) {
// doubleclick on small timeline
data = getAnnotation();
} else if (!data.id && Ox.elements[that.oxid]) {
} else if (!data.id && Ox.$elements[that.oxid]) {
// focus only if in the dom
that.gainFocus();
}