1
0
Fork 0
forked from 0x2620/oxjs

remove new for all Ox.Elements, dont declare arguments again, add some semicolons

This commit is contained in:
j 2011-06-19 19:48:32 +02:00
commit b27ed00356
69 changed files with 430 additions and 440 deletions

View file

@ -24,8 +24,9 @@ Ox.Button <f:Ox.Element> Button Object
@*/
Ox.Button = function(options, self) {
var self = self || {},
that = new Ox.Element('<input>', self)
self = self || {};
var that = Ox.Element('<input>', self)
.defaults({
disabled: false,
group: false,
@ -72,7 +73,7 @@ Ox.Button = function(options, self) {
if (self.options.tooltip) {
self.tooltips = Ox.isArray(self.options.tooltip) ? self.options.tooltip : [self.options.tooltip];
self.$tooltip = new Ox.Tooltip({
self.$tooltip = Ox.Tooltip({
title: self.tooltips[self.selectedTitle]
});
that.mouseenter(mouseenter)

View file

@ -16,8 +16,8 @@ Ox.ButtonGroup <f:Ox.Element> ButtonGroup Object
Ox.ButtonGroup = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
buttons: [],
max: 1,
@ -31,7 +31,7 @@ Ox.ButtonGroup = function(options, self) {
.addClass('OxButtonGroup');
if (self.options.selectable) {
self.optionGroup = new Ox.OptionGroup(
self.optionGroup = Ox.OptionGroup(
self.options.buttons,
self.options.min,
self.options.max,

View file

@ -17,8 +17,8 @@ Ox.Checkbox <f:Ox.Element> Checkbox Element
Ox.Checkbox = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
disabled: false,
id: '',
@ -41,7 +41,7 @@ Ox.Checkbox = function(options, self) {
self.options.width != 'auto' && that.css({
width: self.options.width + 'px'
});
self.$title = new Ox.Label({
self.$title = Ox.Label({
disabled: self.options.disabled,
id: self.options.id + 'Label',
overlap: 'left',
@ -55,7 +55,7 @@ Ox.Checkbox = function(options, self) {
.appendTo(that);
}
self.$button = new Ox.Button({
self.$button = Ox.Button({
disabled: self.options.disabled,
id: self.options.id + 'Button',
title: [

View file

@ -17,8 +17,8 @@ Ox.CheckboxGroup <f:Ox.Element> CheckboxGroup Object
Ox.CheckboxGroup = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
checkboxes: [],
max: 1,
@ -28,7 +28,7 @@ Ox.CheckboxGroup = function(options, self) {
.options(options || {})
.addClass('OxCheckboxGroup');
self.optionGroup = new Ox.OptionGroup(
self.optionGroup = Ox.OptionGroup(
self.options.checkboxes,
self.options.min,
self.options.max);
@ -45,7 +45,7 @@ Ox.CheckboxGroup = function(options, self) {
});
self.options.checkboxes.forEach(function(checkbox, position) {
var id = self.options.id + Ox.toTitleCase(checkbox.id)
self.$checkboxes[position] = new Ox.Checkbox($.extend(checkbox, {
self.$checkboxes[position] = Ox.Checkbox($.extend(checkbox, {
group: true,
id: id,
width: self.checkboxWidth[position]

View file

@ -11,18 +11,18 @@ Ox.ColorInput <f:Ox.InputGroup> ColorInput Element
@*/
Ox.ColorInput = function(options, self) {
var self = $.extend(self || {}, {
self = $.extend(self || {}, {
options: $.extend({
id: '',
value: '0, 0, 0'
}, options)
}),
that;
});
var that;
self.values = self.options.value.split(', ');
self.$inputs = [];
['red', 'green', 'blue'].forEach(function(v, i) {
self.$inputs[i] = new Ox.Input({
self.$inputs[i] = Ox.Input({
id: v,
max: 255,
type: 'integer',
@ -31,14 +31,14 @@ Ox.ColorInput = function(options, self) {
})
.bindEvent('autovalidate', change);
});
self.$inputs[3] = new Ox.Label({
self.$inputs[3] = Ox.Label({
id: 'color',
width: 36
})
.css({
background: 'rgb(' + self.options.value + ')'
});
self.$inputs[4] = new Ox.ColorPicker({
self.$inputs[4] = Ox.ColorPicker({
id: 'picker'
})
.bindEvent('change', function(event, data) {
@ -55,7 +55,7 @@ Ox.ColorInput = function(options, self) {
width: 16 // this is just a hack to make the InputGroup layout work
});
that = new Ox.InputGroup({
that = Ox.InputGroup({
id: self.options.id,
inputs: self.$inputs,
separators: [

View file

@ -14,8 +14,8 @@ Ox.ColorPicker <f:Ox.Element> ColorPicker Element
Ox.ColorPicker = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
id: '',
value: '0, 0, 0'
@ -28,7 +28,7 @@ Ox.ColorPicker = function(options, self) {
self.values = self.options.value.split(', ');
Ox.range(3).forEach(function(i) {
self.$ranges[i] = new Ox.Range({
self.$ranges[i] = Ox.Range({
arrows: true,
id: self.options.id + Ox.toTitleCase(self.rgb[i]),
max: 255,
@ -64,7 +64,7 @@ Ox.ColorPicker = function(options, self) {
}
});
that = new Ox.Picker({
that = Ox.Picker({
element: that,
elementHeight: 46,
elementWidth: 328,
@ -97,7 +97,7 @@ Ox.ColorPicker = function(options, self) {
'rgb(' + $.map(Ox.range(3), function(v) {
return v == index ? 255 : self.values[v];
}).join(', ') + ')'
]
];
}
return that;

View file

@ -15,7 +15,8 @@ Ox.DateInput <f:Ox.Element> DateInput Element
@*/
Ox.DateInput = function(options, self) {
var self = $.extend(self || {}, {
var that;
self = $.extend(self || {}, {
options: $.extend({
format: 'short',
value: Ox.formatDate(new Date(), '%F'),
@ -27,8 +28,7 @@ Ox.DateInput = function(options, self) {
year: 48
}
}, options)
}),
that;
});
$.extend(self, {
date: new Date(self.options.value.replace(/-/g, '/')),
@ -48,7 +48,7 @@ Ox.DateInput = function(options, self) {
});
self.$input = $.extend(self.options.weekday ? {
weekday: new Ox.Input({
weekday: Ox.Input({
autocomplete: self.weekdays,
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
@ -58,7 +58,7 @@ Ox.DateInput = function(options, self) {
})
.bindEvent('autocomplete', changeWeekday),
} : {}, {
day: new Ox.Input({
day: Ox.Input({
autocomplete: $.map(Ox.range(1, Ox.getDaysInMonth(
parseInt(Ox.formatDate(self.date, '%Y'), 10),
parseInt(Ox.formatDate(self.date, '%m'), 10)
@ -73,7 +73,7 @@ Ox.DateInput = function(options, self) {
width: self.options.width.day
})
.bindEvent('autocomplete', changeDay),
month: new Ox.Input({
month: Ox.Input({
autocomplete: self.options.format == 'short' ? $.map(Ox.range(1, 13), function(v, i) {
return Ox.pad(v, 2);
}) : self.months,
@ -85,7 +85,7 @@ Ox.DateInput = function(options, self) {
width: self.options.width.month
})
.bindEvent('autocomplete', changeMonthOrYear),
year: new Ox.Input({
year: Ox.Input({
autocomplete: $.map($.merge(Ox.range(1900, 3000), Ox.range(1000, 1900)), function(v, i) {
return v.toString();
}),
@ -99,7 +99,7 @@ Ox.DateInput = function(options, self) {
.bindEvent('autocomplete', changeMonthOrYear)
});
that = new Ox.InputGroup($.extend(self.options, {
that = Ox.InputGroup($.extend(self.options, {
id: self.options.id,
inputs: $.merge(self.options.weekday ? [
self.$input.weekday

View file

@ -17,8 +17,8 @@ Ox.DateTimeInput <f:Ox.Element> DateTimeInput Element
Ox.DateTimeInput = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
ampm: false,
format: 'short',
@ -31,15 +31,15 @@ Ox.DateTimeInput = function(options, self) {
self.values = self.options.value.split(' ');
//Ox.print(self.values)
that = new Ox.InputGroup({
that = Ox.InputGroup({
inputs: [
new Ox.DateInput({
Ox.DateInput({
format: self.options.format,
id: 'date',
value: self.values[0],
weekday: self.options.weekday
}),
new Ox.TimeInput({
Ox.TimeInput({
ampm: self.options.ampm,
id: 'time',
value: self.values[1],

View file

@ -292,7 +292,7 @@ Ox.Filter = function(options, self) {
subpos = Ox.isUndefined(subpos) ? -1 : subpos;
var isGroup = subpos == -1 && self.options.query.conditions[pos].conditions;
return Ox.merge([
new Ox.Button({
Ox.Button({
disabled: self.options.query.conditions.length == 1,
id: 'remove',
title: 'remove',

View file

@ -15,8 +15,8 @@ Ox.Form <f:Ox.Element> Form Object
Ox.Form = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
error: '',
id: '',
@ -38,7 +38,7 @@ Ox.Form = function(options, self) {
self.options.items.forEach(function(item, i) {
self.itemIds[i] = item.options('id') || item.id;
self.itemIsValid[i] = !!item.value().length;
that.append(self.$items[i] = new Ox.FormItem({element: item}));
that.append(self.$items[i] = Ox.FormItem({element: item}));
item.bindEvent({
/*
blur: function(event, data) {
@ -89,7 +89,7 @@ Ox.Form = function(options, self) {
that.addItem = function(pos, item) {
Ox.print('addItem', pos)
self.options.items.splice(pos, 0, item);
self.$items.splice(pos, 0, new Ox.FormItem({element: item}));
self.$items.splice(pos, 0, Ox.FormItem({element: item}));
pos == 0 ?
self.$items[pos].insertBefore(self.$items[0]) :
self.$items[pos].insertAfter(self.$items[pos - 1]);

View file

@ -16,8 +16,8 @@ Ox.FormElementGroup <f:Ox.Element> FormElementGroup Element
Ox.FormElementGroup = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
id: '',
elements: [],

View file

@ -13,8 +13,8 @@ Ox.FormItem <f:Ox.Element> FormItem Element, wrap form element with an error mes
Ox.FormItem = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
element: null,
error: '',
@ -23,7 +23,7 @@ Ox.FormItem = function(options, self) {
.addClass('OxFormItem')
.append(self.options.element);
self.$message = new Ox.Element()
self.$message = Ox.Element()
.addClass('OxFormMessage')
.appendTo(that);
@ -33,7 +33,7 @@ Ox.FormItem = function(options, self) {
@*/
that.setMessage = function(message) {
self.$message.html(message)[message !== '' ? 'show' : 'hide']();
}
};
/*@
value <f> get value
@ -45,4 +45,4 @@ Ox.FormItem = function(options, self) {
return that;
}
};

View file

@ -59,8 +59,8 @@ Ox.Input <f:Ox.Element> Input Element
Ox.Input = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
arrows: false,
arrowStep: 1,
@ -133,7 +133,7 @@ Ox.Input = function(options, self) {
}
if (self.options.label) {
self.$label = new Ox.Label({
self.$label = Ox.Label({
overlap: 'right',
textAlign: 'right',
title: self.options.label,
@ -152,7 +152,7 @@ Ox.Input = function(options, self) {
if (self.options.arrows) {
self.arrows = [];
self.arrows[0] = [
new Ox.Button({
Ox.Button({
overlap: 'right',
title: 'left',
type: 'image'
@ -164,7 +164,7 @@ Ox.Input = function(options, self) {
clickArrow(0);
})
.appendTo(that),
new Ox.Button({
Ox.Button({
overlap: 'left',
title: 'right',
type: 'image'
@ -187,7 +187,7 @@ Ox.Input = function(options, self) {
});
if (self.options.clear) {
self.$button = new Ox.Button({
self.$button = Ox.Button({
overlap: 'left',
title: 'close',
type: 'image'
@ -401,7 +401,7 @@ Ox.Input = function(options, self) {
}
function constructAutocompleteMenu() {
var menu = new Ox.Menu({
var menu = Ox.Menu({
element: self.$input,
id: self.options.id + 'Menu', // fixme: we do this in other places ... are we doing it the same way? var name?,
offset: {
@ -908,8 +908,8 @@ Ox.Input_ = function(options, self) {
events:
*/
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
autocomplete: null,
autocorrect: null,
@ -1066,7 +1066,7 @@ Ox.Input_ = function(options, self) {
self.options[self.keyName].forEach(function(key, keyPos) {
//Ox.print('keyPos key', keyPos, key)
if (self.keyName == 'label' && key.label.length == 1) {
that.$key[keyPos] = new Ox.Label({
that.$key[keyPos] = Ox.Label({
overlap: 'right',
title: key.label[0].title,
width: self.options.labelWidth
@ -1083,7 +1083,7 @@ Ox.Input_ = function(options, self) {
self.selectKeyId = self.options.id + Ox.toTitleCase(self.keyName) +
(self.options[self.keyName].length == 1 ? '' : keyPos);
//Ox.print('three', self.selectedKey, keyPos, self.selectedKey[keyPos]);
that.$key[keyPos] = new Ox.Select({
that.$key[keyPos] = Ox.Select({
id: self.selectKeyId,
items: $.map(key.label, function(value, valuePos) {
return {
@ -1107,7 +1107,7 @@ Ox.Input_ = function(options, self) {
}
if (self.options.clear) {
that.$clear = new Ox.Button({
that.$clear = Ox.Button({
overlap: 'left',
title: 'close',
type: 'image'
@ -1120,7 +1120,7 @@ Ox.Input_ = function(options, self) {
}
if (self.options.unit.length == 1) {
that.$unit = new Ox.Label({
that.$unit = Ox.Label({
overlap: 'left',
title: self.options.unit[0].title,
width: self.options.unitWidth
@ -1134,7 +1134,7 @@ Ox.Input_ = function(options, self) {
.appendTo(that);
} else if (self.options.unit.length > 1) {
self.selectUnitId = self.options.id + 'Unit';
that.$unit = new Ox.Select({
that.$unit = Ox.Select({
id: self.selectUnitId,
items: $.map(self.options.unit, function(unit, i) {
//Ox.print('unit', unit)
@ -1159,7 +1159,7 @@ Ox.Input_ = function(options, self) {
that.$separator = [];
self.options.value.forEach(function(v, i) {
if (i < self.values - 1) {
that.$separator[i] = new Ox.Label({
that.$separator[i] = Ox.Label({
textAlign: 'center',
title: self.options.separator[i],
width: self.options.separatorWidth[i] + 32
@ -1185,7 +1185,7 @@ Ox.Input_ = function(options, self) {
//self.margin -= (i == 0 ? 16 : self.options.value[i - 1].width)
//Ox.print('v:', v, 'id:', id)
if (self.options.type == 'select') {
that.$input[i] = new Ox.Select({
that.$input[i] = Ox.Select({
id: v.id,
items: v.items,
width: v.width
@ -1194,12 +1194,12 @@ Ox.Input_ = function(options, self) {
float: 'left'
});
} else if (self.options.type == 'range') {
that.$input[i] = new Ox.Range(v)
that.$input[i] = Ox.Range(v)
.css({
float: 'left'
});
} else {
that.$input[i] = new Ox.InputElement({
that.$input[i] = Ox.InputElement({
autocomplete: self.options.autocomplete[id],
autocorrect: self.options.autocorrect[id],
autosuggest: self.options.autosuggest[id],
@ -1339,8 +1339,8 @@ Ox.Input_ = function(options, self) {
Ox.InputElement_ = function(options, self) {
var self = self || {},
that = new Ox.Element(
self = self || {};
var that = Ox.Element(
options.type == 'textarea' ? 'textarea' : 'input', self
)
.defaults({
@ -1388,7 +1388,7 @@ Ox.InputElement_ = function(options, self) {
if (self.options.autosuggest) {
self.autosuggestId = self.options.id + 'Menu'; // fixme: we do this in other places ... are we doing it the same way? var name?
self.$autosuggestMenu = new Ox.Menu({
self.$autosuggestMenu = Ox.Menu({
element: that.$element,
id: self.autosuggestId,
offset: {
@ -1663,8 +1663,8 @@ Ox.Range_ = function(options, self) {
/*
init
*/
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
animate: false,
arrows: false,
@ -1715,7 +1715,7 @@ Ox.Range_ = function(options, self) {
.click(clickArrowDec)
.appendTo(that.$element);
}
var $track = new Ox.Element()
var $track = Ox.Element()
.addClass('OxTrack')
.mousedown(clickTrack)
.appendTo(that.$element);

View file

@ -14,8 +14,8 @@ Ox.InputGroup <f:Ox.Element> InputGroup Object
@*/
Ox.InputGroup = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
id: '',
inputs: [],
@ -42,7 +42,7 @@ Ox.InputGroup = function(options, self) {
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.$separator[i] = new Ox.Label({
self.$separator[i] = Ox.Label({
textAlign: 'center',
title: v.title,
width: v.width + 32

View file

@ -9,8 +9,8 @@ Ox.Label <f:Ox.Element> Label Object
@*/
Ox.Label = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
disabled: false,
id: '',
@ -36,9 +36,9 @@ Ox.Label = function(options, self) {
if (key == 'title') {
that.html(value);
} else if (key == 'width') {
that.css({width: self.options.width - 14 + 'px'})
that.css({width: self.options.width - 14 + 'px'});
}
}
};
return that;

View file

@ -14,10 +14,9 @@ Ox.OptionGroup = function(items, min, max, property) {
/*
to be used by ButtonGroup, CheckboxGroup, Select and Menu
*/
var property = property || 'checked'
length = items.length,
max = max == -1 ? length : max;
var length = items.length;
property = property || 'checked';
max = max == -1 ? length : max;
function getLastBefore(pos) {
// returns the position of the last checked item before position pos
@ -47,7 +46,7 @@ Ox.OptionGroup = function(items, min, max, property) {
if (item[property]) {
num++;
}
})
});
return num;
}

View file

@ -16,8 +16,8 @@ Ox.Picker <f:Ox.Element> Picker Object
Ox.Picker = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
element: null,
elementHeight: 128,
@ -27,7 +27,7 @@ Ox.Picker = function(options, self) {
})
.options(options || {});
self.$selectButton = new Ox.Button({
self.$selectButton = Ox.Button({
overlap: self.options.overlap,
title: 'select',
type: 'image'
@ -35,7 +35,7 @@ Ox.Picker = function(options, self) {
.click(showMenu)
.appendTo(that);
self.$menu = new Ox.Element()
self.$menu = Ox.Element()
.addClass('OxPicker')
.css({
width: self.options.elementWidth + 'px',
@ -49,18 +49,18 @@ Ox.Picker = function(options, self) {
})
.appendTo(self.$menu);
self.$bar = new Ox.Bar({
self.$bar = Ox.Bar({
orientation: 'horizontal',
size: 24
})
.appendTo(self.$menu);
that.$label = new Ox.Label({
that.$label = Ox.Label({
width: self.options.elementWidth - 60
})
.appendTo(self.$bar);
self.$doneButton = new Ox.Button({
self.$doneButton = Ox.Button({
title: 'Done',
width: 48
})
@ -81,7 +81,7 @@ Ox.Picker = function(options, self) {
WebkitBorderRadius: '8px'
});
that.triggerEvent('hide');
};
}
function showMenu() {
var offset = that.offset(),
@ -101,7 +101,7 @@ Ox.Picker = function(options, self) {
})
.appendTo(Ox.UI.$body);
that.triggerEvent('show');
};
}
return that;

View file

@ -13,22 +13,21 @@ Ox.PlaceInput <f:Ox.FormElementGroup> PlaceInput Object
Ox.PlaceInput = function(options, self) {
var self = $.extend(self || {}, {
var that;
self = $.extend(self || {}, {
options: $.extend({
id: '',
value: 'United States'
}, options)
}),
that;
that = new Ox.FormElementGroup({
});
that = Ox.FormElementGroup({
id: self.options.id,
elements: [
new Ox.Input({
Ox.Input({
id: 'input',
value: self.options.value
}),
new Ox.PlacePicker({
Ox.PlacePicker({
id: 'picker',
overlap: 'left',
value: self.options.value

View file

@ -13,21 +13,21 @@ Ox.PlacePicker <f:Ox.Element> PlacePicker Object
Ox.PlacePicker = function(options, self) {
var self = $.extend(self || {}, {
var that;
self = $.extend(self || {}, {
options: $.extend({
id: '',
value: 'United States'
}, options)
}),
that;
});
self.$element = new Ox.Element()
self.$element = Ox.Element()
.css({
width: '256px',
height: '192px'
})
.append(
self.$topBar = new Ox.Bar({
self.$topBar = Ox.Bar({
size: 16
})
.css({
@ -35,7 +35,7 @@ Ox.PlacePicker = function(options, self) {
WebkitBorderRadius: '0 8px 0 0'
})
.append(
self.$input = new Ox.Input({
self.$input = Ox.Input({
clear: true,
id: self.options.id + 'Input',
placeholder: 'Find',
@ -45,18 +45,18 @@ Ox.PlacePicker = function(options, self) {
)
)
.append(
self.$container = new Ox.Element()
self.$container = Ox.Element()
.css({
width: '256px',
height: '160px'
})
)
.append(
self.$bottomBar = new Ox.Bar({
self.$bottomBar = Ox.Bar({
size: 16
})
.append(
self.$range = new Ox.Range({
self.$range = Ox.Range({
arrows: true,
id: self.options.id + 'Range',
max: 22,
@ -83,7 +83,7 @@ Ox.PlacePicker = function(options, self) {
WebkitBorderRadius: 0
});
that = new Ox.Picker({
that = Ox.Picker({
element: self.$element,
elementHeight: 192,
elementWidth: 256,
@ -93,7 +93,7 @@ Ox.PlacePicker = function(options, self) {
}, self)
.bindEvent('show', showPicker);
that.$label.bind('click', clickLabel)
that.$label.bind('click', clickLabel);
self.map = false;
@ -118,7 +118,7 @@ Ox.PlacePicker = function(options, self) {
//Ox.print('findPlace', data);
self.$map.find(data.value, function(place) {
place && that.$label.html(place.geoname);
})
});
}
function onSelect(event, data) {
@ -133,7 +133,7 @@ Ox.PlacePicker = function(options, self) {
function showPicker() {
if (!self.map) {
self.$map = new Ox.Map({
self.$map = Ox.Map({
clickable: true,
id: self.options.id + 'Map',
//places: [self.options.value]

View file

@ -26,8 +26,8 @@ Ox.Range <f:Ox.Element> Range Object
Ox.Range = function(options, self) {
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
arrows: false,
arrowStep: 1,
@ -66,7 +66,7 @@ Ox.Range = function(options, self) {
if (self.options.arrows) {
self.$arrows = [];
Ox.range(0, 2).forEach(function(i) {
self.$arrows[i] = new Ox.Button({
self.$arrows[i] = Ox.Button({
overlap: i == 0 ? 'right' : 'left',
title: self.options.arrowSymbols[i],
type: 'image'
@ -84,7 +84,7 @@ Ox.Range = function(options, self) {
});
}
self.$track = new Ox.Element()
self.$track = Ox.Element()
.addClass('OxTrack')
.css($.extend({
width: (self.trackSize - 2) + 'px'
@ -235,7 +235,7 @@ Ox.Range = function(options, self) {
}
function setValue(value, animate) {
var value = Ox.limit(value, self.options.min, self.options.max);
value = Ox.limit(value, self.options.min, self.options.max);
if (value != self.options.value) {
//time = getTime(self.options.value, value);
self.options.value = value;

View file

@ -24,8 +24,8 @@ Ox.Select <f:Ox.Element> Select Object
Ox.Select = function(options, self) {
// fixme: selected item needs attribute "checked", not "selected" ... that's strange
var self = self || {},
that = new Ox.Element({
self = self || {};
var that = Ox.Element({
tooltip: options.tooltip || ''
}, self)
.defaults({
@ -57,7 +57,7 @@ Ox.Select = function(options, self) {
key_down: showMenu
});
Ox.print('Ox.Select', self.options)
Ox.print('Ox.Select', self.options);
$.extend(self, {
buttonId: self.options.id + 'Button',
@ -66,7 +66,7 @@ Ox.Select = function(options, self) {
});
if (self.options.selectable) {
self.optionGroup = new Ox.OptionGroup(
self.optionGroup = Ox.OptionGroup(
self.options.items,
self.options.min,
self.options.max
@ -87,7 +87,7 @@ Ox.Select = function(options, self) {
// that.focus();
})
.appendTo(that);
};
}
if (self.options.type == 'text') {
self.$title = $('<div>')
@ -105,7 +105,7 @@ Ox.Select = function(options, self) {
.appendTo(that.$element);
}
self.$button = new Ox.Button({
self.$button = Ox.Button({
id: self.buttonId,
style: 'symbol',
title: 'select',
@ -114,7 +114,7 @@ Ox.Select = function(options, self) {
.bindEvent('click', showMenu)
.appendTo(that);
self.$menu = new Ox.Menu({
self.$menu = Ox.Menu({
element: self.$title || self.$button,
id: self.menuId,
items: [self.options.selectable ? {

View file

@ -16,8 +16,8 @@ Ox.TimeInput <f:Ox.Element> TimeInput Object
Ox.TimeInput = function(options, self) {
// fixme: seconds get set even if options.seconds is false
var self = self || {},
that = new Ox.Element({}, self)
self = self || {};
var that = Ox.Element({}, self)
.defaults({
ampm: false,
seconds: false,
@ -46,7 +46,7 @@ Ox.TimeInput = function(options, self) {
self.values = getValues();
self.$input = {
hours: new Ox.Input({
hours: Ox.Input({
autocomplete: $.map(self.options.ampm ? Ox.range(1, 13) : Ox.range(0, 24), function(v) {
return Ox.pad(v, 2);
}),
@ -57,7 +57,7 @@ Ox.TimeInput = function(options, self) {
value: self.values.hours,
width: 32//self.options.width.hours
}),
minutes: new Ox.Input({
minutes: Ox.Input({
autocomplete: $.map(Ox.range(0, 60), function(v) {
return Ox.pad(v, 2);
}),
@ -68,7 +68,7 @@ Ox.TimeInput = function(options, self) {
value: self.values.minutes,
width: 32//self.options.width.minutes
}),
seconds: new Ox.Input({
seconds: Ox.Input({
autocomplete: $.map(Ox.range(0, 60), function(v) {
return Ox.pad(v, 2);
}),
@ -79,7 +79,7 @@ Ox.TimeInput = function(options, self) {
value: self.values.seconds,
width: 32//self.options.width.seconds
}),
milliseconds: new Ox.Input({
milliseconds: Ox.Input({
autocomplete: $.map(Ox.range(0, 1000), function(v) {
return Ox.pad(v, 3);
}),
@ -90,7 +90,7 @@ Ox.TimeInput = function(options, self) {
value: self.values.milliseconds,
width: 40//self.options.width.milliseconds
}),
ampm: new Ox.Input({
ampm: Ox.Input({
autocomplete: ['AM', 'PM'],
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
@ -100,7 +100,7 @@ Ox.TimeInput = function(options, self) {
})
};
that = new Ox.InputGroup($.extend(self.options, {
that = Ox.InputGroup($.extend(self.options, {
inputs: $.merge($.merge($.merge([
self.$input.hours,
self.$input.minutes,
@ -169,7 +169,7 @@ Ox.TimeInput = function(options, self) {
if (key == 'value') {
setValues();
}
}
};
return that;