remove Ox.each, , $.extend, $.map and $.merge
This commit is contained in:
parent
da9e5dbb29
commit
4cc754a28d
35 changed files with 104 additions and 131 deletions
|
@ -54,7 +54,7 @@ Ox.Resizebar = function(options, self) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
clientXY: self.options.orientation == 'horizontal' ? 'clientY' : 'clientX',
|
clientXY: self.options.orientation == 'horizontal' ? 'clientY' : 'clientX',
|
||||||
dimensions: Ox.UI.DIMENSIONS[self.options.orientation], // fixme: should orientation be the opposite orientation here?
|
dimensions: Ox.UI.DIMENSIONS[self.options.orientation], // fixme: should orientation be the opposite orientation here?
|
||||||
edges: Ox.UI.EDGES[self.options.orientation],
|
edges: Ox.UI.EDGES[self.options.orientation],
|
||||||
|
|
|
@ -95,7 +95,7 @@ Ox.App = function(options) {
|
||||||
},
|
},
|
||||||
navigator: {
|
navigator: {
|
||||||
cookieEnabled: navigator.cookieEnabled,
|
cookieEnabled: navigator.cookieEnabled,
|
||||||
plugins: $.map(navigator.plugins, function(plugin, i) {
|
plugins: Ox.makeArray(navigator.plugins).map(function(plugin) {
|
||||||
return plugin.name;
|
return plugin.name;
|
||||||
}),
|
}),
|
||||||
userAgent: navigator.userAgent
|
userAgent: navigator.userAgent
|
||||||
|
|
|
@ -15,7 +15,7 @@ Ox.Request = function(options) {
|
||||||
pending = {},
|
pending = {},
|
||||||
requests = {},
|
requests = {},
|
||||||
self = {
|
self = {
|
||||||
options: $.extend({
|
options: Ox.extend({
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/api/'
|
url: '/api/'
|
||||||
|
@ -87,7 +87,7 @@ Ox.Request = function(options) {
|
||||||
@*/
|
@*/
|
||||||
send: function(options) {
|
send: function(options) {
|
||||||
|
|
||||||
var options = $.extend({
|
var options = Ox.extend({
|
||||||
age: -1,
|
age: -1,
|
||||||
callback: null,
|
callback: null,
|
||||||
id: Ox.uid(),
|
id: Ox.uid(),
|
||||||
|
|
|
@ -58,7 +58,7 @@ Ox.Button = function(options, self) {
|
||||||
.mousedown(mousedown)
|
.mousedown(mousedown)
|
||||||
.click(click);
|
.click(click);
|
||||||
|
|
||||||
$.extend(self, Ox.isArray(self.options.title) ? {
|
Ox.extend(self, Ox.isArray(self.options.title) ? {
|
||||||
selectedTitle: Ox.setPropertyOnce(self.options.title, 'selected'),
|
selectedTitle: Ox.setPropertyOnce(self.options.title, 'selected'),
|
||||||
titles: self.options.title
|
titles: self.options.title
|
||||||
} : {
|
} : {
|
||||||
|
|
|
@ -67,7 +67,7 @@ Ox.ButtonGroup = function(options, self) {
|
||||||
self.$buttons[pos].toggleSelected();
|
self.$buttons[pos].toggleSelected();
|
||||||
});
|
});
|
||||||
that.triggerEvent('change', {
|
that.triggerEvent('change', {
|
||||||
selected: $.map(self.optionGroup.selected(), function(v, i) {
|
selected: self.optionGroup.selected().map(function(i) {
|
||||||
return self.options.buttons[v].id;
|
return self.options.buttons[v].id;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,18 +34,18 @@ Ox.CheckboxGroup = function(options, self) {
|
||||||
self.options.max);
|
self.options.max);
|
||||||
self.options.checkboxes = self.optionGroup.init();
|
self.options.checkboxes = self.optionGroup.init();
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
$checkboxes: [],
|
$checkboxes: [],
|
||||||
checkboxWidth: $.map(Ox.divideInt(
|
checkboxWidth: Ox.divideInt(
|
||||||
self.options.width + (self.options.checkboxes.length - 1) * 6,
|
self.options.width + (self.options.checkboxes.length - 1) * 6,
|
||||||
self.options.checkboxes.length
|
self.options.checkboxes.length
|
||||||
), function(v, i) {
|
).map(function(v, i) {
|
||||||
return v + (i < self.options.checkboxes.length - 1 ? 10 : 0);
|
return v + (i < self.options.checkboxes.length - 1 ? 10 : 0);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
self.options.checkboxes.forEach(function(checkbox, position) {
|
self.options.checkboxes.forEach(function(checkbox, position) {
|
||||||
var id = self.options.id + Ox.toTitleCase(checkbox.id)
|
var id = self.options.id + Ox.toTitleCase(checkbox.id)
|
||||||
self.$checkboxes[position] = Ox.Checkbox($.extend(checkbox, {
|
self.$checkboxes[position] = Ox.Checkbox(Ox.extend(checkbox, {
|
||||||
group: true,
|
group: true,
|
||||||
id: id,
|
id: id,
|
||||||
width: self.checkboxWidth[position]
|
width: self.checkboxWidth[position]
|
||||||
|
@ -64,7 +64,7 @@ Ox.CheckboxGroup = function(options, self) {
|
||||||
self.$checkboxes[pos].toggleChecked();
|
self.$checkboxes[pos].toggleChecked();
|
||||||
});
|
});
|
||||||
that.triggerEvent('change', {
|
that.triggerEvent('change', {
|
||||||
checked: $.map(self.optionGroup.checked(), function(v, i) {
|
checked: self.optionGroup.checked().map(function(v) {
|
||||||
return self.options.checkboxes[v].id;
|
return self.options.checkboxes[v].id;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,8 +11,8 @@ Ox.ColorInput <f:Ox.InputGroup> ColorInput Element
|
||||||
@*/
|
@*/
|
||||||
Ox.ColorInput = function(options, self) {
|
Ox.ColorInput = function(options, self) {
|
||||||
|
|
||||||
self = $.extend(self || {}, {
|
self = Ox.extend(self || {}, {
|
||||||
options: $.extend({
|
options: Ox.extend({
|
||||||
id: '',
|
id: '',
|
||||||
value: '0, 0, 0'
|
value: '0, 0, 0'
|
||||||
}, options)
|
}, options)
|
||||||
|
@ -69,7 +69,7 @@ Ox.ColorInput = function(options, self) {
|
||||||
.bindEvent('change', change);
|
.bindEvent('change', change);
|
||||||
|
|
||||||
function change() {
|
function change() {
|
||||||
self.options.value = $.map(self.$inputs, function(v, i) {
|
self.options.value = self.$inputs.map(function(v) {
|
||||||
return v.options('value');
|
return v.options('value');
|
||||||
}).join(', ');
|
}).join(', ');
|
||||||
self.$inputs[3].css({
|
self.$inputs[3].css({
|
||||||
|
|
|
@ -91,10 +91,10 @@ Ox.ColorPicker = function(options, self) {
|
||||||
|
|
||||||
function getColors(index) {
|
function getColors(index) {
|
||||||
return [
|
return [
|
||||||
'rgb(' + $.map(Ox.range(3), function(v) {
|
'rgb(' + Ox.range(3).map(function(v) {
|
||||||
return v == index ? 0 : self.values[v];
|
return v == index ? 0 : self.values[v];
|
||||||
}).join(', ') + ')',
|
}).join(', ') + ')',
|
||||||
'rgb(' + $.map(Ox.range(3), function(v) {
|
'rgb(' + Ox.range(3).map(function(v) {
|
||||||
return v == index ? 255 : self.values[v];
|
return v == index ? 255 : self.values[v];
|
||||||
}).join(', ') + ')'
|
}).join(', ') + ')'
|
||||||
];
|
];
|
||||||
|
|
|
@ -43,15 +43,11 @@ Ox.DateInput = function(options, self) {
|
||||||
weekday: self.options.format == 'long' ? '%A' : '%a',
|
weekday: self.options.format == 'long' ? '%A' : '%a',
|
||||||
year: '%Y'
|
year: '%Y'
|
||||||
},
|
},
|
||||||
months: self.options.format == 'long' ? Ox.MONTHS : $.map(Ox.MONTHS, function(v, i) {
|
months: self.options.format == 'long' ? Ox.MONTHS : Ox.SHORT_MONTHS,
|
||||||
return v.substr(0, 3);
|
weekdays: self.options.format == 'long' ? Ox.WEEKDAYS : Ox.SHORT_WEEKDAYS
|
||||||
}),
|
|
||||||
weekdays: self.options.format == 'long' ? Ox.WEEKDAYS : $.map(Ox.WEEKDAYS, function(v, i) {
|
|
||||||
return v.substr(0, 3);
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
self.$input = $.extend(self.options.weekday ? {
|
self.$input = Ox.extend(self.options.weekday ? {
|
||||||
weekday: Ox.Input({
|
weekday: Ox.Input({
|
||||||
autocomplete: self.weekdays,
|
autocomplete: self.weekdays,
|
||||||
autocompleteReplace: true,
|
autocompleteReplace: true,
|
||||||
|
@ -78,8 +74,8 @@ Ox.DateInput = function(options, self) {
|
||||||
})
|
})
|
||||||
.bindEvent('autocomplete', changeDay),
|
.bindEvent('autocomplete', changeDay),
|
||||||
month: Ox.Input({
|
month: Ox.Input({
|
||||||
autocomplete: self.options.format == 'short' ? $.map(Ox.range(1, 13), function(v, i) {
|
autocomplete: self.options.format == 'short' ? Ox.range(1, 13).map(function(i) {
|
||||||
return Ox.pad(v, 2);
|
return Ox.pad(i, 2);
|
||||||
}) : self.months,
|
}) : self.months,
|
||||||
autocompleteReplace: true,
|
autocompleteReplace: true,
|
||||||
autocompleteReplaceCorrect: true,
|
autocompleteReplaceCorrect: true,
|
||||||
|
@ -90,8 +86,8 @@ Ox.DateInput = function(options, self) {
|
||||||
})
|
})
|
||||||
.bindEvent('autocomplete', changeMonthOrYear),
|
.bindEvent('autocomplete', changeMonthOrYear),
|
||||||
year: Ox.Input({
|
year: Ox.Input({
|
||||||
autocomplete: Ox.merge(Ox.range(1900, 3000), Ox.range(1000, 1900)).map(function(v) {
|
autocomplete: Ox.merge(Ox.range(1900, 3000), Ox.range(1000, 1900)).map(function(i) {
|
||||||
return v.toString();
|
return i.toString();
|
||||||
}),
|
}),
|
||||||
autocompleteReplace: true,
|
autocompleteReplace: true,
|
||||||
autocompleteReplaceCorrect: true,
|
autocompleteReplaceCorrect: true,
|
||||||
|
@ -146,8 +142,8 @@ Ox.DateInput = function(options, self) {
|
||||||
value: Ox.formatDate(new Date([month, day, year].join(' ')), self.formats.weekday)
|
value: Ox.formatDate(new Date([month, day, year].join(' ')), self.formats.weekday)
|
||||||
});
|
});
|
||||||
self.$input.day.options({
|
self.$input.day.options({
|
||||||
autocomplete: $.map(Ox.range(1, days + 1), function(v, i) {
|
autocomplete: Ox.range(1, days + 1).map(function(i) {
|
||||||
return self.options.format == 'short' ? Ox.pad(v, 2) : v.toString();
|
return self.options.format == 'short' ? Ox.pad(i, 2) : i.toString();
|
||||||
}),
|
}),
|
||||||
value: self.options.format == 'short' ? Ox.pad(day, 2) : day.toString()
|
value: self.options.format == 'short' ? Ox.pad(day, 2) : day.toString()
|
||||||
});
|
});
|
||||||
|
@ -163,8 +159,8 @@ Ox.DateInput = function(options, self) {
|
||||||
);
|
);
|
||||||
self.$input.month.options({value: date.month});
|
self.$input.month.options({value: date.month});
|
||||||
self.$input.day.options({
|
self.$input.day.options({
|
||||||
autocomplete: $.map(Ox.range(1, Ox.getDaysInMonth(date.year, date.month) + 1), function(v, i) {
|
autocomplete: Ox.range(1, Ox.getDaysInMonth(date.year, date.month) + 1).map(function(i) {
|
||||||
return self.options.format == 'short' ? Ox.pad(v, 2) : v.toString();
|
return self.options.format == 'short' ? Ox.pad(i, 2) : i.toString();
|
||||||
}),
|
}),
|
||||||
value: date.day
|
value: date.day
|
||||||
});
|
});
|
||||||
|
|
|
@ -397,7 +397,7 @@ Ox.Filter = function(options, self) {
|
||||||
title: key.title
|
title: key.title
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
//items: $.extend({}, self.options.findKeys), // fixme: Ox.Menu messes with keys
|
//items: Ox.extend({}, self.options.findKeys), // fixme: Ox.Menu messes with keys
|
||||||
overlap: 'right',
|
overlap: 'right',
|
||||||
width: 128
|
width: 128
|
||||||
})
|
})
|
||||||
|
|
|
@ -26,7 +26,7 @@ Ox.Form = function(options, self) {
|
||||||
.options(options || {}) // fixme: the || {} can be done once, in the options function
|
.options(options || {}) // fixme: the || {} can be done once, in the options function
|
||||||
.addClass('OxForm');
|
.addClass('OxForm');
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
$items: [],
|
$items: [],
|
||||||
$messages: [],
|
$messages: [],
|
||||||
formIsValid: false,
|
formIsValid: false,
|
||||||
|
|
|
@ -75,7 +75,7 @@ Ox.FormElementGroup = function(options, self) {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.value = function() {
|
that.value = function() {
|
||||||
return $.map(self.options.elements, function(element) {
|
return self.options.elements.map(function(element) {
|
||||||
var ret = null;
|
var ret = null;
|
||||||
['checked', 'selected', 'value'].forEach(function(v) {
|
['checked', 'selected', 'value'].forEach(function(v) {
|
||||||
element[v] && (ret = element[v]());
|
element[v] && (ret = element[v]());
|
||||||
|
|
|
@ -101,7 +101,7 @@ Ox.Input = function(options, self) {
|
||||||
)*/
|
)*/
|
||||||
)
|
)
|
||||||
.css({width: self.options.width + 'px'})
|
.css({width: self.options.width + 'px'})
|
||||||
.bindEvent($.extend(self.options.type == 'textarea' ? {} : {
|
.bindEvent(Ox.extend(self.options.type == 'textarea' ? {} : {
|
||||||
key_enter: submit
|
key_enter: submit
|
||||||
}, {
|
}, {
|
||||||
key_control_v: paste,
|
key_control_v: paste,
|
||||||
|
@ -121,13 +121,13 @@ Ox.Input = function(options, self) {
|
||||||
// fixme: validate self.options.value !
|
// fixme: validate self.options.value !
|
||||||
if (self.options.type == 'float') {
|
if (self.options.type == 'float') {
|
||||||
self.decimals = Ox.repeat('0', self.options.decimals || 1)
|
self.decimals = Ox.repeat('0', self.options.decimals || 1)
|
||||||
$.extend(self.options, {
|
Ox.extend(self.options, {
|
||||||
autovalidate: 'float',
|
autovalidate: 'float',
|
||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
value: self.options.value || '0.' + self.decimals
|
value: self.options.value || '0.' + self.decimals
|
||||||
});
|
});
|
||||||
} else if (self.options.type == 'int') {
|
} else if (self.options.type == 'int') {
|
||||||
$.extend(self.options, {
|
Ox.extend(self.options, {
|
||||||
autovalidate: 'int',
|
autovalidate: 'int',
|
||||||
textAlign: 'right',
|
textAlign: 'right',
|
||||||
value: self.options.value || '0'
|
value: self.options.value || '0'
|
||||||
|
@ -181,7 +181,7 @@ Ox.Input = function(options, self) {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
bindKeyboard: self.options.autocomplete || self.options.autovalidate ||
|
bindKeyboard: self.options.autocomplete || self.options.autovalidate ||
|
||||||
self.options.changeOnKeypress,
|
self.options.changeOnKeypress,
|
||||||
hasPasswordPlaceholder: self.options.type == 'password' && self.options.placeholder,
|
hasPasswordPlaceholder: self.options.type == 'password' && self.options.placeholder,
|
||||||
|
@ -207,7 +207,7 @@ Ox.Input = function(options, self) {
|
||||||
disabled: self.options.disabled ? 'disabled' : '',
|
disabled: self.options.disabled ? 'disabled' : '',
|
||||||
type: self.options.type == 'password' ? 'password' : 'text'
|
type: self.options.type == 'password' ? 'password' : 'text'
|
||||||
})
|
})
|
||||||
.css($.extend({
|
.css(Ox.extend({
|
||||||
width: self.inputWidth + 'px',
|
width: self.inputWidth + 'px',
|
||||||
textAlign: self.options.textAlign
|
textAlign: self.options.textAlign
|
||||||
}, self.options.type == 'textarea' ? {
|
}, self.options.type == 'textarea' ? {
|
||||||
|
@ -223,7 +223,7 @@ Ox.Input = function(options, self) {
|
||||||
// should at least go into ox.ui.theme.foo.js
|
// should at least go into ox.ui.theme.foo.js
|
||||||
// probably better: divs in the background
|
// probably better: divs in the background
|
||||||
if (self.options.type == 'textarea') {
|
if (self.options.type == 'textarea') {
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
colors: Ox.Theme() == 'classic' ?
|
colors: Ox.Theme() == 'classic' ?
|
||||||
[208, 232, 244] :
|
[208, 232, 244] :
|
||||||
//[0, 16, 32],
|
//[0, 16, 32],
|
||||||
|
@ -307,8 +307,8 @@ Ox.Input = function(options, self) {
|
||||||
|
|
||||||
function autocompleteFunction() {
|
function autocompleteFunction() {
|
||||||
var values = Ox.find(self.options.autocomplete, self.options.value);
|
var values = Ox.find(self.options.autocomplete, self.options.value);
|
||||||
return self.options.autocompleteReplace ? values[0] :
|
return self.options.autocompleteReplace
|
||||||
$.merge(values[0], values[1]);
|
? values[0] : Ox.merge(values[0], values[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function autocompleteCallback(values) {
|
function autocompleteCallback(values) {
|
||||||
|
@ -449,7 +449,7 @@ Ox.Input = function(options, self) {
|
||||||
|
|
||||||
function autovalidateFunction(value) {
|
function autovalidateFunction(value) {
|
||||||
var regexp = new RegExp(self.options.autovalidate);
|
var regexp = new RegExp(self.options.autovalidate);
|
||||||
return $.map(value.split(''), function(v) {
|
return value.split('').map(function(v) {
|
||||||
return regexp.test(v) ? v : null;
|
return regexp.test(v) ? v : null;
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
@ -546,7 +546,7 @@ Ox.Input = function(options, self) {
|
||||||
|
|
||||||
function autovalidateFunction(value) {
|
function autovalidateFunction(value) {
|
||||||
var length = value.length;
|
var length = value.length;
|
||||||
return $.map(value.toLowerCase().split(''), function(v, i) {
|
return value.toLowerCase().split('').map(function(v) {
|
||||||
if (new RegExp(self.options.autocorrect).test(v)) {
|
if (new RegExp(self.options.autocorrect).test(v)) {
|
||||||
return v;
|
return v;
|
||||||
} else {
|
} else {
|
||||||
|
@ -885,6 +885,8 @@ Ox.AutocorrectIntFunction = function(min, max, pad, year) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// fixme: remove
|
||||||
|
|
||||||
Ox.Input_ = function(options, self) {
|
Ox.Input_ = function(options, self) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -953,7 +955,7 @@ Ox.Input_ = function(options, self) {
|
||||||
width: self.options.width + 'px'
|
width: self.options.width + 'px'
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
clearWidth: 16,
|
clearWidth: 16,
|
||||||
hasMultipleKeys: Ox.isArray(self.options.label) && 'label' in self.options.label[0],
|
hasMultipleKeys: Ox.isArray(self.options.label) && 'label' in self.options.label[0],
|
||||||
hasMultipleValues: Ox.isArray(self.options.value) &&
|
hasMultipleValues: Ox.isArray(self.options.value) &&
|
||||||
|
@ -977,7 +979,7 @@ Ox.Input_ = function(options, self) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (self.keyName && !self.hasMultipleKeys) {
|
if (self.keyName && !self.hasMultipleKeys) {
|
||||||
self.options[self.keyName] = [$.extend({
|
self.options[self.keyName] = [Ox.extend({
|
||||||
id: '',
|
id: '',
|
||||||
label: self.options[self.keyName],
|
label: self.options[self.keyName],
|
||||||
}, self.keyName == 'label' ? {
|
}, self.keyName == 'label' ? {
|
||||||
|
@ -1027,7 +1029,7 @@ Ox.Input_ = function(options, self) {
|
||||||
width: self.valueWidth
|
width: self.valueWidth
|
||||||
}];
|
}];
|
||||||
} else if (self.options.type == 'range') {
|
} else if (self.options.type == 'range') {
|
||||||
self.options.value = [$.extend({
|
self.options.value = [Ox.extend({
|
||||||
id: '',
|
id: '',
|
||||||
size: self.valueWidth
|
size: self.valueWidth
|
||||||
}, self.options.value)];
|
}, self.options.value)];
|
||||||
|
@ -1231,7 +1233,7 @@ Ox.Input_ = function(options, self) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
that.$input[i]
|
that.$input[i]
|
||||||
.css($.extend({}, self.options.value.length > 1 ? {
|
.css(Ox.extend({}, self.options.value.length > 1 ? {
|
||||||
float: 'left',
|
float: 'left',
|
||||||
marginLeft: -Ox.sum($.map(self.options.value, function(v_, i_) {
|
marginLeft: -Ox.sum($.map(self.options.value, function(v_, i_) {
|
||||||
return i_ > i ? self.options.value[i_ - 1].width + self.options.separatorWidth[i_ - 1] : (i_ == i ? 16 : 0);
|
return i_ > i ? self.options.value[i_ - 1].width + self.options.separatorWidth[i_ - 1] : (i_ == i ? 16 : 0);
|
||||||
|
@ -1411,7 +1413,7 @@ Ox.InputElement_ = function(options, self) {
|
||||||
that.bindEvent('click_' + self.autosuggestId, clickMenu);
|
that.bindEvent('click_' + self.autosuggestId, clickMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
that.bindEvent($.extend(self.options.type == 'textarea' ? {} : {
|
that.bindEvent(Ox.extend(self.options.type == 'textarea' ? {} : {
|
||||||
key_enter: submit
|
key_enter: submit
|
||||||
}, {
|
}, {
|
||||||
key_escape: cancel
|
key_escape: cancel
|
||||||
|
@ -1488,7 +1490,7 @@ Ox.InputElement_ = function(options, self) {
|
||||||
index > -1 && values[index == 0 ? 0 : 1].push(v);
|
index > -1 && values[index == 0 ? 0 : 1].push(v);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return $.merge(values[0], values[1]);
|
return Ox.merge(values[0], values[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function autosuggestCall() {
|
function autosuggestCall() {
|
||||||
|
@ -1555,7 +1557,7 @@ Ox.InputElement_ = function(options, self) {
|
||||||
function autovalidateCallback(data, blur) {
|
function autovalidateCallback(data, blur) {
|
||||||
if (data.valid != self.valid) {
|
if (data.valid != self.valid) {
|
||||||
self.valid = data.valid;
|
self.valid = data.valid;
|
||||||
that.triggerEvent('validate', $.extend(data, {
|
that.triggerEvent('validate', Ox.extend(data, {
|
||||||
blur: blur
|
blur: blur
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -1693,7 +1695,7 @@ Ox.Range_ = function(options, self) {
|
||||||
value: 0,
|
value: 0,
|
||||||
valueNames: null
|
valueNames: null
|
||||||
})
|
})
|
||||||
.options($.extend(options, {
|
.options(Ox.extend(options, {
|
||||||
arrowStep: options.arrowStep ?
|
arrowStep: options.arrowStep ?
|
||||||
options.arrowStep : options.step,
|
options.arrowStep : options.step,
|
||||||
trackImages: $.makeArray(options.trackImages || [])
|
trackImages: $.makeArray(options.trackImages || [])
|
||||||
|
|
|
@ -35,10 +35,7 @@ Ox.InputGroup = function(options, self) {
|
||||||
width: self.options.width + 'px'
|
width: self.options.width + 'px'
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend(self, {
|
self.$separator = [];
|
||||||
//$input: [],
|
|
||||||
$separator: []
|
|
||||||
});
|
|
||||||
|
|
||||||
self.options.separators.forEach(function(v, i) {
|
self.options.separators.forEach(function(v, i) {
|
||||||
self.options.id == 'debug' && Ox.print('separator #' + i + ' ' + self.options.inputs[i].options('id') + ' ' + self.options.inputs[i].options('width'))
|
self.options.id == 'debug' && Ox.print('separator #' + i + ' ' + self.options.inputs[i].options('id') + ' ' + self.options.inputs[i].options('width'))
|
||||||
|
@ -60,7 +57,7 @@ Ox.InputGroup = function(options, self) {
|
||||||
parent: that
|
parent: that
|
||||||
})
|
})
|
||||||
.css({
|
.css({
|
||||||
marginLeft: -Ox.sum($.map(self.options.inputs, function(v_, i_) {
|
marginLeft: -Ox.sum(self.options.inputs.map(function(v_, i_) {
|
||||||
return i_ > i ? self.options.inputs[i_ - 1].options('width') +
|
return i_ > i ? self.options.inputs[i_ - 1].options('width') +
|
||||||
self.options.separators[i_ - 1].width : (i_ == i ? 16 : 0);
|
self.options.separators[i_ - 1].width : (i_ == i ? 16 : 0);
|
||||||
})) + 'px'
|
})) + 'px'
|
||||||
|
@ -129,7 +126,7 @@ Ox.InputGroup = function(options, self) {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.value = function() {
|
that.value = function() {
|
||||||
return $.map(self.options.inputs, function(input) {
|
return self.options.inputs.map(function(input) {
|
||||||
var ret = null;
|
var ret = null;
|
||||||
['checked', 'selected', 'value'].forEach(function(v) {
|
['checked', 'selected', 'value'].forEach(function(v) {
|
||||||
input[v] && (ret = input[v]());
|
input[v] && (ret = input[v]());
|
||||||
|
|
|
@ -25,7 +25,7 @@ Ox.Label = function(options, self) {
|
||||||
(self.options.overlap != 'none' ?
|
(self.options.overlap != 'none' ?
|
||||||
' OxOverlap' + Ox.toTitleCase(self.options.overlap) : '')
|
' OxOverlap' + Ox.toTitleCase(self.options.overlap) : '')
|
||||||
)
|
)
|
||||||
.css($.extend(self.options.width == 'auto' ? {} : {
|
.css(Ox.extend(self.options.width == 'auto' ? {} : {
|
||||||
width: self.options.width - 14 + 'px' // fixme: why 14????
|
width: self.options.width - 14 + 'px' // fixme: why 14????
|
||||||
}, {
|
}, {
|
||||||
textAlign: self.options.textAlign
|
textAlign: self.options.textAlign
|
||||||
|
|
|
@ -21,12 +21,12 @@ Ox.OptionGroup = function(items, min, max, property) {
|
||||||
function getLastBefore(pos) {
|
function getLastBefore(pos) {
|
||||||
// returns the position of the last checked item before position pos
|
// returns the position of the last checked item before position pos
|
||||||
var last = -1;
|
var last = -1;
|
||||||
/*Ox.print(items, items.length, length, $.merge(
|
/*Ox.print(items, items.length, length, Ox.merge(
|
||||||
pos > 0 ? Ox.range(pos - 1, -1, -1) : [],
|
pos > 0 ? Ox.range(pos - 1, -1, -1) : [],
|
||||||
pos < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : []
|
pos < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : []
|
||||||
))*/
|
))*/
|
||||||
// fixme: why is length not == items.length here?
|
// fixme: why is length not == items.length here?
|
||||||
Ox.forEach($.merge(
|
Ox.forEach(Ox.merge(
|
||||||
pos > 0 ? Ox.range(pos - 1, -1, -1) : [],
|
pos > 0 ? Ox.range(pos - 1, -1, -1) : [],
|
||||||
pos < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : []
|
pos < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : []
|
||||||
), function(v) {
|
), function(v) {
|
||||||
|
|
|
@ -14,8 +14,8 @@ Ox.PlaceInput <f:Ox.FormElementGroup> PlaceInput Object
|
||||||
Ox.PlaceInput = function(options, self) {
|
Ox.PlaceInput = function(options, self) {
|
||||||
|
|
||||||
var that;
|
var that;
|
||||||
self = $.extend(self || {}, {
|
self = Ox.extend(self || {}, {
|
||||||
options: $.extend({
|
options: Ox.extend({
|
||||||
id: '',
|
id: '',
|
||||||
value: 'United States'
|
value: 'United States'
|
||||||
}, options)
|
}, options)
|
||||||
|
|
|
@ -14,8 +14,8 @@ Ox.PlacePicker <f:Ox.Element> PlacePicker Object
|
||||||
Ox.PlacePicker = function(options, self) {
|
Ox.PlacePicker = function(options, self) {
|
||||||
|
|
||||||
var that;
|
var that;
|
||||||
self = $.extend(self || {}, {
|
self = Ox.extend(self || {}, {
|
||||||
options: $.extend({
|
options: Ox.extend({
|
||||||
id: '',
|
id: '',
|
||||||
value: 'United States'
|
value: 'United States'
|
||||||
}, options)
|
}, options)
|
||||||
|
|
|
@ -45,7 +45,7 @@ Ox.Range = function(options, self) {
|
||||||
value: 0,
|
value: 0,
|
||||||
valueNames: null,
|
valueNames: null,
|
||||||
})
|
})
|
||||||
.options($.extend(options, {
|
.options(Ox.extend(options, {
|
||||||
arrowStep: options.arrowStep ?
|
arrowStep: options.arrowStep ?
|
||||||
options.arrowStep : options.step,
|
options.arrowStep : options.step,
|
||||||
trackImages: $.makeArray(options.trackImages || [])
|
trackImages: $.makeArray(options.trackImages || [])
|
||||||
|
@ -55,7 +55,7 @@ Ox.Range = function(options, self) {
|
||||||
width: self.options.size + 'px'
|
width: self.options.size + 'px'
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
trackColors: self.options.trackColors.length,
|
trackColors: self.options.trackColors.length,
|
||||||
trackImages: self.options.trackImages.length,
|
trackImages: self.options.trackImages.length,
|
||||||
values: (self.options.max - self.options.min + self.options.step) /
|
values: (self.options.max - self.options.min + self.options.step) /
|
||||||
|
@ -86,7 +86,7 @@ Ox.Range = function(options, self) {
|
||||||
|
|
||||||
self.$track = Ox.Element()
|
self.$track = Ox.Element()
|
||||||
.addClass('OxTrack')
|
.addClass('OxTrack')
|
||||||
.css($.extend({
|
.css(Ox.extend({
|
||||||
width: (self.trackSize - 2) + 'px'
|
width: (self.trackSize - 2) + 'px'
|
||||||
}, self.trackImages == 1 ? {
|
}, self.trackImages == 1 ? {
|
||||||
background: 'rgb(0, 0, 0)'
|
background: 'rgb(0, 0, 0)'
|
||||||
|
@ -224,11 +224,11 @@ Ox.Range = function(options, self) {
|
||||||
self.$track.css({
|
self.$track.css({
|
||||||
backgroundImage: $.browser.mozilla ?
|
backgroundImage: $.browser.mozilla ?
|
||||||
('-moz-linear-gradient(left, ' +
|
('-moz-linear-gradient(left, ' +
|
||||||
self.options.trackColors[0] + ' 0%, ' + $.map(self.options.trackColors, function(v, i) {
|
self.options.trackColors[0] + ' 0%, ' + self.options.trackColors.map(function(v, i) {
|
||||||
return v + ' ' + ((self.trackColorsStart + self.trackColorsStep * i) * 100) + '%';
|
return v + ' ' + ((self.trackColorsStart + self.trackColorsStep * i) * 100) + '%';
|
||||||
}).join(', ') + ', ' + self.options.trackColors[self.trackColors - 1] + ' 100%)') :
|
}).join(', ') + ', ' + self.options.trackColors[self.trackColors - 1] + ' 100%)') :
|
||||||
('-webkit-gradient(linear, left top, right top, color-stop(0, ' +
|
('-webkit-gradient(linear, left top, right top, color-stop(0, ' +
|
||||||
self.options.trackColors[0] + '), ' + $.map(self.options.trackColors, function(v, i) {
|
self.options.trackColors[0] + '), ' + self.options.trackColors.map(function(v, i) {
|
||||||
return 'color-stop(' + (self.trackColorsStart + self.trackColorsStep * i) + ', ' + v + ')';
|
return 'color-stop(' + (self.trackColorsStart + self.trackColorsStep * i) + ', ' + v + ')';
|
||||||
}).join(', ') + ', color-stop(1, ' + self.options.trackColors[self.trackColors - 1] + '))')
|
}).join(', ') + ', color-stop(1, ' + self.options.trackColors[self.trackColors - 1] + '))')
|
||||||
});
|
});
|
||||||
|
|
|
@ -59,7 +59,7 @@ Ox.Select = function(options, self) {
|
||||||
|
|
||||||
//Ox.print('Ox.Select', self.options);
|
//Ox.print('Ox.Select', self.options);
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
buttonId: self.options.id + 'Button',
|
buttonId: self.options.id + 'Button',
|
||||||
groupId: self.options.id + 'Group',
|
groupId: self.options.id + 'Group',
|
||||||
menuId: self.options.id + 'Menu'
|
menuId: self.options.id + 'Menu'
|
||||||
|
@ -180,7 +180,7 @@ Ox.Select = function(options, self) {
|
||||||
() -> <o> returns object of selected items with id, title
|
() -> <o> returns object of selected items with id, title
|
||||||
@*/
|
@*/
|
||||||
that.selected = function() {
|
that.selected = function() {
|
||||||
return $.map(/*self.checked*/self.optionGroup.checked(), function(v) {
|
return /*self.checked*/self.optionGroup.checked().map(function(v) {
|
||||||
return {
|
return {
|
||||||
id: self.options.items[v].id,
|
id: self.options.items[v].id,
|
||||||
title: self.options.items[v].title
|
title: self.options.items[v].title
|
||||||
|
|
|
@ -40,7 +40,7 @@ Ox.IconItem = function(options, self) {
|
||||||
})
|
})
|
||||||
.options(options || {});
|
.options(options || {});
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
fontSize: self.options.itemWidth == 64 ? 6 : 9,
|
fontSize: self.options.itemWidth == 64 ? 6 : 9,
|
||||||
lineLength: self.options.itemWidth == 64 ? 15 : 23,
|
lineLength: self.options.itemWidth == 64 ? 15 : 23,
|
||||||
lines: self.options.itemWidth == 64 ? 4 : 5,
|
lines: self.options.itemWidth == 64 ? 4 : 5,
|
||||||
|
@ -135,11 +135,11 @@ Ox.IconItem = function(options, self) {
|
||||||
|
|
||||||
function formatText(text, maxLines, maxLength) {
|
function formatText(text, maxLines, maxLength) {
|
||||||
var lines = Ox.wordwrap(text, maxLength, '<br/>', true, false).split('<br/>');
|
var lines = Ox.wordwrap(text, maxLength, '<br/>', true, false).split('<br/>');
|
||||||
return $.map(lines, function(line, i) {
|
return lines.map(function(line, i) {
|
||||||
if (i < maxLines - 1) {
|
if (i < maxLines - 1) {
|
||||||
return line;
|
return line;
|
||||||
} else if (i == maxLines - 1) {
|
} else if (i == maxLines - 1) {
|
||||||
return lines.length == maxLines ? line : Ox.truncate($.map(lines, function(line, i) {
|
return lines.length == maxLines ? line : Ox.truncate(lines.map(function(line, i) {
|
||||||
return i < maxLines - 1 ? null : line;
|
return i < maxLines - 1 ? null : line;
|
||||||
}).join(' '), maxLength, '...', 'center');
|
}).join(' '), maxLength, '...', 'center');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -76,7 +76,7 @@ Ox.IconList = function(options, self) {
|
||||||
sort: self.options.sort,
|
sort: self.options.sort,
|
||||||
type: 'icon',
|
type: 'icon',
|
||||||
unique: self.options.unique
|
unique: self.options.unique
|
||||||
}, $.extend({}, self)) // pass event handler
|
}, Ox.extend({}, self)) // pass event handler
|
||||||
.addClass('OxIconList Ox' + Ox.toTitleCase(self.options.orientation))
|
.addClass('OxIconList Ox' + Ox.toTitleCase(self.options.orientation))
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
select: function() {
|
select: function() {
|
||||||
|
@ -113,7 +113,7 @@ Ox.IconList = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateKeys() {
|
function updateKeys() {
|
||||||
self.options.keys = Ox.unique($.merge(self.options.keys, [self.options.sort[0].key]));
|
self.options.keys = Ox.unique(Ox.merge(self.options.keys, [self.options.sort[0].key]));
|
||||||
that.$element.options({
|
that.$element.options({
|
||||||
keys: self.options.keys
|
keys: self.options.keys
|
||||||
});
|
});
|
||||||
|
|
|
@ -131,7 +131,7 @@ Ox.InfoList = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateKeys() {
|
function updateKeys() {
|
||||||
self.options.keys = Ox.unique($.merge(self.options.keys, [self.options.sort[0].key]));
|
self.options.keys = Ox.unique(Ox.merge(self.options.keys, [self.options.sort[0].key]));
|
||||||
that.$element.options({
|
that.$element.options({
|
||||||
keys: self.options.keys
|
keys: self.options.keys
|
||||||
});
|
});
|
||||||
|
|
|
@ -97,7 +97,7 @@ Ox.List = function(options, self) {
|
||||||
// fixme: without this, horizontal lists don't get their full width
|
// fixme: without this, horizontal lists don't get their full width
|
||||||
self.options.orientation == 'horizontal' && that.$content.css({height: '1px'});
|
self.options.orientation == 'horizontal' && that.$content.css({height: '1px'});
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
$items: [],
|
$items: [],
|
||||||
$pages: [],
|
$pages: [],
|
||||||
format: {},
|
format: {},
|
||||||
|
@ -144,11 +144,11 @@ Ox.List = function(options, self) {
|
||||||
return item['_index'];
|
return item['_index'];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
self.options.max == -1 && $.extend(self.keyboardEvents, {
|
self.options.max == -1 && Ox.extend(self.keyboardEvents, {
|
||||||
key_alt_control_a: invertSelection,
|
key_alt_control_a: invertSelection,
|
||||||
key_control_a: selectAll
|
key_control_a: selectAll
|
||||||
});
|
});
|
||||||
self.options.min == 0 && $.extend(self.keyboardEvents, {
|
self.options.min == 0 && Ox.extend(self.keyboardEvents, {
|
||||||
key_control_shift_a: selectNone
|
key_control_shift_a: selectNone
|
||||||
});
|
});
|
||||||
self.keyboardEvents[
|
self.keyboardEvents[
|
||||||
|
@ -180,7 +180,7 @@ Ox.List = function(options, self) {
|
||||||
key_up: selectAbove
|
key_up: selectAbove
|
||||||
});
|
});
|
||||||
if (self.options.max == -1) {
|
if (self.options.max == -1) {
|
||||||
$.extend(self.keyboardEvents, {
|
Ox.extend(self.keyboardEvents, {
|
||||||
key_shift_down: addBelowToSelection,
|
key_shift_down: addBelowToSelection,
|
||||||
key_shift_up: addAboveToSelection
|
key_shift_up: addAboveToSelection
|
||||||
});
|
});
|
||||||
|
@ -290,7 +290,7 @@ Ox.List = function(options, self) {
|
||||||
self.requests.forEach(function(v) {
|
self.requests.forEach(function(v) {
|
||||||
Ox.Request.cancel(v);
|
Ox.Request.cancel(v);
|
||||||
});
|
});
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
//$items: [],
|
//$items: [],
|
||||||
$pages: [],
|
$pages: [],
|
||||||
page: 0,
|
page: 0,
|
||||||
|
@ -317,7 +317,7 @@ Ox.List = function(options, self) {
|
||||||
/*
|
/*
|
||||||
ids.length && self.options.copy && Ox.Clipboard.copy(
|
ids.length && self.options.copy && Ox.Clipboard.copy(
|
||||||
self.options.copy(
|
self.options.copy(
|
||||||
$.map(ids, function(id) {
|
ids.map(function(id) {
|
||||||
return that.value(id);
|
return that.value(id);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -700,7 +700,10 @@ Ox.List = function(options, self) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ox.print(that.id, 'loadPage', page);
|
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,
|
offset = page * self.pageLength,
|
||||||
range = [offset, offset + getPageLength(page)];
|
range = [offset, offset + getPageLength(page)];
|
||||||
if (Ox.isUndefined(self.$pages[page])) { // fixme: unload will have made this undefined already
|
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 = {
|
self.drag = {
|
||||||
pos: findItemPosition(e)
|
pos: findItemPosition(e)
|
||||||
};
|
};
|
||||||
$.extend(self.drag, {
|
Ox.extend(self.drag, {
|
||||||
id: self.$items[self.drag.pos].options('data')[self.options.unique],
|
id: self.$items[self.drag.pos].options('data')[self.options.unique],
|
||||||
startPos: self.drag.pos,
|
startPos: self.drag.pos,
|
||||||
startY: e.clientY,
|
startY: e.clientY,
|
||||||
|
@ -962,7 +965,6 @@ Ox.List = function(options, self) {
|
||||||
$item.data({position: pos});
|
$item.data({position: pos});
|
||||||
});
|
});
|
||||||
self.selected = [stopPos];
|
self.selected = [stopPos];
|
||||||
//Ox.print('ids', self.ids, $.map(self.$items, function(v, i) { return v.data('id'); }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function open() {
|
function open() {
|
||||||
|
@ -1201,7 +1203,7 @@ Ox.List = function(options, self) {
|
||||||
|
|
||||||
function triggerClickEvent(event, $item, $cell) {
|
function triggerClickEvent(event, $item, $cell) {
|
||||||
// event can be 'click' or 'edit'
|
// event can be 'click' or 'edit'
|
||||||
that.triggerEvent(event, $.extend({
|
that.triggerEvent(event, Ox.extend({
|
||||||
id: $item.data('id')
|
id: $item.data('id')
|
||||||
}, $cell ? {
|
}, $cell ? {
|
||||||
key: $cell.attr('class').split('OxColumn')[1].split(' ')[0].toLowerCase()
|
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
|
// only used if orientation is both
|
||||||
clear();
|
clear();
|
||||||
self.pageLength = self.pageLengthByRowLength[self.rowLength]
|
self.pageLength = self.pageLengthByRowLength[self.rowLength]
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
listSize: getListSize(),
|
listSize: getListSize(),
|
||||||
pages: Math.ceil(self.listLength / self.pageLength),
|
pages: Math.ceil(self.listLength / self.pageLength),
|
||||||
pageWidth: (self.options.itemWidth + self.itemMargin) * self.rowLength,
|
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.options.items.splice.apply(self.options.items, Ox.merge([pos, 0], items));
|
||||||
self.$items.splice.apply(self.$items, $.merge([pos, 0], $items));
|
self.$items.splice.apply(self.$items, Ox.merge([pos, 0], $items));
|
||||||
//if(first)
|
//if(first)
|
||||||
loadItems();
|
loadItems();
|
||||||
updatePositions();
|
updatePositions();
|
||||||
|
|
|
@ -48,7 +48,7 @@ Ox.TreeList = function(options, self) {
|
||||||
max: self.options.max,
|
max: self.options.max,
|
||||||
min: self.options.min,
|
min: self.options.min,
|
||||||
unique: 'id'
|
unique: 'id'
|
||||||
}, $.extend({}, self))
|
}, Ox.extend({}, self))
|
||||||
.addClass('OxTextList OxTreeList')
|
.addClass('OxTextList OxTreeList')
|
||||||
.css({
|
.css({
|
||||||
width: self.options.width + 'px'
|
width: self.options.width + 'px'
|
||||||
|
@ -119,7 +119,7 @@ Ox.TreeList = function(options, self) {
|
||||||
level = level || 0;
|
level = level || 0;
|
||||||
Ox.forEach(items, function(item) {
|
Ox.forEach(items, function(item) {
|
||||||
if (item.id == id) {
|
if (item.id == id) {
|
||||||
ret = $.extend(item, {
|
ret = Ox.extend(item, {
|
||||||
level: level
|
level: level
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
@ -177,7 +177,7 @@ Ox.TreeList = function(options, self) {
|
||||||
var $img, pos;
|
var $img, pos;
|
||||||
item.expanded = expanded;
|
item.expanded = expanded;
|
||||||
//getItemById(item.id).expanded = expanded;
|
//getItemById(item.id).expanded = expanded;
|
||||||
$.each(that.$element.find('.OxItem'), function() {
|
that.$element.find('.OxItem').each(function() {
|
||||||
var $item = $(this);
|
var $item = $(this);
|
||||||
if ($item.data('id') == item.id) {
|
if ($item.data('id') == item.id) {
|
||||||
$img = $item.find('.OxToggle');
|
$img = $item.find('.OxToggle');
|
||||||
|
|
|
@ -28,7 +28,7 @@ Ox.MapImage = function(options, self) {
|
||||||
})
|
})
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
markers: {
|
markers: {
|
||||||
highlight: [],
|
highlight: [],
|
||||||
normal: []
|
normal: []
|
||||||
|
|
|
@ -38,7 +38,7 @@ Ox.MainMenu = function(options, self) {
|
||||||
.html(menu.title)
|
.html(menu.title)
|
||||||
.data('position', position)
|
.data('position', position)
|
||||||
.appendTo(that.$element);
|
.appendTo(that.$element);
|
||||||
that.menus[position] = Ox.Menu($.extend(menu, {
|
that.menus[position] = Ox.Menu(Ox.extend(menu, {
|
||||||
element: that.titles[position],
|
element: that.titles[position],
|
||||||
mainmenu: that,
|
mainmenu: that,
|
||||||
size: self.options.size
|
size: self.options.size
|
||||||
|
|
|
@ -133,7 +133,7 @@ Ox.Menu = function(options, self) {
|
||||||
});
|
});
|
||||||
menu.triggerEvent('change', {
|
menu.triggerEvent('change', {
|
||||||
id: item.options('group'),
|
id: item.options('group'),
|
||||||
checked: $.map(self.optionGroups[item.options('group')].checked(), function(v, i) {
|
checked: self.optionGroups[item.options('group')].checked().map(function(v) {
|
||||||
return {
|
return {
|
||||||
id: that.items[v].options('id'),
|
id: that.items[v].options('id'),
|
||||||
title: Ox.stripTags(that.items[v].options('title')[0])
|
title: Ox.stripTags(that.items[v].options('title')[0])
|
||||||
|
|
|
@ -34,7 +34,7 @@ Ox.SplitPanel = function(options, self) {
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
.addClass('OxSplitPanel');
|
.addClass('OxSplitPanel');
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
dimensions: Ox.UI.DIMENSIONS[self.options.orientation],
|
dimensions: Ox.UI.DIMENSIONS[self.options.orientation],
|
||||||
edges: Ox.UI.EDGES[self.options.orientation],
|
edges: Ox.UI.EDGES[self.options.orientation],
|
||||||
length: self.options.elements.length,
|
length: self.options.elements.length,
|
||||||
|
@ -45,7 +45,7 @@ Ox.SplitPanel = function(options, self) {
|
||||||
// create elements
|
// create elements
|
||||||
that.$elements = [];
|
that.$elements = [];
|
||||||
self.options.elements.forEach(function(v, i) {
|
self.options.elements.forEach(function(v, i) {
|
||||||
self.options.elements[i] = $.extend({
|
self.options.elements[i] = Ox.extend({
|
||||||
collapsible: false,
|
collapsible: false,
|
||||||
collapsed: false,
|
collapsed: false,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
|
|
|
@ -59,7 +59,7 @@ Ox.AnnotationPanel = function(options, self) {
|
||||||
.addClass('OxAnnotation OxEditable OxTarget')
|
.addClass('OxAnnotation OxEditable OxTarget')
|
||||||
.html(Ox.parseHTML(data.value));
|
.html(Ox.parseHTML(data.value));
|
||||||
},
|
},
|
||||||
items: $.map(self.options.items, function(v, i) {
|
items: self.options.items.map(function(v, i) {
|
||||||
return {
|
return {
|
||||||
id: v.id || i + '',
|
id: v.id || i + '',
|
||||||
value: v.value
|
value: v.value
|
||||||
|
|
|
@ -34,7 +34,7 @@ Ox.BlockTimeline = function(options, self) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
$images: [],
|
$images: [],
|
||||||
$lines: [],
|
$lines: [],
|
||||||
$markerPoint: [],
|
$markerPoint: [],
|
||||||
|
@ -157,7 +157,7 @@ Ox.BlockTimeline = function(options, self) {
|
||||||
context = canvas.getContext('2d'),
|
context = canvas.getContext('2d'),
|
||||||
imageData = context.createImageData(width, height),
|
imageData = context.createImageData(width, height),
|
||||||
data = imageData.data,
|
data = imageData.data,
|
||||||
points = $.map(self.options.points, function(v, i) {
|
points = self.options.points.map(function(v, i) {
|
||||||
return Math.round(v) + i;
|
return Math.round(v) + i;
|
||||||
}),
|
}),
|
||||||
top = 0,
|
top = 0,
|
||||||
|
|
|
@ -35,7 +35,7 @@ Ox.LargeTimeline = function(options, self) {
|
||||||
drag: drag
|
drag: drag
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
$cuts: [],
|
$cuts: [],
|
||||||
$markerPoint: [],
|
$markerPoint: [],
|
||||||
$subtitles: [],
|
$subtitles: [],
|
||||||
|
|
|
@ -34,7 +34,7 @@ Ox.SmallTimeline = function(options, self) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$.extend(self, {
|
Ox.extend(self, {
|
||||||
$images: [],
|
$images: [],
|
||||||
$markerPoint: [],
|
$markerPoint: [],
|
||||||
$subtitles: [],
|
$subtitles: [],
|
||||||
|
|
|
@ -262,7 +262,7 @@ Ox.VideoEditor = function(options, self) {
|
||||||
|
|
||||||
self.options.layers.forEach(function(layer, i) {
|
self.options.layers.forEach(function(layer, i) {
|
||||||
self.$annotationPanel[i] = Ox.AnnotationPanel(
|
self.$annotationPanel[i] = Ox.AnnotationPanel(
|
||||||
$.extend({
|
Ox.extend({
|
||||||
width: self.options.annotationSize
|
width: self.options.annotationSize
|
||||||
}, layer)
|
}, layer)
|
||||||
)
|
)
|
||||||
|
@ -707,11 +707,11 @@ Ox.VideoEditor = function(options, self) {
|
||||||
if (type == 'cut') {
|
if (type == 'cut') {
|
||||||
positions = self.options.cuts;
|
positions = self.options.cuts;
|
||||||
} else if (type == 'result') {
|
} else if (type == 'result') {
|
||||||
positions = $.map(self.results, function(v, i) {
|
positions = self.results.map(function(v) {
|
||||||
return v['in'];
|
return v['in'];
|
||||||
});
|
});
|
||||||
} else if (type == 'subtitle') {
|
} else if (type == 'subtitle') {
|
||||||
positions = $.map(self.options.subtitles, function(v, i) {
|
positions = self.options.subtitles.map(function(v) {
|
||||||
return v['in'];
|
return v['in'];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
24
source/Ox.js
24
source/Ox.js
|
@ -483,30 +483,6 @@ Ox.count = function(arr) {
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
//@ Ox.each <f> (deprecated)
|
|
||||||
Ox.each = function(obj, fn) {
|
|
||||||
// fixme: deprecate!
|
|
||||||
/*
|
|
||||||
Ox.each() works for arrays, objects and strings,
|
|
||||||
like $.each(), unlike [].forEach()
|
|
||||||
>>> Ox.each([0, 1, 2], function(i, v) {})
|
|
||||||
[0, 1, 2]
|
|
||||||
>>> Ox.each({a: 1, b: 2, c: 3}, function(k, v) {}).a
|
|
||||||
1
|
|
||||||
>>> Ox.each('foo', function(i, v) {})
|
|
||||||
'foo'
|
|
||||||
*/
|
|
||||||
var i, isArray = Ox.isArray(obj);
|
|
||||||
for (i in obj) {
|
|
||||||
i = isArray ? parseInt(i) : i;
|
|
||||||
// fixme: should be (v, k), like [].forEach()
|
|
||||||
if (fn(i, obj[i]) === false) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
Ox.every <f> Tests if every element of a collection satisfies a given condition
|
Ox.every <f> Tests if every element of a collection satisfies a given condition
|
||||||
Unlike <code>[].every()</code>, <code>Ox.every()</code> works for arrays,
|
Unlike <code>[].every()</code>, <code>Ox.every()</code> works for arrays,
|
||||||
|
|
Loading…
Reference in a new issue