forked from 0x2620/oxjs
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
|
|
@ -101,7 +101,7 @@ Ox.Input = function(options, self) {
|
|||
)*/
|
||||
)
|
||||
.css({width: self.options.width + 'px'})
|
||||
.bindEvent($.extend(self.options.type == 'textarea' ? {} : {
|
||||
.bindEvent(Ox.extend(self.options.type == 'textarea' ? {} : {
|
||||
key_enter: submit
|
||||
}, {
|
||||
key_control_v: paste,
|
||||
|
|
@ -121,13 +121,13 @@ Ox.Input = function(options, self) {
|
|||
// fixme: validate self.options.value !
|
||||
if (self.options.type == 'float') {
|
||||
self.decimals = Ox.repeat('0', self.options.decimals || 1)
|
||||
$.extend(self.options, {
|
||||
Ox.extend(self.options, {
|
||||
autovalidate: 'float',
|
||||
textAlign: 'right',
|
||||
value: self.options.value || '0.' + self.decimals
|
||||
});
|
||||
} else if (self.options.type == 'int') {
|
||||
$.extend(self.options, {
|
||||
Ox.extend(self.options, {
|
||||
autovalidate: 'int',
|
||||
textAlign: 'right',
|
||||
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 ||
|
||||
self.options.changeOnKeypress,
|
||||
hasPasswordPlaceholder: self.options.type == 'password' && self.options.placeholder,
|
||||
|
|
@ -207,7 +207,7 @@ Ox.Input = function(options, self) {
|
|||
disabled: self.options.disabled ? 'disabled' : '',
|
||||
type: self.options.type == 'password' ? 'password' : 'text'
|
||||
})
|
||||
.css($.extend({
|
||||
.css(Ox.extend({
|
||||
width: self.inputWidth + 'px',
|
||||
textAlign: self.options.textAlign
|
||||
}, self.options.type == 'textarea' ? {
|
||||
|
|
@ -223,7 +223,7 @@ Ox.Input = function(options, self) {
|
|||
// should at least go into ox.ui.theme.foo.js
|
||||
// probably better: divs in the background
|
||||
if (self.options.type == 'textarea') {
|
||||
$.extend(self, {
|
||||
Ox.extend(self, {
|
||||
colors: Ox.Theme() == 'classic' ?
|
||||
[208, 232, 244] :
|
||||
//[0, 16, 32],
|
||||
|
|
@ -307,8 +307,8 @@ Ox.Input = function(options, self) {
|
|||
|
||||
function autocompleteFunction() {
|
||||
var values = Ox.find(self.options.autocomplete, self.options.value);
|
||||
return self.options.autocompleteReplace ? values[0] :
|
||||
$.merge(values[0], values[1]);
|
||||
return self.options.autocompleteReplace
|
||||
? values[0] : Ox.merge(values[0], values[1]);
|
||||
}
|
||||
|
||||
function autocompleteCallback(values) {
|
||||
|
|
@ -449,7 +449,7 @@ Ox.Input = function(options, self) {
|
|||
|
||||
function autovalidateFunction(value) {
|
||||
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;
|
||||
}).join('');
|
||||
}
|
||||
|
|
@ -546,7 +546,7 @@ Ox.Input = function(options, self) {
|
|||
|
||||
function autovalidateFunction(value) {
|
||||
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)) {
|
||||
return v;
|
||||
} else {
|
||||
|
|
@ -885,6 +885,8 @@ Ox.AutocorrectIntFunction = function(min, max, pad, year) {
|
|||
};
|
||||
};
|
||||
|
||||
// fixme: remove
|
||||
|
||||
Ox.Input_ = function(options, self) {
|
||||
|
||||
/*
|
||||
|
|
@ -953,7 +955,7 @@ Ox.Input_ = function(options, self) {
|
|||
width: self.options.width + 'px'
|
||||
});
|
||||
|
||||
$.extend(self, {
|
||||
Ox.extend(self, {
|
||||
clearWidth: 16,
|
||||
hasMultipleKeys: Ox.isArray(self.options.label) && 'label' in self.options.label[0],
|
||||
hasMultipleValues: Ox.isArray(self.options.value) &&
|
||||
|
|
@ -977,7 +979,7 @@ Ox.Input_ = function(options, self) {
|
|||
});
|
||||
|
||||
if (self.keyName && !self.hasMultipleKeys) {
|
||||
self.options[self.keyName] = [$.extend({
|
||||
self.options[self.keyName] = [Ox.extend({
|
||||
id: '',
|
||||
label: self.options[self.keyName],
|
||||
}, self.keyName == 'label' ? {
|
||||
|
|
@ -1027,7 +1029,7 @@ Ox.Input_ = function(options, self) {
|
|||
width: self.valueWidth
|
||||
}];
|
||||
} else if (self.options.type == 'range') {
|
||||
self.options.value = [$.extend({
|
||||
self.options.value = [Ox.extend({
|
||||
id: '',
|
||||
size: self.valueWidth
|
||||
}, self.options.value)];
|
||||
|
|
@ -1231,7 +1233,7 @@ Ox.Input_ = function(options, self) {
|
|||
});
|
||||
}
|
||||
that.$input[i]
|
||||
.css($.extend({}, self.options.value.length > 1 ? {
|
||||
.css(Ox.extend({}, self.options.value.length > 1 ? {
|
||||
float: 'left',
|
||||
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);
|
||||
|
|
@ -1411,7 +1413,7 @@ Ox.InputElement_ = function(options, self) {
|
|||
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_escape: cancel
|
||||
|
|
@ -1488,7 +1490,7 @@ Ox.InputElement_ = function(options, self) {
|
|||
index > -1 && values[index == 0 ? 0 : 1].push(v);
|
||||
});
|
||||
}
|
||||
return $.merge(values[0], values[1]);
|
||||
return Ox.merge(values[0], values[1]);
|
||||
}
|
||||
|
||||
function autosuggestCall() {
|
||||
|
|
@ -1555,7 +1557,7 @@ Ox.InputElement_ = function(options, self) {
|
|||
function autovalidateCallback(data, blur) {
|
||||
if (data.valid != self.valid) {
|
||||
self.valid = data.valid;
|
||||
that.triggerEvent('validate', $.extend(data, {
|
||||
that.triggerEvent('validate', Ox.extend(data, {
|
||||
blur: blur
|
||||
}));
|
||||
}
|
||||
|
|
@ -1693,7 +1695,7 @@ Ox.Range_ = function(options, self) {
|
|||
value: 0,
|
||||
valueNames: null
|
||||
})
|
||||
.options($.extend(options, {
|
||||
.options(Ox.extend(options, {
|
||||
arrowStep: options.arrowStep ?
|
||||
options.arrowStep : options.step,
|
||||
trackImages: $.makeArray(options.trackImages || [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue