Ox.UI.elements -> Ox.elements

This commit is contained in:
rlx 2014-09-24 10:26:51 +02:00
parent 2d8d88b218
commit 0b5f8f9492
5 changed files with 11 additions and 10 deletions

View file

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

View file

@ -44,6 +44,7 @@ Ox.InfoList = function(options, self) {
that.$element.options({sort: self.options.sort}); that.$element.options({sort: self.options.sort});
}, },
width: function() { width: function() {
// FIXME: don't use classname for this lookup
var width = getItemWidth(); var width = getItemWidth();
$('.OxInfoElement').each(function() { $('.OxInfoElement').each(function() {
var $parent = $(this).parent(), var $parent = $(this).parent(),
@ -51,7 +52,7 @@ Ox.InfoList = function(options, self) {
$parent.css({width: width - 144}); $parent.css({width: width - 144});
$parent.parent().css({width: width - 144}); $parent.parent().css({width: width - 144});
$parent.parent().parent().css({width: width - 8}); $parent.parent().parent().css({width: width - 8});
Ox.UI.elements[id].options({width: width - 152}); Ox.elements[id].options({width: width - 152});
}); });
} }
}); });

View file

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

View file

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

View file

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