From 4cc754a28d3496a91283fb4b61a5e0f709ddd24e Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 17 Sep 2011 20:36:09 +0200 Subject: [PATCH] remove Ox.each, , $.extend, $.map and $.merge --- source/Ox.UI/js/Bar/Ox.Resizebar.js | 2 +- source/Ox.UI/js/Core/Ox.App.js | 2 +- source/Ox.UI/js/Core/Ox.Request.js | 4 +-- source/Ox.UI/js/Form/Ox.Button.js | 2 +- source/Ox.UI/js/Form/Ox.ButtonGroup.js | 2 +- source/Ox.UI/js/Form/Ox.CheckboxGroup.js | 10 +++--- source/Ox.UI/js/Form/Ox.ColorInput.js | 6 ++-- source/Ox.UI/js/Form/Ox.ColorPicker.js | 4 +-- source/Ox.UI/js/Form/Ox.DateInput.js | 26 ++++++-------- source/Ox.UI/js/Form/Ox.Filter.js | 2 +- source/Ox.UI/js/Form/Ox.Form.js | 2 +- source/Ox.UI/js/Form/Ox.FormElementGroup.js | 2 +- source/Ox.UI/js/Form/Ox.Input.js | 38 +++++++++++---------- source/Ox.UI/js/Form/Ox.InputGroup.js | 9 ++--- source/Ox.UI/js/Form/Ox.Label.js | 2 +- source/Ox.UI/js/Form/Ox.OptionGroup.js | 4 +-- source/Ox.UI/js/Form/Ox.PlaceInput.js | 4 +-- source/Ox.UI/js/Form/Ox.PlacePicker.js | 4 +-- source/Ox.UI/js/Form/Ox.Range.js | 10 +++--- source/Ox.UI/js/Form/Ox.Select.js | 4 +-- source/Ox.UI/js/List/Ox.IconItem.js | 6 ++-- source/Ox.UI/js/List/Ox.IconList.js | 4 +-- source/Ox.UI/js/List/Ox.InfoList.js | 2 +- source/Ox.UI/js/List/Ox.List.js | 28 ++++++++------- source/Ox.UI/js/List/Ox.TreeList.js | 6 ++-- source/Ox.UI/js/Map/Ox.MapImage.js | 2 +- source/Ox.UI/js/Menu/Ox.MainMenu.js | 2 +- source/Ox.UI/js/Menu/Ox.Menu.js | 2 +- source/Ox.UI/js/Panel/Ox.SplitPanel.js | 4 +-- source/Ox.UI/js/Video/Ox.AnnotationPanel.js | 2 +- source/Ox.UI/js/Video/Ox.BlockTimeline.js | 4 +-- source/Ox.UI/js/Video/Ox.LargeTimeline.js | 2 +- source/Ox.UI/js/Video/Ox.SmallTimeline.js | 2 +- source/Ox.UI/js/Video/Ox.VideoEditor.js | 6 ++-- source/Ox.js | 24 ------------- 35 files changed, 104 insertions(+), 131 deletions(-) diff --git a/source/Ox.UI/js/Bar/Ox.Resizebar.js b/source/Ox.UI/js/Bar/Ox.Resizebar.js index 657f431e..d6cf067d 100644 --- a/source/Ox.UI/js/Bar/Ox.Resizebar.js +++ b/source/Ox.UI/js/Bar/Ox.Resizebar.js @@ -54,7 +54,7 @@ Ox.Resizebar = function(options, self) { }); } - $.extend(self, { + Ox.extend(self, { clientXY: self.options.orientation == 'horizontal' ? 'clientY' : 'clientX', dimensions: Ox.UI.DIMENSIONS[self.options.orientation], // fixme: should orientation be the opposite orientation here? edges: Ox.UI.EDGES[self.options.orientation], diff --git a/source/Ox.UI/js/Core/Ox.App.js b/source/Ox.UI/js/Core/Ox.App.js index bb01df61..93bbbf81 100644 --- a/source/Ox.UI/js/Core/Ox.App.js +++ b/source/Ox.UI/js/Core/Ox.App.js @@ -95,7 +95,7 @@ Ox.App = function(options) { }, navigator: { cookieEnabled: navigator.cookieEnabled, - plugins: $.map(navigator.plugins, function(plugin, i) { + plugins: Ox.makeArray(navigator.plugins).map(function(plugin) { return plugin.name; }), userAgent: navigator.userAgent diff --git a/source/Ox.UI/js/Core/Ox.Request.js b/source/Ox.UI/js/Core/Ox.Request.js index 05535f77..e39be1c9 100644 --- a/source/Ox.UI/js/Core/Ox.Request.js +++ b/source/Ox.UI/js/Core/Ox.Request.js @@ -15,7 +15,7 @@ Ox.Request = function(options) { pending = {}, requests = {}, self = { - options: $.extend({ + options: Ox.extend({ timeout: 60000, type: 'POST', url: '/api/' @@ -87,7 +87,7 @@ Ox.Request = function(options) { @*/ send: function(options) { - var options = $.extend({ + var options = Ox.extend({ age: -1, callback: null, id: Ox.uid(), diff --git a/source/Ox.UI/js/Form/Ox.Button.js b/source/Ox.UI/js/Form/Ox.Button.js index 6fd1aa8c..0c4ac14f 100644 --- a/source/Ox.UI/js/Form/Ox.Button.js +++ b/source/Ox.UI/js/Form/Ox.Button.js @@ -58,7 +58,7 @@ Ox.Button = function(options, self) { .mousedown(mousedown) .click(click); - $.extend(self, Ox.isArray(self.options.title) ? { + Ox.extend(self, Ox.isArray(self.options.title) ? { selectedTitle: Ox.setPropertyOnce(self.options.title, 'selected'), titles: self.options.title } : { diff --git a/source/Ox.UI/js/Form/Ox.ButtonGroup.js b/source/Ox.UI/js/Form/Ox.ButtonGroup.js index e75d602b..b17ebc3f 100644 --- a/source/Ox.UI/js/Form/Ox.ButtonGroup.js +++ b/source/Ox.UI/js/Form/Ox.ButtonGroup.js @@ -67,7 +67,7 @@ Ox.ButtonGroup = function(options, self) { self.$buttons[pos].toggleSelected(); }); that.triggerEvent('change', { - selected: $.map(self.optionGroup.selected(), function(v, i) { + selected: self.optionGroup.selected().map(function(i) { return self.options.buttons[v].id; }) }); diff --git a/source/Ox.UI/js/Form/Ox.CheckboxGroup.js b/source/Ox.UI/js/Form/Ox.CheckboxGroup.js index 2017a3d0..e494e7c8 100644 --- a/source/Ox.UI/js/Form/Ox.CheckboxGroup.js +++ b/source/Ox.UI/js/Form/Ox.CheckboxGroup.js @@ -34,18 +34,18 @@ Ox.CheckboxGroup = function(options, self) { self.options.max); self.options.checkboxes = self.optionGroup.init(); - $.extend(self, { + Ox.extend(self, { $checkboxes: [], - checkboxWidth: $.map(Ox.divideInt( + checkboxWidth: Ox.divideInt( self.options.width + (self.options.checkboxes.length - 1) * 6, self.options.checkboxes.length - ), function(v, i) { + ).map(function(v, i) { return v + (i < self.options.checkboxes.length - 1 ? 10 : 0); }) }); self.options.checkboxes.forEach(function(checkbox, position) { 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, id: id, width: self.checkboxWidth[position] @@ -64,7 +64,7 @@ Ox.CheckboxGroup = function(options, self) { self.$checkboxes[pos].toggleChecked(); }); that.triggerEvent('change', { - checked: $.map(self.optionGroup.checked(), function(v, i) { + checked: self.optionGroup.checked().map(function(v) { return self.options.checkboxes[v].id; }) }); diff --git a/source/Ox.UI/js/Form/Ox.ColorInput.js b/source/Ox.UI/js/Form/Ox.ColorInput.js index b5d3a981..7fe2a968 100644 --- a/source/Ox.UI/js/Form/Ox.ColorInput.js +++ b/source/Ox.UI/js/Form/Ox.ColorInput.js @@ -11,8 +11,8 @@ Ox.ColorInput ColorInput Element @*/ Ox.ColorInput = function(options, self) { - self = $.extend(self || {}, { - options: $.extend({ + self = Ox.extend(self || {}, { + options: Ox.extend({ id: '', value: '0, 0, 0' }, options) @@ -69,7 +69,7 @@ Ox.ColorInput = function(options, self) { .bindEvent('change', change); function change() { - self.options.value = $.map(self.$inputs, function(v, i) { + self.options.value = self.$inputs.map(function(v) { return v.options('value'); }).join(', '); self.$inputs[3].css({ diff --git a/source/Ox.UI/js/Form/Ox.ColorPicker.js b/source/Ox.UI/js/Form/Ox.ColorPicker.js index 8a58ae4f..0380a51a 100644 --- a/source/Ox.UI/js/Form/Ox.ColorPicker.js +++ b/source/Ox.UI/js/Form/Ox.ColorPicker.js @@ -91,10 +91,10 @@ Ox.ColorPicker = function(options, self) { function getColors(index) { return [ - 'rgb(' + $.map(Ox.range(3), function(v) { + 'rgb(' + Ox.range(3).map(function(v) { return v == index ? 0 : self.values[v]; }).join(', ') + ')', - 'rgb(' + $.map(Ox.range(3), function(v) { + 'rgb(' + Ox.range(3).map(function(v) { return v == index ? 255 : self.values[v]; }).join(', ') + ')' ]; diff --git a/source/Ox.UI/js/Form/Ox.DateInput.js b/source/Ox.UI/js/Form/Ox.DateInput.js index bd8c1f0d..4efb093c 100644 --- a/source/Ox.UI/js/Form/Ox.DateInput.js +++ b/source/Ox.UI/js/Form/Ox.DateInput.js @@ -43,15 +43,11 @@ Ox.DateInput = function(options, self) { weekday: self.options.format == 'long' ? '%A' : '%a', year: '%Y' }, - months: self.options.format == 'long' ? Ox.MONTHS : $.map(Ox.MONTHS, function(v, i) { - return v.substr(0, 3); - }), - weekdays: self.options.format == 'long' ? Ox.WEEKDAYS : $.map(Ox.WEEKDAYS, function(v, i) { - return v.substr(0, 3); - }) + months: self.options.format == 'long' ? Ox.MONTHS : Ox.SHORT_MONTHS, + weekdays: self.options.format == 'long' ? Ox.WEEKDAYS : Ox.SHORT_WEEKDAYS }); - self.$input = $.extend(self.options.weekday ? { + self.$input = Ox.extend(self.options.weekday ? { weekday: Ox.Input({ autocomplete: self.weekdays, autocompleteReplace: true, @@ -78,8 +74,8 @@ Ox.DateInput = function(options, self) { }) .bindEvent('autocomplete', changeDay), month: Ox.Input({ - autocomplete: self.options.format == 'short' ? $.map(Ox.range(1, 13), function(v, i) { - return Ox.pad(v, 2); + autocomplete: self.options.format == 'short' ? Ox.range(1, 13).map(function(i) { + return Ox.pad(i, 2); }) : self.months, autocompleteReplace: true, autocompleteReplaceCorrect: true, @@ -90,8 +86,8 @@ Ox.DateInput = function(options, self) { }) .bindEvent('autocomplete', changeMonthOrYear), year: Ox.Input({ - autocomplete: Ox.merge(Ox.range(1900, 3000), Ox.range(1000, 1900)).map(function(v) { - return v.toString(); + autocomplete: Ox.merge(Ox.range(1900, 3000), Ox.range(1000, 1900)).map(function(i) { + return i.toString(); }), autocompleteReplace: true, autocompleteReplaceCorrect: true, @@ -146,8 +142,8 @@ Ox.DateInput = function(options, self) { value: Ox.formatDate(new Date([month, day, year].join(' ')), self.formats.weekday) }); self.$input.day.options({ - autocomplete: $.map(Ox.range(1, days + 1), function(v, i) { - return self.options.format == 'short' ? Ox.pad(v, 2) : v.toString(); + autocomplete: Ox.range(1, days + 1).map(function(i) { + return self.options.format == 'short' ? Ox.pad(i, 2) : i.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.day.options({ - autocomplete: $.map(Ox.range(1, Ox.getDaysInMonth(date.year, date.month) + 1), function(v, i) { - return self.options.format == 'short' ? Ox.pad(v, 2) : v.toString(); + autocomplete: Ox.range(1, Ox.getDaysInMonth(date.year, date.month) + 1).map(function(i) { + return self.options.format == 'short' ? Ox.pad(i, 2) : i.toString(); }), value: date.day }); diff --git a/source/Ox.UI/js/Form/Ox.Filter.js b/source/Ox.UI/js/Form/Ox.Filter.js index 190ff581..d0c0b5d1 100644 --- a/source/Ox.UI/js/Form/Ox.Filter.js +++ b/source/Ox.UI/js/Form/Ox.Filter.js @@ -397,7 +397,7 @@ Ox.Filter = function(options, self) { 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', width: 128 }) diff --git a/source/Ox.UI/js/Form/Ox.Form.js b/source/Ox.UI/js/Form/Ox.Form.js index 353c4647..b131f1eb 100644 --- a/source/Ox.UI/js/Form/Ox.Form.js +++ b/source/Ox.UI/js/Form/Ox.Form.js @@ -26,7 +26,7 @@ Ox.Form = function(options, self) { .options(options || {}) // fixme: the || {} can be done once, in the options function .addClass('OxForm'); - $.extend(self, { + Ox.extend(self, { $items: [], $messages: [], formIsValid: false, diff --git a/source/Ox.UI/js/Form/Ox.FormElementGroup.js b/source/Ox.UI/js/Form/Ox.FormElementGroup.js index 159d2035..663ef408 100644 --- a/source/Ox.UI/js/Form/Ox.FormElementGroup.js +++ b/source/Ox.UI/js/Form/Ox.FormElementGroup.js @@ -75,7 +75,7 @@ Ox.FormElementGroup = function(options, self) { }; that.value = function() { - return $.map(self.options.elements, function(element) { + return self.options.elements.map(function(element) { var ret = null; ['checked', 'selected', 'value'].forEach(function(v) { element[v] && (ret = element[v]()); diff --git a/source/Ox.UI/js/Form/Ox.Input.js b/source/Ox.UI/js/Form/Ox.Input.js index a5533f5d..ee98a22f 100644 --- a/source/Ox.UI/js/Form/Ox.Input.js +++ b/source/Ox.UI/js/Form/Ox.Input.js @@ -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 || []) diff --git a/source/Ox.UI/js/Form/Ox.InputGroup.js b/source/Ox.UI/js/Form/Ox.InputGroup.js index 37a1448f..3c5b7ad5 100644 --- a/source/Ox.UI/js/Form/Ox.InputGroup.js +++ b/source/Ox.UI/js/Form/Ox.InputGroup.js @@ -35,10 +35,7 @@ Ox.InputGroup = function(options, self) { width: self.options.width + 'px' }); - $.extend(self, { - //$input: [], - $separator: [] - }); + self.$separator = []; 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')) @@ -60,7 +57,7 @@ Ox.InputGroup = function(options, self) { parent: that }) .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') + self.options.separators[i_ - 1].width : (i_ == i ? 16 : 0); })) + 'px' @@ -129,7 +126,7 @@ Ox.InputGroup = function(options, self) { }; that.value = function() { - return $.map(self.options.inputs, function(input) { + return self.options.inputs.map(function(input) { var ret = null; ['checked', 'selected', 'value'].forEach(function(v) { input[v] && (ret = input[v]()); diff --git a/source/Ox.UI/js/Form/Ox.Label.js b/source/Ox.UI/js/Form/Ox.Label.js index 8525cdf8..ab8df0ed 100644 --- a/source/Ox.UI/js/Form/Ox.Label.js +++ b/source/Ox.UI/js/Form/Ox.Label.js @@ -25,7 +25,7 @@ Ox.Label = function(options, self) { (self.options.overlap != 'none' ? ' 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???? }, { textAlign: self.options.textAlign diff --git a/source/Ox.UI/js/Form/Ox.OptionGroup.js b/source/Ox.UI/js/Form/Ox.OptionGroup.js index cf15c2ea..339304da 100644 --- a/source/Ox.UI/js/Form/Ox.OptionGroup.js +++ b/source/Ox.UI/js/Form/Ox.OptionGroup.js @@ -21,12 +21,12 @@ Ox.OptionGroup = function(items, min, max, property) { function getLastBefore(pos) { // returns the position of the last checked item before position pos 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 < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : [] ))*/ // fixme: why is length not == items.length here? - Ox.forEach($.merge( + Ox.forEach(Ox.merge( pos > 0 ? Ox.range(pos - 1, -1, -1) : [], pos < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : [] ), function(v) { diff --git a/source/Ox.UI/js/Form/Ox.PlaceInput.js b/source/Ox.UI/js/Form/Ox.PlaceInput.js index 7adf0c73..72279e20 100644 --- a/source/Ox.UI/js/Form/Ox.PlaceInput.js +++ b/source/Ox.UI/js/Form/Ox.PlaceInput.js @@ -14,8 +14,8 @@ Ox.PlaceInput PlaceInput Object Ox.PlaceInput = function(options, self) { var that; - self = $.extend(self || {}, { - options: $.extend({ + self = Ox.extend(self || {}, { + options: Ox.extend({ id: '', value: 'United States' }, options) diff --git a/source/Ox.UI/js/Form/Ox.PlacePicker.js b/source/Ox.UI/js/Form/Ox.PlacePicker.js index fc388bf5..501a443c 100644 --- a/source/Ox.UI/js/Form/Ox.PlacePicker.js +++ b/source/Ox.UI/js/Form/Ox.PlacePicker.js @@ -14,8 +14,8 @@ Ox.PlacePicker PlacePicker Object Ox.PlacePicker = function(options, self) { var that; - self = $.extend(self || {}, { - options: $.extend({ + self = Ox.extend(self || {}, { + options: Ox.extend({ id: '', value: 'United States' }, options) diff --git a/source/Ox.UI/js/Form/Ox.Range.js b/source/Ox.UI/js/Form/Ox.Range.js index 5d0bdc5e..629a04b8 100644 --- a/source/Ox.UI/js/Form/Ox.Range.js +++ b/source/Ox.UI/js/Form/Ox.Range.js @@ -45,7 +45,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 || []) @@ -55,7 +55,7 @@ Ox.Range = function(options, self) { width: self.options.size + 'px' }); - $.extend(self, { + Ox.extend(self, { trackColors: self.options.trackColors.length, trackImages: self.options.trackImages.length, values: (self.options.max - self.options.min + self.options.step) / @@ -86,7 +86,7 @@ Ox.Range = function(options, self) { self.$track = Ox.Element() .addClass('OxTrack') - .css($.extend({ + .css(Ox.extend({ width: (self.trackSize - 2) + 'px' }, self.trackImages == 1 ? { background: 'rgb(0, 0, 0)' @@ -224,11 +224,11 @@ Ox.Range = function(options, self) { self.$track.css({ backgroundImage: $.browser.mozilla ? ('-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) + '%'; }).join(', ') + ', ' + self.options.trackColors[self.trackColors - 1] + ' 100%)') : ('-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 + ')'; }).join(', ') + ', color-stop(1, ' + self.options.trackColors[self.trackColors - 1] + '))') }); diff --git a/source/Ox.UI/js/Form/Ox.Select.js b/source/Ox.UI/js/Form/Ox.Select.js index 957df51f..5d0e7335 100644 --- a/source/Ox.UI/js/Form/Ox.Select.js +++ b/source/Ox.UI/js/Form/Ox.Select.js @@ -59,7 +59,7 @@ Ox.Select = function(options, self) { //Ox.print('Ox.Select', self.options); - $.extend(self, { + Ox.extend(self, { buttonId: self.options.id + 'Button', groupId: self.options.id + 'Group', menuId: self.options.id + 'Menu' @@ -180,7 +180,7 @@ Ox.Select = function(options, self) { () -> returns object of selected items with id, title @*/ that.selected = function() { - return $.map(/*self.checked*/self.optionGroup.checked(), function(v) { + return /*self.checked*/self.optionGroup.checked().map(function(v) { return { id: self.options.items[v].id, title: self.options.items[v].title diff --git a/source/Ox.UI/js/List/Ox.IconItem.js b/source/Ox.UI/js/List/Ox.IconItem.js index 4c96ed46..e6ffa385 100644 --- a/source/Ox.UI/js/List/Ox.IconItem.js +++ b/source/Ox.UI/js/List/Ox.IconItem.js @@ -40,7 +40,7 @@ Ox.IconItem = function(options, self) { }) .options(options || {}); - $.extend(self, { + Ox.extend(self, { fontSize: self.options.itemWidth == 64 ? 6 : 9, lineLength: self.options.itemWidth == 64 ? 15 : 23, lines: self.options.itemWidth == 64 ? 4 : 5, @@ -135,11 +135,11 @@ Ox.IconItem = function(options, self) { function formatText(text, maxLines, maxLength) { var lines = Ox.wordwrap(text, maxLength, '
', true, false).split('
'); - return $.map(lines, function(line, i) { + return lines.map(function(line, i) { if (i < maxLines - 1) { return line; } 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; }).join(' '), maxLength, '...', 'center'); } else { diff --git a/source/Ox.UI/js/List/Ox.IconList.js b/source/Ox.UI/js/List/Ox.IconList.js index adcd2006..76c141eb 100644 --- a/source/Ox.UI/js/List/Ox.IconList.js +++ b/source/Ox.UI/js/List/Ox.IconList.js @@ -76,7 +76,7 @@ Ox.IconList = function(options, self) { sort: self.options.sort, type: 'icon', unique: self.options.unique - }, $.extend({}, self)) // pass event handler + }, Ox.extend({}, self)) // pass event handler .addClass('OxIconList Ox' + Ox.toTitleCase(self.options.orientation)) .bindEvent({ select: function() { @@ -113,7 +113,7 @@ Ox.IconList = function(options, self) { } 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({ keys: self.options.keys }); diff --git a/source/Ox.UI/js/List/Ox.InfoList.js b/source/Ox.UI/js/List/Ox.InfoList.js index 34261173..f10dc424 100644 --- a/source/Ox.UI/js/List/Ox.InfoList.js +++ b/source/Ox.UI/js/List/Ox.InfoList.js @@ -131,7 +131,7 @@ Ox.InfoList = function(options, self) { } 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({ keys: self.options.keys }); diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 127b22bf..68078bf9 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -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(); diff --git a/source/Ox.UI/js/List/Ox.TreeList.js b/source/Ox.UI/js/List/Ox.TreeList.js index 75cabaf3..b451f0ea 100644 --- a/source/Ox.UI/js/List/Ox.TreeList.js +++ b/source/Ox.UI/js/List/Ox.TreeList.js @@ -48,7 +48,7 @@ Ox.TreeList = function(options, self) { max: self.options.max, min: self.options.min, unique: 'id' - }, $.extend({}, self)) + }, Ox.extend({}, self)) .addClass('OxTextList OxTreeList') .css({ width: self.options.width + 'px' @@ -119,7 +119,7 @@ Ox.TreeList = function(options, self) { level = level || 0; Ox.forEach(items, function(item) { if (item.id == id) { - ret = $.extend(item, { + ret = Ox.extend(item, { level: level }); return false; @@ -177,7 +177,7 @@ Ox.TreeList = function(options, self) { var $img, pos; item.expanded = expanded; //getItemById(item.id).expanded = expanded; - $.each(that.$element.find('.OxItem'), function() { + that.$element.find('.OxItem').each(function() { var $item = $(this); if ($item.data('id') == item.id) { $img = $item.find('.OxToggle'); diff --git a/source/Ox.UI/js/Map/Ox.MapImage.js b/source/Ox.UI/js/Map/Ox.MapImage.js index 46040e91..f8c9de6f 100644 --- a/source/Ox.UI/js/Map/Ox.MapImage.js +++ b/source/Ox.UI/js/Map/Ox.MapImage.js @@ -28,7 +28,7 @@ Ox.MapImage = function(options, self) { }) .options(options || {}) - $.extend(self, { + Ox.extend(self, { markers: { highlight: [], normal: [] diff --git a/source/Ox.UI/js/Menu/Ox.MainMenu.js b/source/Ox.UI/js/Menu/Ox.MainMenu.js index 5ba0a513..d04b6545 100644 --- a/source/Ox.UI/js/Menu/Ox.MainMenu.js +++ b/source/Ox.UI/js/Menu/Ox.MainMenu.js @@ -38,7 +38,7 @@ Ox.MainMenu = function(options, self) { .html(menu.title) .data('position', position) .appendTo(that.$element); - that.menus[position] = Ox.Menu($.extend(menu, { + that.menus[position] = Ox.Menu(Ox.extend(menu, { element: that.titles[position], mainmenu: that, size: self.options.size diff --git a/source/Ox.UI/js/Menu/Ox.Menu.js b/source/Ox.UI/js/Menu/Ox.Menu.js index c1f4bf2f..f2665d9d 100644 --- a/source/Ox.UI/js/Menu/Ox.Menu.js +++ b/source/Ox.UI/js/Menu/Ox.Menu.js @@ -133,7 +133,7 @@ Ox.Menu = function(options, self) { }); menu.triggerEvent('change', { 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 { id: that.items[v].options('id'), title: Ox.stripTags(that.items[v].options('title')[0]) diff --git a/source/Ox.UI/js/Panel/Ox.SplitPanel.js b/source/Ox.UI/js/Panel/Ox.SplitPanel.js index d317170e..31594bf1 100644 --- a/source/Ox.UI/js/Panel/Ox.SplitPanel.js +++ b/source/Ox.UI/js/Panel/Ox.SplitPanel.js @@ -34,7 +34,7 @@ Ox.SplitPanel = function(options, self) { .options(options || {}) .addClass('OxSplitPanel'); - $.extend(self, { + Ox.extend(self, { dimensions: Ox.UI.DIMENSIONS[self.options.orientation], edges: Ox.UI.EDGES[self.options.orientation], length: self.options.elements.length, @@ -45,7 +45,7 @@ Ox.SplitPanel = function(options, self) { // create elements that.$elements = []; self.options.elements.forEach(function(v, i) { - self.options.elements[i] = $.extend({ + self.options.elements[i] = Ox.extend({ collapsible: false, collapsed: false, resizable: false, diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js index 7969cef0..3c42b029 100644 --- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js +++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js @@ -59,7 +59,7 @@ Ox.AnnotationPanel = function(options, self) { .addClass('OxAnnotation OxEditable OxTarget') .html(Ox.parseHTML(data.value)); }, - items: $.map(self.options.items, function(v, i) { + items: self.options.items.map(function(v, i) { return { id: v.id || i + '', value: v.value diff --git a/source/Ox.UI/js/Video/Ox.BlockTimeline.js b/source/Ox.UI/js/Video/Ox.BlockTimeline.js index 7bc7360a..f19c934f 100644 --- a/source/Ox.UI/js/Video/Ox.BlockTimeline.js +++ b/source/Ox.UI/js/Video/Ox.BlockTimeline.js @@ -34,7 +34,7 @@ Ox.BlockTimeline = function(options, self) { } }); - $.extend(self, { + Ox.extend(self, { $images: [], $lines: [], $markerPoint: [], @@ -157,7 +157,7 @@ Ox.BlockTimeline = function(options, self) { context = canvas.getContext('2d'), imageData = context.createImageData(width, height), data = imageData.data, - points = $.map(self.options.points, function(v, i) { + points = self.options.points.map(function(v, i) { return Math.round(v) + i; }), top = 0, diff --git a/source/Ox.UI/js/Video/Ox.LargeTimeline.js b/source/Ox.UI/js/Video/Ox.LargeTimeline.js index c32b8d00..aa43bbfb 100644 --- a/source/Ox.UI/js/Video/Ox.LargeTimeline.js +++ b/source/Ox.UI/js/Video/Ox.LargeTimeline.js @@ -35,7 +35,7 @@ Ox.LargeTimeline = function(options, self) { drag: drag }); - $.extend(self, { + Ox.extend(self, { $cuts: [], $markerPoint: [], $subtitles: [], diff --git a/source/Ox.UI/js/Video/Ox.SmallTimeline.js b/source/Ox.UI/js/Video/Ox.SmallTimeline.js index f1abe9db..04256edf 100644 --- a/source/Ox.UI/js/Video/Ox.SmallTimeline.js +++ b/source/Ox.UI/js/Video/Ox.SmallTimeline.js @@ -34,7 +34,7 @@ Ox.SmallTimeline = function(options, self) { } }); - $.extend(self, { + Ox.extend(self, { $images: [], $markerPoint: [], $subtitles: [], diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index 5c574efc..a586ccda 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -262,7 +262,7 @@ Ox.VideoEditor = function(options, self) { self.options.layers.forEach(function(layer, i) { self.$annotationPanel[i] = Ox.AnnotationPanel( - $.extend({ + Ox.extend({ width: self.options.annotationSize }, layer) ) @@ -707,11 +707,11 @@ Ox.VideoEditor = function(options, self) { if (type == 'cut') { positions = self.options.cuts; } else if (type == 'result') { - positions = $.map(self.results, function(v, i) { + positions = self.results.map(function(v) { return v['in']; }); } else if (type == 'subtitle') { - positions = $.map(self.options.subtitles, function(v, i) { + positions = self.options.subtitles.map(function(v) { return v['in']; }); } diff --git a/source/Ox.js b/source/Ox.js index 790299a5..c3c39eaa 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -483,30 +483,6 @@ Ox.count = function(arr) { return obj; }; -//@ Ox.each (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 Tests if every element of a collection satisfies a given condition Unlike [].every(), Ox.every() works for arrays,