').addClass('OxSpace'));
$.extend(self, {
- clientXY: self.options.orientation == "horizontal" ? "clientY" : "clientX",
+ clientXY: self.options.orientation == 'horizontal' ? 'clientY' : 'clientX',
dimensions: oxui.getDimensions(self.options.orientation), // fixme: should orientation be the opposite orientation here?
edges: oxui.getEdges(self.options.orientation),
ids: $.map(self.options.elements, function(v, i) {
- return v.options("id");
+ return v.options('id');
}),
length: self.options.resize.length,
startPos: 0,
@@ -1371,34 +1371,34 @@ requires
function drag(e) {
var d = e[self.clientXY] - self.startPos, i;
self.options.size = Ox.limit(self.startSize + d, self.options.resize[0], self.options.resize[self.length - 1]);
- Ox.print("sS", self.startSize, "d", d, "s.o.s", self.options.size)
+ Ox.print('sS', self.startSize, 'd', d, 's.o.s', self.options.size)
$.each(self.options.resize, function(i, v) {
if (self.options.size > v - 8 && self.options.size < v + 8) {
self.options.size = v;
return false;
}
});
- that.css(self.edges[2], self.options.size + "px");
- self.options.elements[0].css(self.dimensions[1], self.options.size + "px");
- self.options.elements[1].css(self.edges[2], (self.options.size + 1) + "px");
- Ox.Event.trigger(self.ids[0], "resize", self.options.size);
- Ox.Event.trigger(self.ids[1], "resize", self.options.elements[1][self.dimensions[1]]());
+ that.css(self.edges[2], self.options.size + 'px');
+ self.options.elements[0].css(self.dimensions[1], self.options.size + 'px');
+ self.options.elements[1].css(self.edges[2], (self.options.size + 1) + 'px');
+ Ox.Event.trigger(self.ids[0], 'resize', self.options.size);
+ Ox.Event.trigger(self.ids[1], 'resize', self.options.elements[1][self.dimensions[1]]());
}
function dragStart(e) {
self.startPos = e[self.clientXY];
self.startSize = self.options.size;
- Ox.print("startSize", self.startSize)
+ Ox.print('startSize', self.startSize)
$window.mousemove(drag);
- $window.one("mouseup", dragStop);
+ $window.one('mouseup', dragStop);
}
function dragStop() {
- $window.unbind("mousemove");
+ $window.unbind('mousemove');
}
function toggle() {
- Ox.print("toggle");
+ Ox.print('toggle');
if (Ox.isUndefined(self.options.position)) {
self.options.position = parseInt(self.options.parent.css(self.options.edge)) +
(self.options.collapsed ? self.options.size : 0);
@@ -1406,11 +1406,11 @@ requires
var size = self.options.position -
(self.options.collapsed ? 0 : self.options.size),
animate = {};
- Ox.print("s.o.e", self.options.edge);
+ Ox.print('s.o.e', self.options.edge);
animate[self.options.edge] = size;
self.options.parent.animate(animate, 200, function() {
- var i = (self.options.edge == "left" || self.options.edge == "top") ? 1 : 0;
- Ox.Event.trigger("resize_" + self.ids[i], self.options.elements[i][self.dimensions[1]]());
+ var i = (self.options.edge == 'left' || self.options.edge == 'top') ? 1 : 0;
+ Ox.Event.trigger(self.ids[i], 'resize', self.options.elements[i][self.dimensions[1]]());
self.options.collapsed = !self.options.collapsed;
});
}
@@ -1436,15 +1436,15 @@ requires
tabs: []
})
.options(options || {})
- .addClass("OxTabbar");
+ .addClass('OxTabbar');
Ox.ButtonGroup({
buttons: self.options.tabs,
group: true,
selectable: true,
selected: self.options.selected,
- size: "medium",
- style: "tab",
+ size: 'medium',
+ style: 'tab',
}).appendTo(that);
return that;
@@ -1471,9 +1471,9 @@ requires
// fixme: dialog should be derived from a generic draggable
// fixme: pass button elements directly
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
- title: "",
+ title: '',
buttons: [],
height: 216,
minHeight: 144,
@@ -1482,47 +1482,47 @@ requires
width: 384
})
.options(options || {})
- .addClass("OxDialog");
+ .addClass('OxDialog');
if (!Ox.isArray(self.options.buttons[0])) {
self.options.buttons = [[], self.options.buttons];
}
that.$titlebar = new Ox.Bar({
- size: "medium"
+ size: 'medium'
})
- .addClass("OxTitleBar")
+ .addClass('OxTitleBar')
.mousedown(drag)
.dblclick(center)
.appendTo(that);
that.$title = new Ox.Element()
- .addClass("OxTitle")
+ .addClass('OxTitle')
.html(self.options.title)
.appendTo(that.$titlebar);
// fixme: should the following be a container?
that.$content = new Ox.Element()
- .addClass("OxContent")
+ .addClass('OxContent')
.css({
- padding: self.options.padding + "px",
- overflow: "auto"
+ padding: self.options.padding + 'px',
+ overflow: 'auto'
})
.appendTo(that);
that.$buttonsbar = new Ox.Bar({})
- .addClass("OxButtonsBar")
+ .addClass('OxButtonsBar')
.appendTo(that);
that.$buttons = [];
$.each(self.options.buttons[0], function(i, button) {
that.$buttons[i] = new Ox.Button({
disabled: button.disabled || false,
- size: "medium",
+ size: 'medium',
title: button.title
})
- .addClass("OxLeft")
+ .addClass('OxLeft')
.click(button.click) // fixme: rather use event?
.appendTo(that.$buttonsbar);
});
that.$resize = new Ox.Element()
- .addClass("OxResize")
+ .addClass('OxResize')
.mousedown(resize)
.dblclick(reset)
.appendTo(that.$buttonsbar);
@@ -1530,16 +1530,16 @@ requires
that.$buttons[that.$buttons.length] = new Ox.Button({
disabled: button.disabled || false,
id: button.id,
- size: "medium",
+ size: 'medium',
title: button.title
})
- .addClass("OxRight")
+ .addClass('OxRight')
.click(button.click) // fixme: rather use event?
.appendTo(that.$buttonsbar);
});
that.$buttons[0].focus();
that.$layer = new Ox.Element() // fixme: Layer widget, that would handle click?
- .addClass("OxLayer")
+ .addClass('OxLayer')
.mousedown(mousedownLayer)
.mouseup(mouseupLayer);
@@ -1547,10 +1547,10 @@ requires
var documentHeight = $document.height();
that.css({
left: 0,
- top: Math.max(parseInt(-documentHeight / 10), self.options.height - documentHeight + 40) + "px",
+ top: Math.max(parseInt(-documentHeight / 10), self.options.height - documentHeight + 40) + 'px',
right: 0,
bottom: 0,
- margin: "auto"
+ margin: 'auto'
});
}
@@ -1576,19 +1576,19 @@ requires
//24, documentHeight - elementHeight
);
that.css({
- left: left + "px",
- top: top + "px"
+ left: left + 'px',
+ top: top + 'px'
});
});
- $window.one("mouseup", function() {
- $window.unbind("mousemove");
+ $window.one('mouseup', function() {
+ $window.unbind('mousemove');
});
}
function getButtonById(id) {
var ret = null
$.each(that.$buttons, function(i, button) {
- if (button.options("id") == id) {
+ if (button.options('id') == id) {
ret = button;
return false;
}
@@ -1643,19 +1643,19 @@ requires
that.height(height);
that.$content.height(height - 48 - 2 * self.options.padding); // fixme: this should happen automatically
});
- $window.one("mouseup", function() {
- $window.unbind("mousemove");
+ $window.one('mouseup', function() {
+ $window.unbind('mousemove');
});
}
self.onChange = function(key, value) {
- if (key == "height" || key == "width") {
+ if (key == 'height' || key == 'width') {
that.animate({
- height: self.options.height + "px",
- width: self.options.width + "px"
+ height: self.options.height + 'px',
+ width: self.options.width + 'px'
}, 250);
that.$content.height(self.options.height - 48 - 2 * self.options.padding); // fixme: this should happen automatically
- } else if (key == "title") {
+ } else if (key == 'title') {
that.$title.animate({
opacity: 0
}, 250, function() {
@@ -1680,13 +1680,13 @@ requires
that.$layer.remove();
callback();
});
- $window.unbind("mouseup", mouseupLayer)
+ $window.unbind('mouseup', mouseupLayer)
return that;
}
that.disable = function() {
// to be used on submit of form, like login
- that.$layer.addClass("OxFront");
+ that.$layer.addClass('OxFront');
return that;
};
@@ -1697,7 +1697,7 @@ requires
};
that.enable = function() {
- that.$layer.removeClass("OxFront");
+ that.$layer.removeClass('OxFront');
return that;
};
@@ -1716,7 +1716,7 @@ requires
}).appendTo($body).animate({
opacity: 1
}, 200);
- $window.bind("mouseup", mouseupLayer)
+ $window.bind('mouseup', mouseupLayer)
return that;
};
@@ -1758,10 +1758,10 @@ requires
Ox.Form = function(options, self) {
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
- error: "",
- id: "",
+ error: '',
+ id: '',
items: [],
submit: null
})
@@ -1777,27 +1777,27 @@ requires
// fixme: form isn't necessarily empty/invalid
$.map(self.options.items, function(item, i) {
- self.itemIds[i] = item.id || item.element.options("id");
+ self.itemIds[i] = item.id || item.element.options('id');
self.itemIsValid[i] = false;
});
$.each(self.options.items, function(i, item) {
- var id = item.element.options("id");
+ var id = item.element.options('id');
that.append(self.$items[i] = new Ox.FormItem(item))
- .append(self.$messages[i] = new Ox.Element().addClass("OxFormMessage"));
+ .append(self.$messages[i] = new Ox.Element().addClass('OxFormMessage'));
// fixme: use widget.bindEvent()
- Ox.Event.bind(id, "validate", function(event, data) {
+ Ox.Event.bind(id, 'validate', function(event, data) {
validate(i, data.valid);
});
- Ox.Event.bind(id, "blur", function(event, data) {
+ Ox.Event.bind(id, 'blur', function(event, data) {
validate(i, data.valid);
if (data.valid) {
- self.$messages[i].html("").hide();
+ self.$messages[i].html('').hide();
} else {
self.$messages[i].html(data.message).show();
}
});
- Ox.Event.bind(id, "submit", function(event, data) {
+ Ox.Event.bind(id, 'submit', function(event, data) {
self.formIsValid && that.submit();
});
});
@@ -1807,7 +1807,7 @@ requires
}
function setMessage(id, message) {
- self.$messages[getItemPositionById(id)].html(message)[message !== "" ? "show" : "hide"]();
+ self.$messages[getItemPositionById(id)].html(message)[message !== '' ? 'show' : 'hide']();
}
function submitCallback(data) {
@@ -1817,11 +1817,11 @@ requires
}
function validate(pos, valid) {
- Ox.print("validate", pos, valid)
+ Ox.print('validate', pos, valid)
self.itemIsValid[pos] = valid;
if (Ox.every(self.itemIsValid) != self.formIsValid) {
self.formIsValid = !self.formIsValid;
- that.triggerEvent("validate", {
+ that.triggerEvent('validate', {
valid: self.formIsValid
});
}
@@ -1853,13 +1853,13 @@ requires
Ox.FormItem = function(options, self) {
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
element: null,
- error: "",
+ error: '',
})
.options(options || {})
- .addClass("OxFormItem")
+ .addClass('OxFormItem')
.append(self.options.element);
that.value = function() {
@@ -1884,45 +1884,45 @@ requires
select selectable button was selected
*/
var self = self || {},
- that = new Ox.Element("input", self)
+ that = new Ox.Element('input', self)
.defaults({
disabled: false,
group: false,
- id: "",
- overlap: "none",
+ id: '',
+ overlap: 'none',
selectable: false,
selected: false,
- size: "medium",
- // fixme: "default" or ""?
- style: "default", // can be default, checkbox, symbol, or tab
- title: "",
- tooltip: "",
- type: "text",
- width: "auto"
+ size: 'medium',
+ // fixme: 'default' or ''?
+ style: 'default', // can be default, checkbox, symbol, or tab
+ title: '',
+ tooltip: '',
+ type: 'text',
+ width: 'auto'
})
.options(options || {})
.attr({
- disabled: self.options.disabled ? "disabled" : "",
- type: self.options.type == "text" ? "button" : "image"
+ disabled: self.options.disabled ? 'disabled' : '',
+ type: self.options.type == 'text' ? 'button' : 'image'
})
- .addClass("OxButton Ox" + Ox.toTitleCase(self.options.size) +
- (self.options.disabled ? " OxDisabled": "") +
- (self.options.selected ? " OxSelected": "") +
- (self.options.style != "default" ? " Ox" + Ox.toTitleCase(self.options.style) : "") +
- (self.options.overlap != "none" ? " OxOverlap" + Ox.toTitleCase(self.options.overlap) : ""))
- .css(self.options.width == "auto" ? {} : {
- width: (self.options.width - 14) + "px"
+ .addClass('OxButton Ox' + Ox.toTitleCase(self.options.size) +
+ (self.options.disabled ? ' OxDisabled': '') +
+ (self.options.selected ? ' OxSelected': '') +
+ (self.options.style != 'default' ? ' Ox' + Ox.toTitleCase(self.options.style) : '') +
+ (self.options.overlap != 'none' ? ' OxOverlap' + Ox.toTitleCase(self.options.overlap) : ''))
+ .css(self.options.width == 'auto' ? {} : {
+ width: (self.options.width - 14) + 'px'
})
.mousedown(mousedown)
.click(click);
$.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
} : {
selectedTitle: 0,
titles: [{
- id: "",
+ id: '',
title: self.options.title
}]
});
@@ -1941,10 +1941,10 @@ requires
function click() {
var data = self.titles[self.selectedTitle];
if (!self.options.selectable) {
- that.triggerEvent("click", data);
+ that.triggerEvent('click', data);
} else {
if (self.options.group) {
- that.triggerEvent("select", data);
+ that.triggerEvent('select', data);
} else {
that.toggleSelected();
}
@@ -1955,7 +1955,7 @@ requires
}
function mousedown(event) {
- if (self.options.type == "image" && $.browser.safari) {
+ if (self.options.type == 'image' && $.browser.safari) {
// keep image from being draggable
event.preventDefault();
}
@@ -1971,10 +1971,10 @@ requires
function setTitle(title) {
self.title = title;
- if (self.options.type == "image") {
+ if (self.options.type == 'image') {
that.attr({
- src: oxui.path + "png/ox.ui." + Ox.theme() +
- "/symbol" + Ox.toTitleCase(title) + ".png"
+ src: oxui.path + 'png/ox.ui.' + Ox.theme() +
+ '/symbol' + Ox.toTitleCase(title) + '.png'
});
} else {
that.val(title);
@@ -1982,21 +1982,21 @@ requires
}
self.onChange = function(key, value) {
- if (key == "disabled") {
+ if (key == 'disabled') {
that.attr({
- disabled: value ? "disabled" : ""
+ disabled: value ? 'disabled' : ''
})
- .toggleClass("OxDisabled");
- } else if (key == "selected") {
- if (value != that.hasClass("OxSelected")) { // fixme: neccessary?
- that.toggleClass("OxSelected");
+ .toggleClass('OxDisabled');
+ } else if (key == 'selected') {
+ if (value != that.hasClass('OxSelected')) { // fixme: neccessary?
+ that.toggleClass('OxSelected');
}
- that.triggerEvent("change");
- } else if (key == "title") {
+ that.triggerEvent('change');
+ } else if (key == 'title') {
setTitle(value);
- } else if (key == "width") {
+ } else if (key == 'width') {
that.$element.css({
- width: (value - 14) + "px"
+ width: (value - 14) + 'px'
});
}
}
@@ -2016,7 +2016,7 @@ requires
that.toggleTitle = function() {
self.selectedTitle = 1 - self.selectedTitle;
setTitle(self.titles[self.selectedTitle].title);
- self.$tooltip.options({
+ self.$tooltip && self.$tooltip.options({
title: self.tooltips[self.selectedTitle]
});
}
@@ -2034,7 +2034,7 @@ requires
max integer, maximum number of selected buttons, 0 for all
min integer, minimum number of selected buttons, 0 for none
selectable if true, buttons are selectable
- type string, "image" or "text"
+ type string, 'image' or 'text'
events:
change {id, value} selection within a group changed
*/
@@ -2046,19 +2046,19 @@ requires
max: 1,
min: 1,
selectable: false,
- size: "medium",
- style: "",
- type: "text",
+ size: 'medium',
+ style: '',
+ type: 'text',
})
.options(options || {})
- .addClass("OxButtonGroup");
+ .addClass('OxButtonGroup');
if (self.options.selectable) {
self.optionGroup = new Ox.OptionGroup(
self.options.buttons,
self.options.min,
self.options.max,
- "selected"
+ 'selected'
);
self.options.buttons = self.optionGroup.init();
}
@@ -2077,7 +2077,7 @@ requires
title: button.title,
type: self.options.type
})
- .bindEvent("select", function() {
+ .bindEvent('select', function() {
selectButton(position);
})
.appendTo(that);
@@ -2089,7 +2089,7 @@ requires
$.each(toggled, function(i, pos) {
self.$buttons[pos].toggleSelected();
});
- that.triggerEvent("change", {
+ that.triggerEvent('change', {
selected: $.map(self.optionGroup.selected(), function(v, i) {
return self.options.buttons[v].id;
})
@@ -2122,34 +2122,34 @@ requires
***/
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
disabled: false,
- id: "",
+ id: '',
group: false,
checked: false,
- title: "",
- width: "auto"
+ title: '',
+ width: 'auto'
})
.options(options || {})
- .addClass("OxCheckbox")
+ .addClass('OxCheckbox')
.attr(self.options.disabled ? {
- disabled: "disabled"
+ disabled: 'disabled'
} : {});
if (self.options.title) {
- self.options.width != "auto" && that.css({
- width: self.options.width + "px"
+ self.options.width != 'auto' && that.css({
+ width: self.options.width + 'px'
});
self.$title = new Ox.Label({
disabled: self.options.disabled,
- id: self.options.id + "Label",
- overlap: "left",
+ id: self.options.id + 'Label',
+ overlap: 'left',
title: self.options.title,
width: self.options.width - 16
})
.css({
- float: "right"
+ float: 'right'
})
.click(clickTitle)
.appendTo(that);
@@ -2157,14 +2157,14 @@ requires
self.$button = new Ox.Button({
disabled: self.options.disabled,
- id: self.options.id + "Button",
+ id: self.options.id + 'Button',
title: [
- {id: "none", title: "none", selected: !self.options.checked},
- {id: "check", title: "check", selected: self.options.checked}
+ {id: 'none', title: 'none', selected: !self.options.checked},
+ {id: 'check', title: 'check', selected: self.options.checked}
],
- type: "image"
+ type: 'image'
})
- .addClass("OxCheckbox")
+ .addClass('OxCheckbox')
.click(clickButton)
.appendTo(that);
@@ -2173,7 +2173,7 @@ requires
// click will have toggled the button,
// if it is part of a group, we have to revert that
self.options.group && that.toggleChecked();
- that.triggerEvent("change", {
+ that.triggerEvent('change', {
checked: self.options.checked,
id: self.options.id,
title: self.options.title
@@ -2181,11 +2181,11 @@ requires
}
function clickTitle() {
- !self.options.disabled && self.$button.trigger("click");
+ !self.options.disabled && self.$button.trigger('click');
}
self.onChange = function(key, value) {
- if (key == "checked") {
+ if (key == 'checked') {
that.toggleChecked();
}
};
@@ -2202,7 +2202,7 @@ requires
Ox.CheckboxGroup = function(options, self) {
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
checkboxes: [],
max: 1,
@@ -2210,7 +2210,7 @@ requires
width: 256
})
.options(options || {})
- .addClass("OxCheckboxGroup");
+ .addClass('OxCheckboxGroup');
self.optionGroup = new Ox.OptionGroup(
self.options.checkboxes,
@@ -2234,7 +2234,7 @@ requires
id: id,
width: self.checkboxWidth[position]
}))
- .bindEvent("change", function() {
+ .bindEvent('change', function() {
change(position);
})
.appendTo(that);
@@ -2242,12 +2242,12 @@ requires
function change(pos) {
var toggled = self.optionGroup.toggle(pos);
- //Ox.print("change", pos, "toggled", toggled)
+ //Ox.print('change', pos, 'toggled', toggled)
if (toggled.length) {
$.each(toggled, function(i, pos) {
self.$checkboxes[pos].toggleChecked();
});
- that.triggerEvent("change", {
+ that.triggerEvent('change', {
checked: $.map(self.optionGroup.checked(), function(v, i) {
return self.options.checkboxes[v].id;
})
@@ -2263,7 +2263,7 @@ requires
/*
options:
- arrows boolearn, if true, and type is "float" or "integer", display arrows
+ arrows boolearn, if true, and type is 'float' or 'integer', display arrows
arrowStep number, step when clicking arrows
autocomplete array of possible values, or
function(key, value, callback), returns one or more values
@@ -2272,18 +2272,18 @@ requires
autocompleteSelect boolean, if true, menu is displayed
autocompleteSelectHighlight boolean, if true, value in menu is highlighted
autocompleteSelectSubmit boolean, if true, submit input on menu selection
- autovalidate string ("email", "float", "integer", "phone", "url"), or
+ autovalidate string ('email', 'float', 'integer', 'phone', 'url'), or
regexp(value), or
function(key, value, blur, callback), returns value
clear boolean, if true, has clear button
disabled boolean, if true, is disabled
- height integer, px (for type="textarea" and type="range" with orientation="horizontal")
+ height integer, px (for type='textarea' and type='range' with orientation='horizontal')
id string, element id
key string, to be passed to autocomplete and autovalidate functions
- max number, max value if type is "integer" or "float"
- min number, min value if type is "integer" or "float"
- name string, will be displayed by autovalidate function ("invalid " + name)
- overlap string, "", "left" or "right", will cause padding and negative margin
+ max number, max value if type is 'integer' or 'float'
+ min number, min value if type is 'integer' or 'float'
+ name string, will be displayed by autovalidate function ('invalid ' + name)
+ overlap string, '', 'left' or 'right', will cause padding and negative margin
picker
//rangeOptions
arrows boolean, if true, display arrows
@@ -2291,7 +2291,7 @@ requires
//arrowSymbols array of two strings
max number, maximum value
min number, minimum value
- orientation "horizontal" or "vertical"
+ orientation 'horizontal' or 'vertical'
step number, step
thumbValue boolean, if true, value is displayed on thumb, or
array of strings per value, or
@@ -2300,11 +2300,11 @@ requires
trackGradient string, css gradient for track
trackImage string, image url, or
array of image urls
- //trackStep number, 0 for "scroll here", positive for step
+ //trackStep number, 0 for 'scroll here', positive for step
trackValues boolean
serialize
- textAlign "left", "center" or "right"
- type "float", "integer", "password", "text"
+ textAlign 'left', 'center' or 'right'
+ type 'float', 'integer', 'password', 'text'
value string
width integer, px
methods:
@@ -2314,7 +2314,7 @@ requires
*/
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
arrows: false,
arrowStep: 1,
@@ -2326,22 +2326,22 @@ requires
autocompleteSelectSubmit: false,
autovalidate: null,
clear: false,
- key: "",
+ key: '',
min: 0,
max: 100,
- label: "",
+ label: '',
labelWidth: 64,
- overlap: "none",
- placeholder: "",
+ overlap: 'none',
+ placeholder: '',
serialize: null,
- textAlign: "left",
- type: "text",
- value: "",
+ textAlign: 'left',
+ type: 'text',
+ value: '',
width: 128
})
.options(options)
- .addClass("OxInput OxMedium")
- .addEvent($.extend(self.options.type == "textarea" ? {} : {
+ .addClass('OxInput OxMedium')
+ .addEvent($.extend(self.options.type == 'textarea' ? {} : {
key_enter: submit
}, {
key_escape: cancel
@@ -2351,35 +2351,35 @@ requires
Ox.isArray(self.options.autocomplete) &&
self.options.autocompleteReplace &&
self.options.autocompleteReplaceCorrect &&
- self.options.value === ""
+ self.options.value === ''
) {
self.options.value = self.options.autocomplete[0]
}
// fixme: set to min, not 0
- if (self.options.type == "float") {
+ if (self.options.type == 'float') {
$.extend(self.options, {
- autovalidate: "float",
- textAlign: "right",
- value: self.options.value || "0.0"
+ autovalidate: 'float',
+ textAlign: 'right',
+ value: self.options.value || '0.0'
});
- } else if (self.options.type == "integer") {
+ } else if (self.options.type == 'integer') {
$.extend(self.options, {
- autovalidate: "integer",
- textAlign: "right",
- value: self.options.value || "0"
+ autovalidate: 'integer',
+ textAlign: 'right',
+ value: self.options.value || '0'
});
}
if (self.options.label) {
self.$label = new Ox.Label({
- overlap: "right",
- textAlign: "right",
+ overlap: 'right',
+ textAlign: 'right',
title: self.options.label,
width: self.options.labelWidth
})
.css({
- float: "left", // fixme: use css rule
+ float: 'left', // fixme: use css rule
})
.click(function() {
that.focus();
@@ -2391,24 +2391,24 @@ requires
self.arrows = [];
self.arrows[0] = [
new Ox.Button({
- overlap: "right",
- title: "previous",
- type: "image"
+ overlap: 'right',
+ title: 'previous',
+ type: 'image'
})
.css({
- float: "left"
+ float: 'left'
})
.click(function() {
clickArrow(0);
})
.appendTo(that),
new Ox.Button({
- overlap: "left",
- title: "next",
- type: "image"
+ overlap: 'left',
+ title: 'next',
+ type: 'image'
})
.css({
- float: "right"
+ float: 'right'
})
.click(function() {
clickArrow(1);
@@ -2419,31 +2419,31 @@ requires
$.extend(self, {
bindKeyboard: self.options.autocomplete || self.options.autovalidate,
- hasPasswordPlaceholder: self.options.type == "password" && self.options.placeholder,
+ hasPasswordPlaceholder: self.options.type == 'password' && self.options.placeholder,
inputWidth: getInputWidth()
});
if (self.options.clear) {
self.$button = new Ox.Button({
- overlap: "left",
- title: "clear",
- type: "image"
+ overlap: 'left',
+ title: 'clear',
+ type: 'image'
})
.css({
- float: "right" // fixme: use css rule
+ float: 'right' // fixme: use css rule
})
.click(clear)
.appendTo(that);
}
- self.$input = $("
")
- .addClass("OxInput OxMedium")
+ self.$input = $('
')
+ .addClass('OxInput OxMedium')
.attr({
- disabled: self.options.disabled ? "disabled" : "",
- type: self.options.type == "password" ? "password" : "text"
+ disabled: self.options.disabled ? 'disabled' : '',
+ type: self.options.type == 'password' ? 'password' : 'text'
})
.css({
- width: self.inputWidth + "px",
+ width: self.inputWidth + 'px',
textAlign: self.options.textAlign
})
.val(self.options.value)
@@ -2454,14 +2454,14 @@ requires
if (self.hasPasswordPlaceholder) {
self.$input.hide();
- self.$placeholder = $("
")
- .addClass("OxInput OxMedium OxPlaceholder")
+ self.$placeholder = $('
')
+ .addClass('OxInput OxMedium OxPlaceholder')
.attr({
- type: "text"
+ type: 'text'
})
.css({
- //float: "left",
- width: self.inputWidth + "px"
+ //float: 'left',
+ width: self.inputWidth + 'px'
})
.val(self.options.placeholder)
.focus(focus)
@@ -2471,14 +2471,14 @@ requires
if (self.options.autocomplete && self.options.autocompleteSelect) {
self.$autocompleteMenu = new 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?,
+ id: self.options.id + 'Menu', // fixme: we do this in other places ... are we doing it the same way? var name?,
offset: {
left: 4,
top: 0
},
size: self.options.size
})
- .bindEvent("click", clickMenu);
+ .bindEvent('click', clickMenu);
if (self.options.autocompleteReplace) {
self.$autocompleteMenu.bindEvent({
deselect: deselectMenu,
@@ -2514,7 +2514,7 @@ requires
function autocompleteCallback(values) {
- Ox.print("autocompleteCallback", values[0], self.options.value, self.options.value.length, oldValue, oldCursor)
+ Ox.print('autocompleteCallback', values[0], self.options.value, self.options.value.length, oldValue, oldCursor)
var length = self.options.value.length,
deleted = length <= oldValue.length - (oldCursor[1] - oldCursor[0]),
@@ -2528,7 +2528,7 @@ requires
selectEnd = length == 0 || (values[0] && values[0].length),
value;
- Ox.print("selectEnd", selectEnd)
+ Ox.print('selectEnd', selectEnd)
if (self.options.autocompleteReplace) {
self.options.value = newValue;
@@ -2554,10 +2554,10 @@ requires
selected = i;
}
return {
- id: v.toLowerCase().replace(/ /g, "_"), // fixme: need function to do lowercase, underscores etc?
+ id: v.toLowerCase().replace(/ /g, '_'), // fixme: need function to do lowercase, underscores etc?
title: self.options.autocompleteSelectHighlight ? v.replace(
- new RegExp("(" + value + ")", "ig"),
- "
$1"
+ new RegExp('(' + value + ')', 'ig'),
+ '
$1'
) : v
};
}),
@@ -2568,7 +2568,7 @@ requires
}
}
- that.triggerEvent("autocomplete", {
+ that.triggerEvent('autocomplete', {
value: newValue
});
@@ -2604,56 +2604,56 @@ requires
function autovalidateFunction(value) {
var regexp = new RegExp(self.options.autovalidate);
- return $.map(value.toLowerCase().split(""), function(v, i) {
+ return $.map(value.toLowerCase().split(''), function(v, i) {
if (regexp(v)) {
return v;
} else {
return null;
}
- }).join("");
+ }).join('');
}
function autovalidateTypeFunction(type, value) {
var cursor,
- regexp = type == "float" ? /[\d\.]/ : /\d/;
- if (type == "float") {
- if (value.indexOf(".") != value.lastIndexOf(".")) {
+ regexp = type == 'float' ? /[\d\.]/ : /\d/;
+ if (type == 'float') {
+ if (value.indexOf('.') != value.lastIndexOf('.')) {
value = oldValue;
} else {
if (self.autovalidateFloatFlag) {
- if (Ox.endsWith(value, ".")) {
+ if (Ox.endsWith(value, '.')) {
value = value.substr(0, value.length - 1);
}
self.autovalidateFloatFlag = false;
}
- while (Ox.startsWith(value, ".")) {
- if (Ox.startsWith(value, "..")) {
+ while (Ox.startsWith(value, '.')) {
+ if (Ox.startsWith(value, '..')) {
value = value.substr(1);
} else {
- value = "0" + value;
+ value = '0' + value;
}
}
- if (Ox.endsWith(value, ".")) {
- value += "0";
+ if (Ox.endsWith(value, '.')) {
+ value += '0';
cursor = [value.length - 1, value.length];
self.autovalidateFloatFlag = true;
}
}
}
- value = $.map(value.split(""), function(v, i) {
+ value = $.map(value.split(''), function(v, i) {
if (regexp(v)) {
return v;
} else {
return null;
}
- }).join("");
- if (type == "integer") {
- while (value.length > 1 && Ox.startsWith(value, "0")) {
+ }).join('');
+ if (type == 'integer') {
+ while (value.length > 1 && Ox.startsWith(value, '0')) {
value = value.substr(1);
}
}
- if (value === "") {
- value = type == "float" ? "0.0" : "0";
+ if (value === '') {
+ value = type == 'float' ? '0.0' : '0';
cursor = [0, value.length];
} else if (value > self.options.max) {
value = oldValue;
@@ -2662,13 +2662,13 @@ requires
}
function autovalidateCallback(newValue, newCursor) {
- Ox.print("autovalidateCallback", newValue, oldCursor)
+ Ox.print('autovalidateCallback', newValue, oldCursor)
self.options.value = newValue;
self.$input.val(self.options.value);
!blur && cursor(
newCursor || (oldCursor[1] + newValue.length - oldValue.length)
);
- that.triggerEvent("autovalidate", {
+ that.triggerEvent('autovalidate', {
value: self.options.value
});
}
@@ -2678,7 +2678,7 @@ requires
/*
function autovalidate(blur) {
- Ox.print("autovalidate", self.options.value, blur || false)
+ Ox.print('autovalidate', self.options.value, blur || false)
self.autocorrectBlur = blur || false;
self.autocorrectCursor = cursor();
Ox.isFunction(self.options.autocorrect) ?
@@ -2696,27 +2696,27 @@ requires
function autovalidateFunction(value) {
var length = value.length;
- return $.map(value.toLowerCase().split(""), function(v, i) {
+ return $.map(value.toLowerCase().split(''), function(v, i) {
if (new RegExp(self.options.autocorrect)(v)) {
return v;
} else {
return null;
}
- }).join("");
+ }).join('');
}
*/
function blur() {
- Ox.print("blur")
+ Ox.print('blur')
that.loseFocus();
- //that.removeClass("OxFocus");
+ //that.removeClass('OxFocus');
self.options.value = self.$input.val();
self.options.autovalidate && autovalidate(true);
self.options.placeholder && setPlaceholder();
if (self.bindKeyboard) {
- $document.unbind("keydown", keypress);
- $document.unbind("keypress", keypress);
+ $document.unbind('keydown', keypress);
+ $document.unbind('keypress', keypress);
}
}
@@ -2726,7 +2726,7 @@ requires
function change() {
self.options.value = self.$input.val();
- that.triggerEvent("change", {
+ that.triggerEvent('change', {
value: self.options.value
});
}
@@ -2734,11 +2734,11 @@ requires
function clear() {
// fixme: set to min, not zero
// fixme: make this work for password
- var value = "";
- if (self.options.type == "float") {
- value = "0.0";
- } else if (self.options.type == "integer") {
- value = "0"
+ var value = '';
+ if (self.options.type == 'float') {
+ value = '0.0';
+ } else if (self.options.type == 'integer') {
+ value = '0'
}
self.$input.val(value);
cursor(0, value.length);
@@ -2754,7 +2754,7 @@ requires
}
function clickMenu(event, data) {
- Ox.print("clickMenu", data);
+ Ox.print('clickMenu', data);
self.options.value = data.title;
self.$input.val(self.options.value).focus();
that.gainFocus();
@@ -2785,18 +2785,18 @@ requires
}
function focus() {
- Ox.print("focus()")
+ Ox.print('focus()')
if (
- that.hasClass("OxFocus") || // fixme: this is just a workaround, since for some reason, focus() gets called twice on focus
- (self.$autocompleteMenu && self.$autocompleteMenu.is(":visible")) ||
- (self.hasPasswordPlaceholder && self.$input.is(":visible"))
+ that.hasClass('OxFocus') || // fixme: this is just a workaround, since for some reason, focus() gets called twice on focus
+ (self.$autocompleteMenu && self.$autocompleteMenu.is(':visible')) ||
+ (self.hasPasswordPlaceholder && self.$input.is(':visible'))
) {
return;
}
that.gainFocus();
self.options.placeholder && setPlaceholder();
if (self.bindKeyboard) {
- Ox.print("binding...")
+ Ox.print('binding...')
// fixme: different in webkit and firefox (?), see keyboard handler, need generic function
$document.keydown(keypress);
$document.keypress(keypress);
@@ -2817,12 +2817,12 @@ requires
newValue = oldValue.substr(0, oldCursor[0] - 1),
hasDeletedSelectedEnd = (event.keyCode == 8 || event.keyCode == 46) &&
oldCursor[0] < oldCursor[1] && oldCursor[1] == oldValue.length;
- Ox.print("keypress", event.keyCode)
+ Ox.print('keypress', event.keyCode)
if (event.keyCode != 9 && event.keyCode != 13 && event.keyCode != 27) { // fixme: can't 13 and 27 return false?
setTimeout(function() { // wait for val to be set
var value = self.$input.val();
if (self.options.autocompleteReplaceCorrect && hasDeletedSelectedEnd) {
- Ox.print(value, "->", newValue);
+ Ox.print(value, '->', newValue);
value = newValue; // value.substr(0, value.length - 1);
self.$input.val(value);
}
@@ -2833,14 +2833,14 @@ requires
}
}, 0);
}
- if ((event.keyCode == 38 || event.keyCode == 40) && self.options.autocompleteSelect && self.$autocompleteMenu.is(":visible")) {
+ if ((event.keyCode == 38 || event.keyCode == 40) && self.options.autocompleteSelect && self.$autocompleteMenu.is(':visible')) {
return false;
}
}
function selectMenu(event, data) {
var pos = cursor();
- Ox.print("selectMenu", pos)
+ Ox.print('selectMenu', pos)
self.options.value = data.title
self.$input.val(self.options.value);
cursor(pos[0], self.options.value.length)
@@ -2848,30 +2848,30 @@ requires
function setPlaceholder() {
if (self.options.placeholder) {
- if (that.hasClass("OxFocus")) {
- if (self.options.value === "") {
- if (self.options.type == "password") {
+ if (that.hasClass('OxFocus')) {
+ if (self.options.value === '') {
+ if (self.options.type == 'password') {
self.$placeholder.hide();
self.$input.show().focus();
} else {
self.$input
- .removeClass("OxPlaceholder")
- .val("");
+ .removeClass('OxPlaceholder')
+ .val('');
}
}
} else {
- if (self.options.value === "") {
- if (self.options.type == "password") {
+ if (self.options.value === '') {
+ if (self.options.type == 'password') {
self.$input.hide();
self.$placeholder.show();
} else {
self.$input
- .addClass("OxPlaceholder")
+ .addClass('OxPlaceholder')
.val(self.options.placeholder)
}
} else {
self.$input
- .removeClass("OxPlaceholder")
+ .removeClass('OxPlaceholder')
.val(self.options.value)
}
}
@@ -2884,24 +2884,24 @@ requires
function submit() {
self.$input.blur();
- that.triggerEvent("submit", {
+ that.triggerEvent('submit', {
value: self.options.value
});
}
self.onChange = function(key, value) {
var inputWidth, val;
- if (key == "value") {
+ if (key == 'value') {
val = self.$input.val();
self.$input.val(value);
setPlaceholder();
- } else if (key == "width") {
+ } else if (key == 'width') {
inputWidth = getInputWidth();
self.$input.css({
- width: inputWidth + "px"
+ width: inputWidth + 'px'
});
self.hasPasswordPlaceholder && self.$placeholder.css({
- width: inputWidth + "px"
+ width: inputWidth + 'px'
});
}
};
@@ -2922,13 +2922,13 @@ requires
ret = null,
values = [];
$.each(Ox.range(min, max + 1), function(i, v) {
- values.push(v + "");
+ values.push(v + '');
pad && v.toString().length < maxLength && values.push(Ox.pad(v, maxLength));
});
return function(value, blur, callback) {
var results;
- if (year && value == "1") {
- value = "1900";
+ if (year && value == '1') {
+ value = '1900';
} else {
results = Ox.find(values, value);
value = results[0].length == 1 && results[0][0].length < maxLength ?
@@ -2949,15 +2949,15 @@ requires
***/
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
- id: "",
+ id: '',
inputs: [],
separators: [],
width: 0
})
.options(options || {})
- .addClass("OxInputGroup")
+ .addClass('OxInputGroup')
.click(click);
if (self.options.width) {
@@ -2966,7 +2966,7 @@ requires
self.options.width = getWidth();
}
that.css({
- width: self.options.width + "px"
+ width: self.options.width + 'px'
});
$.extend(self, {
@@ -2976,27 +2976,27 @@ requires
$.each(self.options.separators, function(i, v) {
self.$separator[i] = new Ox.Label({
- textAlign: "center",
+ textAlign: 'center',
title: v.title,
width: v.width + 32
})
- .addClass("OxSeparator")
+ .addClass('OxSeparator')
.css({
- marginLeft: (self.options.inputs[i].options("width") - (i == 0 ? 16 : 32)) + "px"
+ marginLeft: (self.options.inputs[i].options('width') - (i == 0 ? 16 : 32)) + 'px'
})
.appendTo(that);
});
$.each(self.options.inputs, function(i, $input) {
$input.options({
- id: self.options.id + Ox.toTitleCase($input.options("id")),
+ id: self.options.id + Ox.toTitleCase($input.options('id')),
parent: that
})
.css({
marginLeft: -Ox.sum($.map(self.options.inputs, 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);
- })) + "px"
+ })) + 'px'
})
.bindEvent({
change: change,
@@ -3006,20 +3006,20 @@ requires
});
function change(event, data) {
- Ox.print("InputGroup change")
+ Ox.print('InputGroup change')
// fixme: would be good to pass a value here
- that.triggerEvent("change");
+ that.triggerEvent('change');
}
function click(event) {
- if ($(event.target).hasClass("OxSeparator")) {
+ if ($(event.target).hasClass('OxSeparator')) {
self.options.inputs[0].focus();
}
}
function getWidth() {
return Ox.sum($.map(self.options.inputs, function(v, i) {
- return v.options("width");
+ return v.options('width');
})) + Ox.sum($.map(self.options.separators, function(v, i) {
return v.width;
}));
@@ -3043,8 +3043,8 @@ requires
that.getInputById = function(id) {
var input = null;
$.each(self.options.inputs, function(i, v) {
- Ox.print(v, v.options("id"), id)
- if (v.options("id") == self.options.id + Ox.toTitleCase(id)) {
+ Ox.print(v, v.options('id'), id)
+ if (v.options('id') == self.options.id + Ox.toTitleCase(id)) {
input = v;
return false;
}
@@ -3060,38 +3060,38 @@ requires
var self = $.extend(self || {}, {
options: $.extend({
- id: "",
- value: "0, 0, 0"
+ id: '',
+ value: '0, 0, 0'
}, options)
}),
that;
- self.values = self.options.value.split(", ");
+ self.values = self.options.value.split(', ');
self.$inputs = [];
- $.each(["red", "green", "blue"], function(i, v) {
+ $.each(['red', 'green', 'blue'], function(i, v) {
self.$inputs[i] = new Ox.Input({
id: v,
max: 255,
- type: "integer",
+ type: 'integer',
value: self.values[i],
width: 36
})
- .bindEvent("autovalidate", change);
+ .bindEvent('autovalidate', change);
});
self.$inputs[3] = new Ox.Label({
- id: "color",
+ id: 'color',
width: 36
})
.css({
- background: "rgb(" + self.options.value + ")"
+ background: 'rgb(' + self.options.value + ')'
});
self.$inputs[4] = new Ox.ColorPicker({
- id: "picker"
+ id: 'picker'
})
- .bindEvent("change", function(event, data) {
- Ox.print("change function called");
+ .bindEvent('change', function(event, data) {
+ Ox.print('change function called');
self.options.value = data.value;
- self.values = data.value.split(", ");
+ self.values = data.value.split(', ');
$.each(Ox.range(3), function(i) {
self.$inputs[i].options({
value: self.values[i]
@@ -3106,21 +3106,21 @@ requires
id: self.options.id,
inputs: self.$inputs,
separators: [
- {title: ",", width: 8},
- {title: ",", width: 8},
- {title: "", width: 8},
- {title: "", width: 8}
+ {title: ',', width: 8},
+ {title: ',', width: 8},
+ {title: '', width: 8},
+ {title: '', width: 8}
],
value: self.options.value // fixme: it'd be nicer if this would be taken care of by passing self
}, self)
- .bindEvent("change", change);
+ .bindEvent('change', change);
function change() {
self.options.value = $.map(self.$inputs, function(v, i) {
- return v.options("value");
- }).join(", ");
+ return v.options('value');
+ }).join(', ');
self.$inputs[3].css({
- background: "rgb(" + self.options.value + ")"
+ background: 'rgb(' + self.options.value + ')'
});
}
@@ -3132,13 +3132,13 @@ requires
var self = $.extend(self || {}, {
options: $.extend({
- format: "short",
- value: Ox.formatDate(new Date(), "%F"),
+ format: 'short',
+ value: Ox.formatDate(new Date(), '%F'),
weekday: false,
width: {
day: 32,
- month: options.format == "long" ? 80 : (options.format == "medium" ? 40 : 32),
- weekday: options.format == "long" ? 80 : 40,
+ month: options.format == 'long' ? 80 : (options.format == 'medium' ? 40 : 32),
+ weekday: options.format == 'long' ? 80 : 40,
year: 48
}
}, options)
@@ -3146,18 +3146,18 @@ requires
that;
$.extend(self, {
- date: new Date(self.options.value.replace(/-/g, "/")),
+ date: new Date(self.options.value.replace(/-/g, '/')),
formats: {
- day: "%d",
- month: self.options.format == "short" ? "%m" :
- (self.options.format == "medium" ? "%b" : "%B"),
- weekday: self.options.format == "long" ? "%A" : "%a",
- year: "%Y"
+ day: '%d',
+ month: self.options.format == 'short' ? '%m' :
+ (self.options.format == 'medium' ? '%b' : '%B'),
+ weekday: self.options.format == 'long' ? '%A' : '%a',
+ year: '%Y'
},
- months: self.options.format == "long" ? Ox.MONTHS : $.map(Ox.MONTHS, function(v, i) {
+ 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) {
+ weekdays: self.options.format == 'long' ? Ox.WEEKDAYS : $.map(Ox.WEEKDAYS, function(v, i) {
return v.substr(0, 3);
})
});
@@ -3167,115 +3167,115 @@ requires
autocomplete: self.weekdays,
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "weekday",
+ id: 'weekday',
value: Ox.formatDate(self.date, self.formats.weekday),
width: self.options.width.weekday
})
- .bindEvent("autocomplete", changeWeekday),
+ .bindEvent('autocomplete', changeWeekday),
} : {}, {
day: new Ox.Input({
autocomplete: $.map(Ox.range(1, Ox.getDaysInMonth(
- parseInt(Ox.formatDate(self.date, "%Y"), 10),
- parseInt(Ox.formatDate(self.date, "%m"), 10)
+ parseInt(Ox.formatDate(self.date, '%Y'), 10),
+ parseInt(Ox.formatDate(self.date, '%m'), 10)
) + 1), function(v, i) {
- return self.options.format == "short" ? Ox.pad(v, 2) : v.toString();
+ return self.options.format == 'short' ? Ox.pad(v, 2) : v.toString();
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "day",
+ id: 'day',
value: Ox.formatDate(self.date, self.formats.day),
- textAlign: "right",
+ textAlign: 'right',
width: self.options.width.day
})
- .bindEvent("autocomplete", changeDay),
+ .bindEvent('autocomplete', changeDay),
month: new Ox.Input({
- autocomplete: self.options.format == "short" ? $.map(Ox.range(1, 13), function(v, i) {
+ autocomplete: self.options.format == 'short' ? $.map(Ox.range(1, 13), function(v, i) {
return Ox.pad(v, 2);
}) : self.months,
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "month",
+ id: 'month',
value: Ox.formatDate(self.date, self.formats.month),
- textAlign: self.options.format == "short" ? "right" : "left",
+ textAlign: self.options.format == 'short' ? 'right' : 'left',
width: self.options.width.month
})
- .bindEvent("autocomplete", changeMonthOrYear),
+ .bindEvent('autocomplete', changeMonthOrYear),
year: new Ox.Input({
autocomplete: $.map($.merge(Ox.range(1900, 3000), Ox.range(1000, 1900)), function(v, i) {
return v.toString();
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "year",
+ id: 'year',
value: Ox.formatDate(self.date, self.formats.year),
- textAlign: "right",
+ textAlign: 'right',
width: self.options.width.year
})
- .bindEvent("autocomplete", changeMonthOrYear)
+ .bindEvent('autocomplete', changeMonthOrYear)
});
that = new Ox.InputGroup($.extend(self.options, {
id: self.options.id,
inputs: $.merge(self.options.weekday ? [
self.$input.weekday
- ] : [], self.options.format == "short" ? [
+ ] : [], self.options.format == 'short' ? [
self.$input.year, self.$input.month, self.$input.day
] : [
self.$input.month, self.$input.day, self.$input.year
]),
separators: $.merge(self.options.weekday ? [
- {title: self.options.format == "short" ? "" : ",", width: 8},
- ] : [], self.options.format == "short" ? [
- {title: "-", width: 8}, {title: "-", width: 8}
+ {title: self.options.format == 'short' ? '' : ',', width: 8},
+ ] : [], self.options.format == 'short' ? [
+ {title: '-', width: 8}, {title: '-', width: 8}
] : [
- {title: "", width: 8}, {title: ",", width: 8}
+ {title: '', width: 8}, {title: ',', width: 8}
]),
width: 0
}), self);
- Ox.print("SELF", self)
+ Ox.print('SELF', self)
function changeDay() {
self.options.weekday && self.$input.weekday.options({
value: Ox.formatDate(new Date([
- self.$input.month.options("value"),
- self.$input.day.options("value"),
- self.$input.year.options("value")
- ].join(" ")), self.formats.weekday)
+ self.$input.month.options('value'),
+ self.$input.day.options('value'),
+ self.$input.year.options('value')
+ ].join(' ')), self.formats.weekday)
});
setValue();
}
function changeMonthOrYear() {
- var day = self.$input.day.options("value"),
- month = self.$input.month.options("value"),
- year = self.$input.year.options("value"),
- days = Ox.getDaysInMonth(year, self.options.format == "short" ? parseInt(month, 10) : month);
+ var day = self.$input.day.options('value'),
+ month = self.$input.month.options('value'),
+ year = self.$input.year.options('value'),
+ days = Ox.getDaysInMonth(year, self.options.format == 'short' ? parseInt(month, 10) : month);
day = day <= days ? day : days;
- Ox.print(year, month, "day days", day, days)
+ Ox.print(year, month, 'day days', day, days)
self.options.weekday && self.$input.weekday.options({
- 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({
autocomplete: $.map(Ox.range(1, days + 1), function(v, i) {
- return self.options.format == "short" ? Ox.pad(v, 2) : v.toString();
+ return self.options.format == 'short' ? Ox.pad(v, 2) : v.toString();
}),
- value: self.options.format == "short" ? Ox.pad(day, 2) : day.toString()
+ value: self.options.format == 'short' ? Ox.pad(day, 2) : day.toString()
});
setValue();
}
function changeWeekday() {
var date = getDateInWeek(
- self.$input.weekday.options("value"),
- self.$input.month.options("value"),
- self.$input.day.options("value"),
- self.$input.year.options("value")
+ self.$input.weekday.options('value'),
+ self.$input.month.options('value'),
+ self.$input.day.options('value'),
+ self.$input.year.options('value')
);
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();
+ return self.options.format == 'short' ? Ox.pad(v, 2) : v.toString();
}),
value: date.day
});
@@ -3284,8 +3284,8 @@ requires
}
function getDateInWeek(weekday, month, day, year) {
- Ox.print([month, day, year].join(" "))
- var date = new Date([month, day, year].join(" "));
+ Ox.print([month, day, year].join(' '))
+ var date = new Date([month, day, year].join(' '));
date = Ox.getDateInWeek(date, weekday);
return {
day: Ox.formatDate(date, self.formats.day),
@@ -3295,26 +3295,26 @@ requires
}
function setValue() {
- self.options.value = Ox.formatDate(new Date(self.options.format == "short" ? [
- self.$input.year.options("value"),
- self.$input.month.options("value"),
- self.$input.day.options("value")
- ].join("/") : [
- self.$input.month.options("value"),
- self.$input.day.options("value"),
- self.$input.year.options("value")
- ].join(" ")), "%F");
+ self.options.value = Ox.formatDate(new Date(self.options.format == 'short' ? [
+ self.$input.year.options('value'),
+ self.$input.month.options('value'),
+ self.$input.day.options('value')
+ ].join('/') : [
+ self.$input.month.options('value'),
+ self.$input.day.options('value'),
+ self.$input.year.options('value')
+ ].join(' ')), '%F');
}
/*
function normalize() {
- var year = that.getInputById("year").options("value"),
- month = that.getInputById("month").options("value"),
- day = that.getInputById("day").options("value")
+ var year = that.getInputById('year').options('value'),
+ month = that.getInputById('month').options('value'),
+ day = that.getInputById('day').options('value')
return {
year: year,
- month: self.options.format == "short" ? month :
- Ox.pad((format == "medium" ? Ox.WEEKDAYS.map(function(v, i) {
+ month: self.options.format == 'short' ? month :
+ Ox.pad((format == 'medium' ? Ox.WEEKDAYS.map(function(v, i) {
return v.substr(0, 3);
}) : Ox.WEEKDAYS).indexOf(month), 2),
day: Ox.pad(day, 2)
@@ -3325,7 +3325,7 @@ requires
/*
that.serialize = function() {
var normal = normalize();
- return [normal.year, normal.month, normal.day].join("-");
+ return [normal.year, normal.month, normal.day].join('-');
}
*/
@@ -3339,43 +3339,43 @@ requires
that = new Ox.Element({}, self)
.defaults({
ampm: false,
- format: "short",
+ format: 'short',
seconds: false,
- value: Ox.formatDate(new Date(), "%F %T"),
+ value: Ox.formatDate(new Date(), '%F %T'),
weekday: false
})
.options(options || {});
- self.values = self.options.value.split(" ");
+ self.values = self.options.value.split(' ');
Ox.print(self.values)
that = new Ox.InputGroup({
inputs: [
new Ox.DateInput({
format: self.options.format,
- id: "date",
+ id: 'date',
value: self.values[0],
weekday: self.options.weekday
}),
new Ox.TimeInput({
ampm: self.options.ampm,
- id: "time",
+ id: 'time',
value: self.values[1],
seconds: self.options.seconds
})
],
separators: [
- {title: "", width: 8}
+ {title: '', width: 8}
],
value: self.options.value
})
- .bindEvent("change", setValue);
+ .bindEvent('change', setValue);
function setValue() {
self.options.value = [
- self.options("inputs")[0].options("value"),
- self.options("inputs")[1].options("value")
- ].join(" ");
+ self.options('inputs')[0].options('value'),
+ self.options('inputs')[1].options('value')
+ ].join(' ');
}
return that;
@@ -3386,8 +3386,8 @@ requires
var self = $.extend(self || {}, {
options: $.extend({
- id: "",
- value: "United States"
+ id: '',
+ value: 'United States'
}, options)
}),
that;
@@ -3396,18 +3396,18 @@ requires
id: self.options.id,
elements: [
new Ox.Input({
- id: "input",
+ id: 'input',
value: self.options.value
}),
new Ox.PlacePicker({
- id: "picker",
- overlap: "left",
+ id: 'picker',
+ overlap: 'left',
value: self.options.value
})
],
- float: "right"
+ float: 'right'
}, self)
- .bindEvent("change", change);
+ .bindEvent('change', change);
function change() {
@@ -3426,14 +3426,14 @@ requires
ampm: false,
seconds: false,
milliseconds: false,
- value: Ox.formatDate(new Date(), "%T"),
+ value: Ox.formatDate(new Date(), '%T'),
})
.options(options || {});
if (self.options.milliseconds) {
self.options.seconds = true;
- if (self.options.value.indexOf(".") == -1) {
- self.options.value += ".000";
+ if (self.options.value.indexOf('.') == -1) {
+ self.options.value += '.000';
}
}
@@ -3447,8 +3447,8 @@ requires
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "hours",
- textAlign: "right",
+ id: 'hours',
+ textAlign: 'right',
value: self.values.hours,
width: 32
}),
@@ -3458,8 +3458,8 @@ requires
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "minutes",
- textAlign: "right",
+ id: 'minutes',
+ textAlign: 'right',
value: self.values.minutes,
width: 32
}),
@@ -3469,8 +3469,8 @@ requires
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "seconds",
- textAlign: "right",
+ id: 'seconds',
+ textAlign: 'right',
value: self.values.seconds,
width: 32
}),
@@ -3480,16 +3480,16 @@ requires
}),
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "milliseconds",
- textAlign: "right",
+ id: 'milliseconds',
+ textAlign: 'right',
value: self.values.milliseconds,
width: 40
}),
ampm: Ox.Input({
- autocomplete: ["AM", "PM"],
+ autocomplete: ['AM', 'PM'],
autocompleteReplace: true,
autocompleteReplaceCorrect: true,
- id: "ampm",
+ id: 'ampm',
value: self.values.ampm,
width: 32
})
@@ -3507,22 +3507,22 @@ requires
self.$input.ampm
] : []),
separators: $.merge($.merge($.merge([
- {title: ":", width: 8},
+ {title: ':', width: 8},
], self.options.seconds ? [
- {title: ":", width: 8}
+ {title: ':', width: 8}
] : []), self.options.milliseconds ? [
- {title: ".", width: 8}
+ {title: '.', width: 8}
] : []), self.options.ampm ? [
- {title: "", width: 8}
+ {title: '', width: 8}
] : []),
//width: self.options.width || 128
}), self)
- .bindEvent("change", setValue);
+ .bindEvent('change', setValue);
setValue();
function getDate() {
- return new Date("1970/01/01 " + (
+ return new Date('1970/01/01 ' + (
self.options.milliseconds ?
self.options.value.substr(0, self.options.value.length - 4) :
self.options.value
@@ -3532,23 +3532,23 @@ requires
function getValues() {
self.date = getDate();
return {
- ampm: Ox.formatDate(self.date, "%p"),
- hours: Ox.formatDate(self.date, self.options.ampm ? "%I" : "%H"),
- milliseconds: self.options.milliseconds ? self.options.value.substr(-3) : "000",
- minutes: Ox.formatDate(self.date, "%M"),
- seconds: Ox.formatDate(self.date, "%S")
+ ampm: Ox.formatDate(self.date, '%p'),
+ hours: Ox.formatDate(self.date, self.options.ampm ? '%I' : '%H'),
+ milliseconds: self.options.milliseconds ? self.options.value.substr(-3) : '000',
+ minutes: Ox.formatDate(self.date, '%M'),
+ seconds: Ox.formatDate(self.date, '%S')
};
}
function setValue() {
- self.options.value = Ox.formatDate(new Date("1970/01/01 " + [
- self.$input.hours.options("value"),
- self.$input.minutes.options("value"),
- self.options.seconds ? self.$input.seconds.options("value") : "00"
- ].join(":") + (self.options.ampm ? " " + self.$input.ampm.options("value") : "")),
- (self.options.seconds? "%T" : "%H:%M")) +
- (self.options.milliseconds ? "." + self.$input.milliseconds.options("value") : "");
- Ox.print("SETVALUE", self.options.value);
+ self.options.value = Ox.formatDate(new Date('1970/01/01 ' + [
+ self.$input.hours.options('value'),
+ self.$input.minutes.options('value'),
+ self.options.seconds ? self.$input.seconds.options('value') : '00'
+ ].join(':') + (self.options.ampm ? ' ' + self.$input.ampm.options('value') : '')),
+ (self.options.seconds? '%T' : '%H:%M')) +
+ (self.options.milliseconds ? '.' + self.$input.milliseconds.options('value') : '');
+ Ox.print('SETVALUE', self.options.value);
}
function setValues() {
@@ -3561,7 +3561,7 @@ requires
}
self.onChange = function(key, value) {
- if (key == "value") {
+ if (key == 'value') {
setValues();
}
}
@@ -3573,23 +3573,23 @@ requires
Ox.Label = function(options, self) {
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
disabled: false,
- id: "",
- overlap: "none",
- textAlign: "left",
- title: "",
- width: "auto"
+ id: '',
+ overlap: 'none',
+ textAlign: 'left',
+ title: '',
+ width: 'auto'
})
.options(options)
.addClass(
- "OxLabel" + (self.options.disabled ? " OxDisabled" : "") +
- (self.options.overlap != "none" ?
- " OxOverlap" + Ox.toTitleCase(self.options.overlap) : "")
+ 'OxLabel' + (self.options.disabled ? ' OxDisabled' : '') +
+ (self.options.overlap != 'none' ?
+ ' OxOverlap' + Ox.toTitleCase(self.options.overlap) : '')
)
- .css($.extend(self.options.width == "auto" ? {} : {
- width: (self.options.width - 14) + "px"
+ .css($.extend(self.options.width == 'auto' ? {} : {
+ width: (self.options.width - 14) + 'px'
}, {
textAlign: self.options.textAlign
}))
@@ -3605,7 +3605,7 @@ requires
to be used by ButtonGroup, CheckboxGroup, Select and Menu
*/
- var property = property || "checked"
+ var property = property || 'checked'
length = items.length,
max = max == -1 ? length : max;
@@ -3614,11 +3614,12 @@ requires
var last = -1;
Ox.print(items, items.length, length, $.merge(
pos > 0 ? Ox.range(pos - 1, -1, -1) : [],
- pos < length - 1 ? Ox.range(length - 1, pos, -1) : []
+ pos < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : []
))
+ // fixme: why is length not == items.length here?
$.each($.merge(
pos > 0 ? Ox.range(pos - 1, -1, -1) : [],
- pos < length - 1 ? Ox.range(length - 1, pos, -1) : []
+ pos < items.length - 1 ? Ox.range(items.length - 1, pos, -1) : []
), function(i, v) {
Ox.print(pos, v)
if (items[v][property]) {
@@ -3709,10 +3710,10 @@ requires
Options:
arrows boolean if true, show arrows
arrowStep number step when clicking arrows
- arrowSymbols array arrow symbols, like ["minus", "plus"]
+ arrowSymbols array arrow symbols, like ['minus', 'plus']
max number maximum value
min number minimum value
- orientation string "horizontal" or "vertical"
+ orientation string 'horizontal' or 'vertical'
step number step between values
size number width or height, in px
thumbSize number minimum width or height of thumb, in px
@@ -3729,10 +3730,10 @@ requires
.defaults({
arrows: false,
arrowStep: 1,
- arrowSymbols: ["previous", "next"],
+ arrowSymbols: ['previous', 'next'],
max: 100,
min: 0,
- orientation: "horizontal",
+ orientation: 'horizontal',
step: 1,
size: 128,
thumbSize: 16,
@@ -3748,9 +3749,9 @@ requires
options.arrowStep : options.step,
trackImages: $.makeArray(options.trackImages || [])
}))
- .addClass("OxRange")
+ .addClass('OxRange')
.css({
- width: self.options.size + "px"
+ width: self.options.size + 'px'
});
$.extend(self, {
@@ -3774,11 +3775,11 @@ requires
self.$arrows = [];
$.each(Ox.range(0, 2), function(i) {
self.$arrows[i] = Ox.Button({
- overlap: i == 0 ? "right" : "left",
+ overlap: i == 0 ? 'right' : 'left',
title: self.options.arrowSymbols[i],
- type: "image"
+ type: 'image'
})
- .addClass("OxArrow")
+ .addClass('OxArrow')
.mousedown(function(e) {
clickArrow(e, i);
})
@@ -3786,12 +3787,12 @@ requires
});
}
- self.$track = $("
")
- .addClass("OxTrack")
+ self.$track = $('
')
+ .addClass('OxTrack')
.css($.extend({
- width: (self.trackSize - 2) + "px"
+ width: (self.trackSize - 2) + 'px'
}, self.trackImages == 1 ? {
- background: "rgb(0, 0, 0)"
+ background: 'rgb(0, 0, 0)'
} : {}))
.mousedown(clickTrack)
.appendTo(that.$element);
@@ -3799,22 +3800,22 @@ requires
self.trackColors && setTrackColors();
if (self.trackImages) {
- self.$trackImages = $("
")
+ self.$trackImages = $('
')
.css({
- width: self.trackSize + "px",
- marginRight: (-self.trackSize - 1) + "px"
+ width: self.trackSize + 'px',
+ marginRight: (-self.trackSize - 1) + 'px'
})
.appendTo(self.$track);
$.each(self.options.trackImages, function(i, v) {
Ox.print(self.trackImageWidths[i])
- $("
")
+ $('
')
.attr({
src: v
})
- .addClass(i == 0 ? "OxFirstChild" : "")
- .addClass(i == self.trackImages - 1 ? "OxLastChild" : "")
+ .addClass(i == 0 ? 'OxFirstChild' : '')
+ .addClass(i == self.trackImages - 1 ? 'OxLastChild' : '')
.css({
- width: self.trackImageWidths[i] + "px"
+ width: self.trackImageWidths[i] + 'px'
})
.mousedown(function(e) {
e.preventDefault(); // prevent drag
@@ -3825,17 +3826,17 @@ requires
}
self.$thumb = Ox.Button({
- id: self.options.id + "Thumb",
+ id: self.options.id + 'Thumb',
title: self.options.thumbValue ? (self.options.valueNames ?
self.options.valueNames[self.options.value] :
- self.options.value) : "",
+ self.options.value) : '',
width: self.thumbSize
})
- .addClass("OxThumb")
+ .addClass('OxThumb')
/*
.css({
- border: "1px solid rgb(255, 255, 255)",
- background: "rgba(0, 0, 0, 0)"
+ border: '1px solid rgb(255, 255, 255)',
+ background: 'rgba(0, 0, 0, 0)'
})
*/
.appendTo(self.$track);
@@ -3851,7 +3852,7 @@ requires
}, 50);
}, 500);
setValue(self.options.value + self.options.arrowStep * (i == 0 ? -1 : 1) * (e.shiftKey ? 2 : 1), true);
- $window.one("mouseup", function() {
+ $window.one('mouseup', function() {
clearInterval(interval);
clearTimeout(timeout);
});
@@ -3859,15 +3860,15 @@ requires
function clickTrack(e) {
//Ox.Focus.focus();
- var isThumb = $(e.target).hasClass("OxThumb"),
+ var isThumb = $(e.target).hasClass('OxThumb'),
left = self.$track.offset().left,
offset = isThumb ? e.clientX - self.$thumb.offset().left - 8 /*self.thumbSize / 2*/ : 0;
setValue(val(e), !isThumb);
$window.mousemove(function(e) {
setValue(val(e));
});
- $window.one("mouseup", function() {
- $window.unbind("mousemove");
+ $window.one('mouseup', function() {
+ $window.unbind('mousemove');
});
function val(e) {
return getVal(e.clientX - left - offset);
@@ -3897,8 +3898,8 @@ requires
function setThumb(animate) {
self.$thumb.stop().animate({
- marginLeft: (getPx(self.options.value) - 1) + "px",
- //width: self.thumbSize + "px"
+ marginLeft: (getPx(self.options.value) - 1) + 'px',
+ //width: self.thumbSize + 'px'
}, animate ? 200 : 0, function() {
if (self.options.thumbValue) {
self.$thumb.options({
@@ -3913,14 +3914,14 @@ requires
function setTrackColors() {
self.$track.css({
backgroundImage: $.browser.mozilla ?
- ("-moz-linear-gradient(left, " +
- self.options.trackColors[0] + " 0%, " + $.map(self.options.trackColors, 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) {
- return "color-stop(" + (self.trackColorsStart + self.trackColorsStep * i) + ", " + v + ")";
- }).join(", ") + ", color-stop(1, " + self.options.trackColors[self.trackColors - 1] + "))")
+ ('-moz-linear-gradient(left, ' +
+ self.options.trackColors[0] + ' 0%, ' + $.map(self.options.trackColors, 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) {
+ return 'color-stop(' + (self.trackColorsStart + self.trackColorsStep * i) + ', ' + v + ')';
+ }).join(', ') + ', color-stop(1, ' + self.options.trackColors[self.trackColors - 1] + '))')
});
}
@@ -3930,16 +3931,16 @@ requires
//time = getTime(self.options.value, value);
self.options.value = value;
setThumb(animate);
- that.triggerEvent("change", {
+ that.triggerEvent('change', {
value: value
});
}
}
self.onChange = function(key, value) {
- if (key == "trackColors") {
+ if (key == 'trackColors') {
setTrackColors();
- } else if (key == "value") {
+ } else if (key == 'value') {
setThumb();
}
}
@@ -3951,33 +3952,33 @@ requires
Ox.Select = function(options, self) {
var self = self || {},
- that = new Ox.Element("div", self) // fixme: do we use "div", or {}, or "", by default?
+ that = new Ox.Element('div', self) // fixme: do we use 'div', or {}, or '', by default?
.defaults({
- id: "",
+ id: '',
items: [],
max: 1,
min: 1,
- overlap: "none", // can be none, left or right
+ overlap: 'none', // can be none, left or right
selectable: true,
- size: "medium",
- title: "",
- type: "text", // can be "text" or "image"
- width: "auto"
+ size: 'medium',
+ title: '',
+ type: 'text', // can be 'text' or 'image'
+ width: 'auto'
})
.options(options)
.addClass(
- "OxSelect Ox" + Ox.toTitleCase(self.options.size) +
- (self.options.overlap == "none" ? "" : " OxOverlap" +
+ 'OxSelect Ox' + Ox.toTitleCase(self.options.size) +
+ (self.options.overlap == 'none' ? '' : ' OxOverlap' +
Ox.toTitleCase(self.options.overlap))
)
- .css(self.options.width == "auto" ? {} : {
- width: self.options.width + "px"
+ .css(self.options.width == 'auto' ? {} : {
+ width: self.options.width + 'px'
});
$.extend(self, {
- buttonId: self.options.id + "Button",
- groupId: self.options.id + "Group",
- menuId: self.options.id + "Menu"
+ buttonId: self.options.id + 'Button',
+ groupId: self.options.id + 'Group',
+ menuId: self.options.id + 'Menu'
});
if (self.options.selectable) {
@@ -3990,11 +3991,11 @@ requires
self.checked = self.optionGroup.checked();
}
- if (self.options.type == "text") {
- self.$title = $("
")
- .addClass("OxTitle")
+ if (self.options.type == 'text') {
+ self.$title = $('
')
+ .addClass('OxTitle')
.css({
- width: (self.options.width - 22) + "px"
+ width: (self.options.width - 22) + 'px'
})
.html(
self.options.title ? self.options.title :
@@ -4006,11 +4007,11 @@ requires
self.$button = new Ox.Button({
id: self.buttonId,
- style: "symbol",
- title: "select",
- type: "image"
+ style: 'symbol',
+ title: 'select',
+ type: 'image'
})
- .bindEvent("click", clickButton)
+ .bindEvent('click', clickButton)
.appendTo(that);
self.$menu = new Ox.Menu({
@@ -4022,46 +4023,59 @@ requires
max: self.options.max,
min: self.options.min
} : self.options.items],
- side: "bottom",
+ side: 'bottom',
size: self.options.size
})
- .bindEvent("hide", hideMenu);
-
- if (self.options.selectable) {
- // fixme: the menu should fire a change event
- // so we can attach a bindEvent() directly
- // (may fire one already, but needs to pass group id)
- Ox.Event.bind(self.groupId, "change", clickMenu);
- }
+ .bindEvent({
+ change: changeMenu,
+ click: clickMenu,
+ hide: hideMenu
+ });
function clickButton() {
- that.addClass("OxSelected");
+ that.addClass('OxSelected');
self.$menu.showMenu();
}
function clickMenu(event, data) {
- Ox.print("clickMenu: ", self.options.id, data)
+
+ }
+
+ function changeMenu(event, data) {
+ Ox.print('clickMenu: ', self.options.id, data)
+ self.checked = self.optionGroup.checked();
self.$title && self.$title.html(
self.options.title ? self.options.title :
- data.checked[0].title
+ data.checked[0].title
);
- that.triggerEvent("change", data);
+ that.triggerEvent('change', data);
}
function hideMenu() {
- that.removeClass("OxSelected");
- self.$button.removeClass("OxSelected");
+ that.removeClass('OxSelected');
+ self.$button.removeClass('OxSelected');
}
self.onChange = function(key, value) {
};
+ that.selected = function() {
+ return $.map(/*self.checked*/self.optionGroup.checked(), function(v, i) {
+ return {
+ id: self.options.items[i].id,
+ title: self.options.items[i].title
+ };
+ });
+ };
+
that.selectItem = function(id) {
- self.options.type == "text" && self.$title.html(
- Ox.getObjectById(self.options.items, id).title
+ Ox.print('selectItem', id, Ox.getObjectById(self.options.items, id).title)
+ self.options.type == 'text' && self.$title.html(
+ Ox.getObjectById(self.options.items, id).title[0] // fixme: title should not have become an array
);
self.$menu.checkItem(id);
+ self.checked = self.optionGroup.checked();
};
/*
@@ -4081,20 +4095,20 @@ requires
Ox.FormElementGroup = function(options, self) {
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
- id: "",
+ id: '',
elements: [],
- float: "left",
+ float: 'left',
separators: [],
width: 0
})
.options(options || {})
- .addClass("OxInputGroup");
+ .addClass('OxInputGroup');
- $.each(self.options.float == "left" ? self.options.elements : self.options.elements.reverse(), function(i, $element) {
+ $.each(self.options.float == 'left' ? self.options.elements : self.options.elements.reverse(), function(i, $element) {
$element.options({
- id: self.options.id + Ox.toTitleCase($element.options("id")),
+ id: self.options.id + Ox.toTitleCase($element.options('id')),
parent: that
})
.css({
@@ -4110,7 +4124,7 @@ requires
self.options.width = getWidth();
}
that.css({
- width: self.options.width + "px"
+ width: self.options.width + 'px'
});
*/
@@ -4123,7 +4137,7 @@ requires
}
self.onChange = function(key, value) {
- if (key == "trackColors") {
+ if (key == 'trackColors') {
}
}
@@ -4135,40 +4149,40 @@ requires
Ox.Picker = function(options, self) {
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
element: null,
elementHeight: 128,
elementWidth: 256,
- id: "",
- overlap: "none"
+ id: '',
+ overlap: 'none'
})
.options(options || {});
self.$selectButton = new Ox.Button({
overlap: self.options.overlap,
- title: "select",
- type: "image"
+ title: 'select',
+ type: 'image'
})
.click(showMenu)
.appendTo(that);
- self.$menu = new Ox.Element("div")
- .addClass("OxPicker")
+ self.$menu = new Ox.Element('div')
+ .addClass('OxPicker')
.css({
- width: self.options.elementWidth + "px",
- height: (self.options.elementHeight + 24) + "px"
+ width: self.options.elementWidth + 'px',
+ height: (self.options.elementHeight + 24) + 'px'
});
self.options.element
.css({
- width: self.options.elementWidth + "px",
- height: self.options.elementHeight + "px"
+ width: self.options.elementWidth + 'px',
+ height: self.options.elementHeight + 'px'
})
.appendTo(self.$menu);
self.$bar = new Ox.Bar({
- orientation: "horizontal",
+ orientation: 'horizontal',
size: 24
})
.appendTo(self.$menu);
@@ -4179,26 +4193,26 @@ requires
.appendTo(self.$bar);
self.$doneButton = new Ox.Button({
- title: "Done",
+ title: 'Done',
width: 48
})
.click(hideMenu)
.appendTo(self.$bar);
- self.$layer = $("
")
- .addClass("OxLayer")
+ self.$layer = $('
')
+ .addClass('OxLayer')
.click(hideMenu);
function hideMenu() {
self.$menu.detach();
self.$layer.detach();
self.$selectButton
- .removeClass("OxSelected")
+ .removeClass('OxSelected')
.css({
- MozBorderRadius: "8px",
- WebkitBorderRadius: "8px"
+ MozBorderRadius: '8px',
+ WebkitBorderRadius: '8px'
});
- that.triggerEvent("hide");
+ that.triggerEvent('hide');
};
function showMenu() {
@@ -4206,19 +4220,19 @@ requires
left = offset.left,
top = offset.top + 15;
self.$selectButton
- .addClass("OxSelected")
+ .addClass('OxSelected')
.css({
- MozBorderRadius: "8px 8px 0 0",
- WebkitBorderRadius: "8px 8px 0 0"
+ MozBorderRadius: '8px 8px 0 0',
+ WebkitBorderRadius: '8px 8px 0 0'
});
self.$layer.appendTo($body);
self.$menu
.css({
- left: left + "px",
- top: top + "px"
+ left: left + 'px',
+ top: top + 'px'
})
.appendTo($body);
- that.triggerEvent("show");
+ that.triggerEvent('show');
};
return that;
@@ -4228,17 +4242,17 @@ requires
Ox.ColorPicker = function(options, self) {
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
- id: "",
- value: "0, 0, 0"
+ id: '',
+ value: '0, 0, 0'
})
.options(options || {});
Ox.print(self)
self.$ranges = [];
- self.rgb = ["red", "green", "blue"];
- self.values = self.options.value.split(", ");
+ self.rgb = ['red', 'green', 'blue'];
+ self.values = self.options.value.split(', ');
$.each(Ox.range(3), function(i) {
self.$ranges[i] = new Ox.Range({
@@ -4252,25 +4266,25 @@ requires
value: self.values[i]
})
.css({
- position: "absolute",
- top: (i * 15) + "px"
+ position: 'absolute',
+ top: (i * 15) + 'px'
})
- .bindEvent("change", function(event, data) {
+ .bindEvent('change', function(event, data) {
change(i, data.value);
})
.appendTo(that);
// fixme: make self.$ranges[i].children() work
if (i == 0) {
- self.$ranges[i].$element.children("input.OxOverlapRight").css({
+ self.$ranges[i].$element.children('input.OxOverlapRight').css({
MozBorderRadius: 0,
WebkitBorderRadius: 0
});
- self.$ranges[i].$element.children("input.OxOverlapLeft").css({
- MozBorderRadius: "0 8px 0 0",
- WebkitBorderRadius: "0 8px 0 0"
+ self.$ranges[i].$element.children('input.OxOverlapLeft').css({
+ MozBorderRadius: '0 8px 0 0',
+ WebkitBorderRadius: '0 8px 0 0'
});
} else {
- self.$ranges[i].$element.children("input").css({
+ self.$ranges[i].$element.children('input').css({
MozBorderRadius: 0,
WebkitBorderRadius: 0
});
@@ -4286,9 +4300,9 @@ requires
function change(index, value) {
self.values[index] = value;
- self.options.value = self.values.join(", ");
+ self.options.value = self.values.join(', ');
that.$label.css({
- background: "rgb(" + self.options.value + ")"
+ background: 'rgb(' + self.options.value + ')'
});
$.each(Ox.range(3), function(i) {
if (i != index) {
@@ -4297,19 +4311,19 @@ requires
});
}
});
- that.triggerEvent("change", {
+ that.triggerEvent('change', {
value: self.options.value
});
}
function getColors(index) {
return [
- "rgb(" + $.map(Ox.range(3), function(v) {
+ 'rgb(' + $.map(Ox.range(3), function(v) {
return v == index ? 0 : self.values[v];
- }).join(", ") + ")",
- "rgb(" + $.map(Ox.range(3), function(v) {
+ }).join(', ') + ')',
+ 'rgb(' + $.map(Ox.range(3), function(v) {
return v == index ? 255 : self.values[v];
- }).join(", ") + ")"
+ }).join(', ') + ')'
]
}
@@ -4321,40 +4335,40 @@ requires
var self = $.extend(self || {}, {
options: $.extend({
- id: "",
- value: "United States"
+ id: '',
+ value: 'United States'
}, options)
}),
that;
- self.$element = new Ox.Element("div")
+ self.$element = new Ox.Element('div')
.css({
- width: "256px",
- height: "192px"
+ width: '256px',
+ height: '192px'
})
.append(
self.$topBar = new Ox.Bar({
size: 16
})
.css({
- MozBorderRadius: "0 8px 0 0",
- WebkitBorderRadius: "0 8px 0 0"
+ MozBorderRadius: '0 8px 0 0',
+ WebkitBorderRadius: '0 8px 0 0'
})
.append(
self.$input = new Ox.Input({
clear: true,
- id: self.options.id + "Input",
- placeholder: "Find",
+ id: self.options.id + 'Input',
+ placeholder: 'Find',
width: 256
})
- .bindEvent("submit", findPlace)
+ .bindEvent('submit', findPlace)
)
)
.append(
- self.$container = new Ox.Element("div")
+ self.$container = new Ox.Element('div')
.css({
- width: "256px",
- height: "160px"
+ width: '256px',
+ height: '160px'
})
)
.append(
@@ -4364,27 +4378,27 @@ requires
.append(
self.$range = new Ox.Range({
arrows: true,
- id: self.options.id + "Range",
+ id: self.options.id + 'Range',
max: 22,
size: 256,
thumbSize: 32,
thumbValue: true
})
- .bindEvent("change", changeZoom)
+ .bindEvent('change', changeZoom)
)
);
- self.$input.$element.children("input[type=text]").css({
- width: "230px",
- paddingLeft: "2px",
- MozBorderRadius: "0 8px 8px 0",
- WebkitBorderRadius: "0 8px 8px 0"
+ self.$input.$element.children('input[type=text]').css({
+ width: '230px',
+ paddingLeft: '2px',
+ MozBorderRadius: '0 8px 8px 0',
+ WebkitBorderRadius: '0 8px 8px 0'
});
- self.$input.$element.children("input[type=image]").css({
- MozBorderRadius: "0 8px 0 0",
- WebkitBorderRadius: "0 8px 0 0"
+ self.$input.$element.children('input[type=image]').css({
+ MozBorderRadius: '0 8px 0 0',
+ WebkitBorderRadius: '0 8px 0 0'
});
- self.$range.$element.children("input").css({
+ self.$range.$element.children('input').css({
MozBorderRadius: 0,
WebkitBorderRadius: 0
});
@@ -4397,14 +4411,14 @@ requires
overlap: self.options.overlap,
value: self.options.value
}, self)
- .bindEvent("show", showPicker);
+ .bindEvent('show', showPicker);
- that.$label.bind("click", clickLabel)
+ that.$label.bind('click', clickLabel)
self.map = false;
function changeZoom(event, data) {
- Ox.print("changeZoom")
+ Ox.print('changeZoom')
self.$map.zoom(data.value);
}
@@ -4414,14 +4428,14 @@ requires
self.$input.options({
value: name
})
- .triggerEvent("submit", {
+ .triggerEvent('submit', {
value: name
});
}
}
function findPlace(event, data) {
- Ox.print("findPlace", data);
+ Ox.print('findPlace', data);
self.$map.find(data.value, function(location) {
if (location) {
that.$label.html(location.name.formatted);
@@ -4442,12 +4456,12 @@ requires
function showPicker() {
if (!self.map) {
self.$map = new Ox.Map({
- id: self.options.id + "Map",
+ id: self.options.id + 'Map',
places: [self.options.value]
})
.css({
- width: "256px",
- height: "160px"
+ width: '256px',
+ height: '160px'
})
.bindEvent({
select: onSelect,
@@ -4474,7 +4488,7 @@ requires
options:
clear boolean, clear button, or not
disabled boolean, disabled, or not
- height height (px), if type is "textarea"
+ height height (px), if type is 'textarea'
id
label string, or
array [{ id, title, checked }] (selectable label) or
@@ -4490,8 +4504,8 @@ requires
separatorWidth integer (px), or
array of integers
serialize function
- size "large", "medium" or "small"
- type "password", "select" or "text"
+ size 'large', 'medium' or 'small'
+ type 'password', 'select' or 'text'
unit string, or
array [{ id, title, checked }] (selectable unit)
unitWidth integer (px)
@@ -4503,7 +4517,7 @@ requires
*/
var self = self || {},
- that = new Ox.Element("div", self)
+ that = new Ox.Element('div', self)
.defaults({
autocomplete: null,
autocorrect: null,
@@ -4511,39 +4525,39 @@ requires
autosuggestHighlight: false,
autosuggestSubmit: false,
autovalidate: null,
- autovalidateName: "Value",
+ autovalidateName: 'Value',
clear: false,
disabled: false,
height: 128,
- id: "",
- key: "",
- label: "",
+ id: '',
+ key: '',
+ label: '',
labelWidth: 64,
- placeholder: "",
- separator: "",
+ placeholder: '',
+ separator: '',
separatorWidth: 16,
serialize: null,
- size: "medium",
- type: "text",
- unit: "",
+ size: 'medium',
+ type: 'text',
+ unit: '',
unitWidth: 64,
- value: "",
+ value: '',
width: 128
})
.options(options || {})
- .addClass("OxInput Ox" + Ox.toTitleCase(self.options.size))
+ .addClass('OxInput Ox' + Ox.toTitleCase(self.options.size))
.css({
- width: self.options.width + "px"
+ width: self.options.width + 'px'
});
$.extend(self, {
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) &&
- (self.options.type != "select" || "items" in self.options.value[0]),
+ (self.options.type != 'select' || 'items' in self.options.value[0]),
hasSelectableKeys: Ox.isArray(self.options.label) || Ox.isArray(self.options.placeholder),
hasSelectableUnits: Ox.isArray(self.options.unit),
- keyName: self.options.label ? "label" : (self.options.placeholder ? "placeholder" : ""),
+ keyName: self.options.label ? 'label' : (self.options.placeholder ? 'placeholder' : ''),
placeholderWidth: 16,
selectedKey: [0], // fixme: only set on demand?
selectedValue: 0,
@@ -4551,25 +4565,25 @@ requires
/* valid: autovalidateCall(true) */
});
- $.each(["autocomplete", "autocorrect", "autosuggest", "autovalidate"], function(i, v) {
+ $.each(['autocomplete', 'autocorrect', 'autosuggest', 'autovalidate'], function(i, v) {
//if (!Ox.isFunction(self.options[v])) {
self.options[v] = {
- "": self.options[v]
+ '': self.options[v]
};
//}
});
if (self.keyName && !self.hasMultipleKeys) {
self.options[self.keyName] = [$.extend({
- id: "",
+ id: '',
label: self.options[self.keyName],
- }, self.keyName == "label" ? {
- id: "",
+ }, self.keyName == 'label' ? {
+ id: '',
width: self.options.labelWidth
} : {})];
if (!self.hasSelectableKeys) {
self.options[self.keyName][0].label = [{
- id: "",
+ id: '',
title: self.options[self.keyName][0].label
}];
}
@@ -4600,31 +4614,31 @@ requires
(self.options.value.length - 1) * self.options.separatorWidth;
}
*/
- Ox.print("self.hasMulVal", self.hasMultipleValues);
- Ox.print("self.options.value", self.options.value)
+ Ox.print('self.hasMulVal', self.hasMultipleValues);
+ Ox.print('self.options.value', self.options.value)
if (!self.hasMultipleValues) {
- if (self.options.type == "select") {
+ if (self.options.type == 'select') {
self.options.value = [{
- id: "",
+ id: '',
items: self.options.value,
width: self.valueWidth
}];
- } else if (self.options.type == "range") {
+ } else if (self.options.type == 'range') {
self.options.value = [$.extend({
- id: "",
+ id: '',
size: self.valueWidth
}, self.options.value)];
} else {
self.options.value = [{
- id: "",
+ id: '',
value: self.options.value,
width: self.valueWidth
}]
}
}
- Ox.print("self.options.value", self.options.value)
+ Ox.print('self.options.value', self.options.value)
self.values = self.options.value.length;
- Ox.print(self.options.id, "self.values", self.values)
+ Ox.print(self.options.id, 'self.values', self.values)
if (Ox.isString(self.options.separator)) {
self.options.separator = $.map(new Array(self.values - 1), function(v, i) {
@@ -4647,36 +4661,36 @@ requires
});
} else {
self.options.unit = [{
- id: "",
+ id: '',
title: self.options.unit
}];
}
}
- Ox.print("self", self);
+ Ox.print('self', self);
if (self.keyName) {
that.$key = [];
$.each(self.options[self.keyName], function(keyPos, key) {
- Ox.print("keyPos key", keyPos, key)
- if (self.keyName == "label" && key.label.length == 1) {
+ Ox.print('keyPos key', keyPos, key)
+ if (self.keyName == 'label' && key.label.length == 1) {
that.$key[keyPos] = new Ox.Label({
- overlap: "right",
+ overlap: 'right',
title: key.label[0].title,
width: self.options.labelWidth
})
.css({
- float: "left"
+ float: 'left'
})
.click(function() {
that.$input[0].focus();
})
.appendTo(that);
} else if (key.label.length > 1) {
- Ox.print("key.length > 1")
+ Ox.print('key.length > 1')
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]);
+ (self.options[self.keyName].length == 1 ? '' : keyPos);
+ Ox.print('three', self.selectedKey, keyPos, self.selectedKey[keyPos]);
that.$key[keyPos] = new Ox.Select({
id: self.selectKeyId,
items: $.map(key.label, function(value, valuePos) {
@@ -4687,27 +4701,27 @@ requires
title: value.title
};
}),
- overlap: "right",
- type: self.options.label ? "text" : "image",
+ overlap: 'right',
+ type: self.options.label ? 'text' : 'image',
width: self.options.label ? (self.options.label.length == 1 ? self.options.labelWidth : key.width) : self.placeholderWidth
})
.css({
- float: "left"
+ float: 'left'
})
.appendTo(that);
- that.bindEvent("change_" + self.selectKeyId, changeKey);
+ that.bindEvent('change_' + self.selectKeyId, changeKey);
}
});
}
if (self.options.clear) {
that.$clear = new Ox.Button({
- overlap: "left",
- type: "image",
- value: "clear"
+ overlap: 'left',
+ type: 'image',
+ value: 'clear'
})
.css({
- float: "right"
+ float: 'right'
})
.click(clear)
.appendTo(that);
@@ -4715,23 +4729,23 @@ requires
if (self.options.unit.length == 1) {
that.$unit = new Ox.Label({
- overlap: "left",
+ overlap: 'left',
title: self.options.unit[0].title,
width: self.options.unitWidth
})
.css({
- float: "right"
+ float: 'right'
})
.click(function() {
that.$input[0].focus();
})
.appendTo(that);
} else if (self.options.unit.length > 1) {
- self.selectUnitId = self.options.id + "Unit";
+ self.selectUnitId = self.options.id + 'Unit';
that.$unit = new Ox.Select({
id: self.selectUnitId,
items: $.map(self.options.unit, function(unit, i) {
- Ox.print("unit", unit)
+ Ox.print('unit', unit)
return {
checked: i == 0,
id: unit.id,
@@ -4739,12 +4753,12 @@ requires
title: unit.title
};
}),
- overlap: "left",
+ overlap: 'left',
size: self.options.size,
width: self.options.unitWidth
})
.css({
- float: "right"
+ float: 'right'
})
.appendTo(that);
}
@@ -4754,13 +4768,13 @@ requires
$.each(self.options.value, function(i, v) {
if (i < self.values - 1) {
that.$separator[i] = new Ox.Label({
- textAlign: "center",
+ textAlign: 'center',
title: self.options.separator[i],
width: self.options.separatorWidth[i] + 32
})
.css({
- float: "left",
- marginLeft: (v.width - (i == 0 ? 16 : 32)) + "px"
+ float: 'left',
+ marginLeft: (v.width - (i == 0 ? 16 : 32)) + 'px'
})
.click(function() {
that.$input[0].focus();
@@ -4772,25 +4786,25 @@ requires
that.$input = [];
//self.margin = 0;
$.each(self.options.value, function(i, v) {
- Ox.print("o k i", self.options, self.keyName, i);
+ Ox.print('o k i', self.options, self.keyName, i);
var id = self.keyName ? $.map(self.selectedKey, function(v, i) {
return self.options[self.keyName][i].id;
- }).join(".") : "";
+ }).join('.') : '';
//self.margin -= (i == 0 ? 16 : self.options.value[i - 1].width)
- Ox.print("v:", v, "id:", id)
- if (self.options.type == "select") {
+ Ox.print('v:', v, 'id:', id)
+ if (self.options.type == 'select') {
that.$input[i] = new Ox.Select({
id: v.id,
items: v.items,
width: v.width
}).
css({
- float: "left"
+ float: 'left'
});
- } else if (self.options.type == "range") {
+ } else if (self.options.type == 'range') {
that.$input[i] = new Ox.Range(v)
.css({
- float: "left"
+ float: 'left'
});
} else {
that.$input[i] = new Ox.InputElement({
@@ -4803,10 +4817,10 @@ requires
autovalidateName: self.options.autovalidateName,
disabled: self.options.disabled,
height: self.options.height,
- id: self.options.id + "Input" + Ox.toTitleCase(v.id),
- key: self.hasSelectableKeys ? self.options[self.keyName][0].label[self.selectedKey[0]].id : "",
+ id: self.options.id + 'Input' + Ox.toTitleCase(v.id),
+ key: self.hasSelectableKeys ? self.options[self.keyName][0].label[self.selectedKey[0]].id : '',
parent: that,
- placeholder: self.options.placeholder ? self.options.placeholder[0].label[0].title : "",
+ placeholder: self.options.placeholder ? self.options.placeholder[0].label[0].title : '',
size: self.options.size,
type: self.options.type,
value: v.value,
@@ -4815,7 +4829,7 @@ requires
}
that.$input[i]
.css($.extend({}, self.options.value.length > 1 ? {
- float: "left",
+ 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);
}))
@@ -4826,7 +4840,7 @@ requires
//width(self.options.width);
function changeKey(event, data) {
- Ox.print("changeKey", data);
+ Ox.print('changeKey', data);
if (data) { // fixme: necessary?
self.key = {
id: data.id,
@@ -4845,7 +4859,7 @@ requires
placeholder: data.value // fixme: should be data.title
});
/*
- if (that.$input.hasClass("OxPlaceholder")) {
+ if (that.$input.hasClass('OxPlaceholder')) {
that.$input.val(self.key.title);
//that.$input.focus();
} else {
@@ -4862,29 +4876,29 @@ requires
function clear() {
$.each(that.$input, function(i, v) {
- v.val("");
+ v.val('');
});
that.$input[0].focus();
}
function height(value) {
var stop = 8 / value;
- if (self.options.type == "textarea") {
+ if (self.options.type == 'textarea') {
that.$element
.height(value)
.css({
- background: "-moz-linear-gradient(top, rgb(224, 224, 224), rgb(208, 208, 208) " + (stop * 100) + "%, rgb(208, 208, 208) " + (100 - stop * 100) + "%, rgb(192, 192, 192))"
+ background: '-moz-linear-gradient(top, rgb(224, 224, 224), rgb(208, 208, 208) ' + (stop * 100) + '%, rgb(208, 208, 208) ' + (100 - stop * 100) + '%, rgb(192, 192, 192))'
})
.css({
- background: "-webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), color-stop(" + stop + ", rgb(208, 208, 208)), color-stop(" + (1 - stop) + ", rgb(208, 208, 208)), to(rgb(192, 192, 192)))"
+ background: '-webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), color-stop(' + stop + ', rgb(208, 208, 208)), color-stop(' + (1 - stop) + ', rgb(208, 208, 208)), to(rgb(192, 192, 192)))'
});
that.$input
.height(value)
.css({
- background: "-moz-linear-gradient(top, rgb(224, 224, 224), rgb(240, 240, 240) " + (stop * 100) + "%, rgb(240, 240, 240) " + (100 - stop * 100) + "%, rgb(255, 255, 255))"
+ background: '-moz-linear-gradient(top, rgb(224, 224, 224), rgb(240, 240, 240) ' + (stop * 100) + '%, rgb(240, 240, 240) ' + (100 - stop * 100) + '%, rgb(255, 255, 255))'
})
.css({
- background: "-webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), color-stop(" + stop + ", rgb(240, 240, 240)), color-stop(" + (1 - stop) + ", rgb(240, 240, 240)), to(rgb(255, 255, 255)))"
+ background: '-webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), color-stop(' + stop + ', rgb(240, 240, 240)), color-stop(' + (1 - stop) + ', rgb(240, 240, 240)), to(rgb(255, 255, 255)))'
});
}
}
@@ -4894,10 +4908,10 @@ requires
}
function submit() {
- Ox.print("submit")
+ Ox.print('submit')
var value = that.$input.val();
that.$input.blur();
- that.triggerEvent("submit", self.options.key ? {
+ that.triggerEvent('submit', self.options.key ? {
key: self.options.key,
value: value
} : value);
@@ -4906,7 +4920,7 @@ requires
function width(value) {
that.$element.width(value);
that.$input.width(
- value - (self.options.type == "textarea" ? 0 : 12) -
+ value - (self.options.type == 'textarea' ? 0 : 12) -
(self.options.label ? self.options.labelWidth : 0) -
(self.options.placeholder.length > 1 ? 16 : 0) -
(self.options.unit ? self.options.unitWidth : 0) -
@@ -4915,9 +4929,9 @@ requires
}
self.onChange = function(key, value) {
- if (key == "height") {
+ if (key == 'height') {
height(value);
- } else if (key == "width") {
+ } else if (key == 'width') {
width(value);
}
};
@@ -4935,7 +4949,7 @@ requires
var self = self || {},
that = new Ox.Element(
- options.type == "textarea" ? "textarea" : "input", self
+ options.type == 'textarea' ? 'textarea' : 'input', self
)
.defaults({
autocomplete: null,
@@ -4946,42 +4960,42 @@ requires
autovalidate: null,
disabled: false,
height: 128,
- id: "",
- key: "",
+ id: '',
+ key: '',
parent: null,
- placeholder: "",
- size: "medium",
- type: "text",
- value: "",
+ placeholder: '',
+ size: 'medium',
+ type: 'text',
+ value: '',
width: 128
})
.options(options || {})
- .addClass("OxInput Ox" + Ox.toTitleCase(self.options.size) + (
- (self.options.placeholder && self.options.value === "") ?
- " OxPlaceholder" : ""
+ .addClass('OxInput Ox' + Ox.toTitleCase(self.options.size) + (
+ (self.options.placeholder && self.options.value === '') ?
+ ' OxPlaceholder' : ''
))
- .attr(self.options.type == "textarea" ? {} : {
+ .attr(self.options.type == 'textarea' ? {} : {
type: self.options.type
})
.css({
- float: "left",
- width: (self.options.width - 14) + "px"
+ float: 'left',
+ width: (self.options.width - 14) + 'px'
})
.val(
- (self.options.placeholder && self.options.value === "") ?
+ (self.options.placeholder && self.options.value === '') ?
self.options.placeholder : self.options.value
)
.blur(blur)
.change(change)
.focus(focus);
- Ox.print("InputElement self.options", self.options)
+ Ox.print('InputElement self.options', self.options)
self.bindKeyboard = self.options.autocomplete || self.options.autocorrect ||
self.options.autosuggest || self.options.autovalidate;
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.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({
element: that.$element,
id: self.autosuggestId,
@@ -4991,10 +5005,10 @@ requires
},
size: self.options.size
});
- that.bindEvent("click_" + self.autosuggestId, clickMenu);
+ that.bindEvent('click_' + self.autosuggestId, clickMenu);
}
- that.bindEvent($.extend(self.options.type == "textarea" ? {} : {
+ that.bindEvent($.extend(self.options.type == 'textarea' ? {} : {
key_enter: submit
}, {
key_escape: cancel
@@ -5002,8 +5016,8 @@ requires
function autocomplete(value) {
var value = value.toLowerCase(),
- ret = "";
- if (value !== "") {
+ ret = '';
+ if (value !== '') {
$.each(self.options.autocomplete, function(i, v) {
if (v.toLowerCase().indexOf(value) == 0) {
ret = v;
@@ -5034,13 +5048,13 @@ requires
function autocorrect(value) {
var length = value.length;
- return $.map(value.toLowerCase().split(""), function(v, i) {
+ return $.map(value.toLowerCase().split(''), function(v, i) {
if (new RegExp(self.options.autocorrect)(v)) {
return v
} else {
return null;
}
- }).join("");
+ }).join('');
}
function autocorrectCall(blur) {
@@ -5061,9 +5075,9 @@ requires
function autosuggest(value) {
var value = value.toLowerCase(),
values = [[], []];
- if (value !== "") {
+ if (value !== '') {
$.each(self.options.key ? self.options.autosuggest[self.options.key] : self.options.autosuggest, function(i, v) {
- //Ox.print("v...", v)
+ //Ox.print('v...', v)
var index = v.toLowerCase().indexOf(value);
index > -1 && values[index == 0 ? 0 : 1].push(v);
});
@@ -5085,17 +5099,17 @@ requires
var values = values || [],
selected = values.length == 1 ? 0 : -1,
value = that.$element.val().toLowerCase();
- //Ox.print("values", values);
+ //Ox.print('values', values);
if (values.length) {
values = $.map(values, function(v, i) {
if (value == v.toLowerCase()) {
selected = i;
}
return {
- id: v.toLowerCase().replace(/ /g, "_"), // fixme: need function to do lowercase, underscores etc?
+ id: v.toLowerCase().replace(/ /g, '_'), // fixme: need function to do lowercase, underscores etc?
title: self.options.autosuggestHighlight ? v.replace(
- new RegExp("(" + value + ")", "ig"),
- "
$1"
+ new RegExp('(' + value + ')', 'ig'),
+ '
$1'
) : v
};
});
@@ -5112,14 +5126,14 @@ requires
function autovalidate(value) {
return {
valid: self.options.autovalidate(value) != null,
- message: "Invalid " + self.options.name
+ message: 'Invalid ' + self.options.name
};
}
function autovalidateCall(blur) {
var blur = blur || false,
value = that.$element.val();
- if (value !== "") {
+ if (value !== '') {
Ox.isFunction(self.options.autovalidate) ?
self.options.autovalidate(value, autovalidateCallback) :
autovalidateCallback(autovalidate(value), blur);
@@ -5127,7 +5141,7 @@ requires
autovalidateCallback({
blur: blur,
valid: false,
- message: "Empty " + self.options.name
+ message: 'Empty ' + self.options.name
});
}
}
@@ -5135,27 +5149,27 @@ requires
function autovalidateCallback(data, blur) {
if (data.valid != self.valid) {
self.valid = data.valid;
- that.triggerEvent("validate", $.extend(data, {
+ that.triggerEvent('validate', $.extend(data, {
blur: blur
}));
}
}
function blur() {
- if (!self.options.autosuggest || self.$autosuggestMenu.is(":hidden")) {
- Ox.print("losing focus...")
+ if (!self.options.autosuggest || self.$autosuggestMenu.is(':hidden')) {
+ Ox.print('losing focus...')
that.loseFocus();
- self.options.parent.removeClass("OxFocus");
+ self.options.parent.removeClass('OxFocus');
self.options.autocorrect && autocorrectCall(true);
// self.options.autosuggest && self.$autosuggestMenu.hideMenu();
self.options.autovalidate && autovalidateCall(true);
- if (self.options.placeholder && that.$element.val() === "") {
- that.$element.addClass("OxPlaceholder").val(self.options.placeholder);
+ if (self.options.placeholder && that.$element.val() === '') {
+ that.$element.addClass('OxPlaceholder').val(self.options.placeholder);
}
}
if (self.bindKeyboard) {
- $document.unbind("keydown", keypress);
- $document.unbind("keypress", keypress);
+ $document.unbind('keydown', keypress);
+ $document.unbind('keypress', keypress);
}
}
@@ -5168,11 +5182,11 @@ requires
}
function clear() {
- that.$element.val("").focus();
+ that.$element.val('').focus();
}
function clickMenu(event, data) {
- Ox.print("clickMenu", data);
+ Ox.print('clickMenu', data);
that.$element.val(data.title);
//self.$autosuggestMenu.hideMenu();
self.options.autosuggestSubmit && submit();
@@ -5198,21 +5212,21 @@ requires
function focus() {
var val = that.$element.val();
that.gainFocus();
- self.options.parent.addClass("OxFocus");
- if (that.$element.hasClass("OxPlaceholder")) {
- that.$element.val("").removeClass("OxPlaceholder");
+ self.options.parent.addClass('OxFocus');
+ if (that.$element.hasClass('OxPlaceholder')) {
+ that.$element.val('').removeClass('OxPlaceholder');
}
if (self.bindKeyboard) {
// fixme: different in webkit and firefox (?), see keyboard handler, need generic function
$document.keydown(keypress);
$document.keypress(keypress);
- Ox.print("calling autosuggest...")
+ Ox.print('calling autosuggest...')
self.options.autosuggest && setTimeout(autosuggestCall, 0); // fixme: why is the timeout needed?
}
}
function keypress(event) {
- Ox.print("keyCode", event.keyCode)
+ Ox.print('keyCode', event.keyCode)
if (event.keyCode != 9 && event.keyCode != 13 && event.keyCode != 27) { // fixme: can't 13 and 27 return false?
setTimeout(function() { // fixme: document what this timeout is for
var value = that.$element.val();
@@ -5232,14 +5246,14 @@ requires
}
self.onChange = function(key, value) {
- if (key == "placeholder") {
- that.$element.hasClass("OxPlaceholder") && that.$element.val(value);
- } else if (key == "value") {
+ if (key == 'placeholder') {
+ that.$element.hasClass('OxPlaceholder') && that.$element.val(value);
+ } else if (key == 'value') {
if (self.options.placeholder) {
- if (value === "") {
- that.$element.addClass("OxPlaceholder").val(self.options.placeholder);
+ if (value === '') {
+ that.$element.addClass('OxPlaceholder').val(self.options.placeholder);
} else {
- that.$element.removeClass("OxPlaceholder");
+ that.$element.removeClass('OxPlaceholder');
}
}
change(); // fixme: keypress too
@@ -5261,10 +5275,10 @@ requires
animate: false,
arrows: false,
arrowStep: 1,
- arrowSymbols: ["previous", "next"],
+ arrowSymbols: ['previous', 'next'],
max: 100,
min: 0,
- orientation: "horizontal",
+ orientation: 'horizontal',
step: 1,
size: 128,
thumbSize: 16,
@@ -5279,9 +5293,9 @@ requires
options.arrowStep : options.step,
trackImages: $.makeArray(options.trackImages || [])
}))
- .addClass("OxRange")
+ .addClass('OxRange')
.css({
- width: self.options.size + "px"
+ width: self.options.size + 'px'
});
// fixme: self. ... ?
@@ -5294,38 +5308,38 @@ requires
*/
that.$element
.css({
- width: self.options.size + "px"
+ width: self.options.size + 'px'
});
if (self.options.arrows) {
var $arrowDec = Ox.Button({
- style: "symbol",
- type: "image",
+ style: 'symbol',
+ type: 'image',
value: self.options.arrowSymbols[0]
})
- .addClass("OxArrow")
+ .addClass('OxArrow')
.mousedown(mousedownArrow)
.click(clickArrowDec)
.appendTo(that.$element);
}
var $track = new Ox.Element()
- .addClass("OxTrack")
+ .addClass('OxTrack')
.mousedown(clickTrack)
.appendTo(that.$element);
if (trackImages) {
var width = parseFloat(screen.width / trackImages),
- $image = $("