forked from 0x2620/oxjs
merging changes
This commit is contained in:
parent
7cbbab915a
commit
62e6c0d84c
3 changed files with 112 additions and 43 deletions
|
|
@ -771,8 +771,11 @@ requires
|
|||
|
||||
};
|
||||
|
||||
Ox.UI = function() {
|
||||
Ox.UI = (function() {
|
||||
return {
|
||||
$body: $('body'),
|
||||
$document: $(document),
|
||||
$window: $(window),
|
||||
path: function() {
|
||||
return oxui.path;
|
||||
},
|
||||
|
|
@ -783,7 +786,7 @@ requires
|
|||
|
||||
}
|
||||
}
|
||||
}();
|
||||
}());
|
||||
|
||||
/***
|
||||
Ox.URL
|
||||
|
|
@ -861,6 +864,10 @@ requires
|
|||
|
||||
return function(options, self) {
|
||||
|
||||
if (!(this instanceof arguments.callee)) {
|
||||
return new arguments.callee(options, self);
|
||||
}
|
||||
|
||||
self = self || {};
|
||||
self.options = options || {};
|
||||
if (!self.$eventHandler) {
|
||||
|
|
@ -8751,10 +8758,12 @@ requires
|
|||
.options(options || {});
|
||||
|
||||
if (self.options.data) {
|
||||
self.options.items = [parseData(
|
||||
self.options.data.key,
|
||||
self.options.data.value
|
||||
)];
|
||||
self.options.items = [];
|
||||
Ox.print('d', self.options.data, 'i', self.options.items)
|
||||
Ox.forEach(self.options.data, function(value, key) {
|
||||
self.options.items.push(parseData(key, value));
|
||||
});
|
||||
Ox.print('d', self.options.data, 'i', self.options.items)
|
||||
}
|
||||
|
||||
that.$element = new Ox.List({
|
||||
|
|
@ -8846,17 +8855,23 @@ requires
|
|||
}
|
||||
|
||||
function parseData(key, value) {
|
||||
Ox.print('parseData', key, value)
|
||||
var ret = {
|
||||
id: key,
|
||||
title: key.split('.').pop()
|
||||
};
|
||||
if (Ox.isArray(value) || Ox.isObject(value)) {
|
||||
ret.items = []
|
||||
Ox.forEach(value, function(v, k) {
|
||||
ret.items.push(parseData(key + '.' + k, v));
|
||||
id: key,
|
||||
title: key.toString().split('.').pop()
|
||||
},
|
||||
type = Ox.typeOf(value);
|
||||
if (type == 'array' || type == 'object') {
|
||||
ret.title += ': ' + Ox.toTitleCase(Ox.typeOf(value));
|
||||
ret.items = Ox.map(Ox.sort(Ox.keys(value)), function(k) {
|
||||
return parseData(key + '.' + k, value[k]);
|
||||
});
|
||||
} else {
|
||||
ret.title += ': ' + (Ox.isFunction(value) ? 'function' : value)
|
||||
ret.title += ': ' + (
|
||||
type == 'function' ?
|
||||
value.toString().split('{')[0] :
|
||||
JSON.stringify(value)
|
||||
)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -8901,9 +8916,7 @@ requires
|
|||
function toggleItems(event, data) {
|
||||
data.ids.forEach(function(id, i) {
|
||||
var item = getItemById(id);
|
||||
Ox.print('item', item, !!item.items, data.expanded != !!item.expanded)
|
||||
if (item.items && data.expanded != !!item.expanded) {
|
||||
Ox.print('ITEM', item)
|
||||
toggleItem(item, data.expanded);
|
||||
}
|
||||
});
|
||||
|
|
@ -9504,7 +9517,7 @@ requires
|
|||
}
|
||||
|
||||
function getPlaceByLatLng(latlng, bounds, callback) {
|
||||
//Ox.print('ll b', latlng, bounds)
|
||||
Ox.print('ll b', latlng, bounds)
|
||||
var callback = arguments.length == 3 ? callback : bounds,
|
||||
bounds = arguments.length == 3 ? bounds : null;
|
||||
self.geocoder.geocode({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue