remove Ox.each, , $.extend, $.map and $.merge

This commit is contained in:
rolux 2011-09-17 20:36:09 +02:00
commit 4cc754a28d
35 changed files with 104 additions and 131 deletions

View file

@ -97,7 +97,7 @@ Ox.List = function(options, self) {
// fixme: without this, horizontal lists don't get their full width
self.options.orientation == 'horizontal' && that.$content.css({height: '1px'});
$.extend(self, {
Ox.extend(self, {
$items: [],
$pages: [],
format: {},
@ -144,11 +144,11 @@ Ox.List = function(options, self) {
return item['_index'];
});
}
self.options.max == -1 && $.extend(self.keyboardEvents, {
self.options.max == -1 && Ox.extend(self.keyboardEvents, {
key_alt_control_a: invertSelection,
key_control_a: selectAll
});
self.options.min == 0 && $.extend(self.keyboardEvents, {
self.options.min == 0 && Ox.extend(self.keyboardEvents, {
key_control_shift_a: selectNone
});
self.keyboardEvents[
@ -180,7 +180,7 @@ Ox.List = function(options, self) {
key_up: selectAbove
});
if (self.options.max == -1) {
$.extend(self.keyboardEvents, {
Ox.extend(self.keyboardEvents, {
key_shift_down: addBelowToSelection,
key_shift_up: addAboveToSelection
});
@ -290,7 +290,7 @@ Ox.List = function(options, self) {
self.requests.forEach(function(v) {
Ox.Request.cancel(v);
});
$.extend(self, {
Ox.extend(self, {
//$items: [],
$pages: [],
page: 0,
@ -317,7 +317,7 @@ Ox.List = function(options, self) {
/*
ids.length && self.options.copy && Ox.Clipboard.copy(
self.options.copy(
$.map(ids, function(id) {
ids.map(function(id) {
return that.value(id);
})
)
@ -700,7 +700,10 @@ Ox.List = function(options, self) {
return;
}
Ox.print(that.id, 'loadPage', page);
var keys = $.merge(self.options.keys.indexOf(self.options.unique) == -1 ? [self.options.unique] : [], self.options.keys),
var keys = Ox.merge(
self.options.keys.indexOf(self.options.unique) == -1
? [self.options.unique] : [], self.options.keys
),
offset = page * self.pageLength,
range = [offset, offset + getPageLength(page)];
if (Ox.isUndefined(self.$pages[page])) { // fixme: unload will have made this undefined already
@ -792,7 +795,7 @@ Ox.List = function(options, self) {
self.drag = {
pos: findItemPosition(e)
};
$.extend(self.drag, {
Ox.extend(self.drag, {
id: self.$items[self.drag.pos].options('data')[self.options.unique],
startPos: self.drag.pos,
startY: e.clientY,
@ -962,7 +965,6 @@ Ox.List = function(options, self) {
$item.data({position: pos});
});
self.selected = [stopPos];
//Ox.print('ids', self.ids, $.map(self.$items, function(v, i) { return v.data('id'); }));
}
function open() {
@ -1201,7 +1203,7 @@ Ox.List = function(options, self) {
function triggerClickEvent(event, $item, $cell) {
// event can be 'click' or 'edit'
that.triggerEvent(event, $.extend({
that.triggerEvent(event, Ox.extend({
id: $item.data('id')
}, $cell ? {
key: $cell.attr('class').split('OxColumn')[1].split(' ')[0].toLowerCase()
@ -1256,7 +1258,7 @@ Ox.List = function(options, self) {
// only used if orientation is both
clear();
self.pageLength = self.pageLengthByRowLength[self.rowLength]
$.extend(self, {
Ox.extend(self, {
listSize: getListSize(),
pages: Math.ceil(self.listLength / self.pageLength),
pageWidth: (self.options.itemWidth + self.itemMargin) * self.rowLength,
@ -1421,8 +1423,8 @@ Ox.List = function(options, self) {
}
});
self.options.items.splice.apply(self.options.items, $.merge([pos, 0], items));
self.$items.splice.apply(self.$items, $.merge([pos, 0], $items));
self.options.items.splice.apply(self.options.items, Ox.merge([pos, 0], items));
self.$items.splice.apply(self.$items, Ox.merge([pos, 0], $items));
//if(first)
loadItems();
updatePositions();