1
0
Fork 0
forked from 0x2620/oxjs

use Ox.Log

This commit is contained in:
j 2011-11-04 16:54:28 +01:00
commit dce2843303
50 changed files with 276 additions and 276 deletions

View file

@ -234,7 +234,7 @@ Ox.Input = function(options, self) {
.appendTo(that.$element);
if (self.options.type == 'textarea') {
Ox.print('TEXTAREA', self.options.width, self.options.height, '...', that.css('width'), that.css('height'), '...', self.$input.css('width'), self.$input.css('height'), '...', self.$input.css('border'))
Ox.Log('Form', 'TEXTAREA', self.options.width, self.options.height, '...', that.css('width'), that.css('height'), '...', self.$input.css('width'), self.$input.css('height'), '...', self.$input.css('border'))
}
// fixme: is there a better way than this one?
@ -299,7 +299,7 @@ Ox.Input = function(options, self) {
oldValue = Ox.isUndefined(oldValue) ? self.options.value : oldValue;
oldCursor = Ox.isUndefined(oldCursor) ? cursor() : oldCursor;
Ox.print('autocomplete', oldValue, oldCursor)
Ox.Log('Form', 'autocomplete', oldValue, oldCursor)
if (self.options.value || self.options.autocompleteReplaceCorrect) {
if (Ox.isFunction(self.options.autocomplete)) {
@ -333,7 +333,7 @@ Ox.Input = function(options, self) {
function autocompleteCallback(values) {
//Ox.print('autocompleteCallback', values[0], self.options.value, self.options.value.length, oldValue, oldCursor)
//Ox.Log('Form', 'autocompleteCallback', values[0], self.options.value, self.options.value.length, oldValue, oldCursor)
var length = self.options.value.length,
newValue, newLength,
@ -357,7 +357,7 @@ Ox.Input = function(options, self) {
}
newLength = newValue.length;
//Ox.print('selectEnd', selectEnd)
//Ox.Log('Form', 'selectEnd', selectEnd)
if (self.options.autocompleteReplace) {
value = self.options.value;
@ -538,7 +538,7 @@ Ox.Input = function(options, self) {
}
function autovalidateCallback(data) {
//Ox.print('autovalidateCallback', newValue, oldCursor)
//Ox.Log('Form', 'autovalidateCallback', newValue, oldCursor)
self.options.value = data.value;
self.$input.val(self.options.value);
!blur && cursor(
@ -555,7 +555,7 @@ Ox.Input = function(options, self) {
/*
function autovalidate(blur) {
Ox.print('autovalidate', self.options.value, blur || false)
Ox.Log('Form', 'autovalidate', self.options.value, blur || false)
self.autocorrectBlur = blur || false;
self.autocorrectCursor = cursor();
Ox.isFunction(self.options.autocorrect) ?
@ -643,7 +643,7 @@ Ox.Input = function(options, self) {
}
function clickMenu(data) {
//Ox.print('clickMenu', data);
//Ox.Log('Form', 'clickMenu', data);
self.options.value = data.title;
self.$input.val(self.options.value).focus();
that.gainFocus();
@ -669,7 +669,7 @@ Ox.Input = function(options, self) {
function deselectMenu() {
return;
//Ox.print('deselectMenu')
//Ox.Log('Form', 'deselectMenu')
self.options.value = self.oldValue;
self.$input.val(self.options.value);
cursor(self.oldCursor);
@ -718,7 +718,7 @@ Ox.Input = function(options, self) {
setTimeout(function() { // wait for val to be set
var value = self.$input.val();
if ((self.options.autocompleteReplace || self.options.decimals) && hasDeletedSelectedEnd) {
//Ox.print('HAS DELETED SELECTED END', event.keyCode)
//Ox.Log('Form', 'HAS DELETED SELECTED END', event.keyCode)
value = newValue;
self.$input.val(value);
}
@ -751,7 +751,7 @@ Ox.Input = function(options, self) {
function selectMenu(data) {
var pos = cursor();
//if (self.options.value) {
//Ox.print('selectMenu', pos, data.title)
//Ox.Log('Form', 'selectMenu', pos, data.title)
self.options.value = data.title
self.$input.val(self.options.value);
cursor(pos[0], self.options.value.length);
@ -1043,8 +1043,8 @@ Ox.Input_ = function(options, self) {
(self.options.value.length - 1) * self.options.separatorWidth;
}
*/
//Ox.print('self.hasMulVal', self.hasMultipleValues);
//Ox.print('self.options.value', self.options.value)
//Ox.Log('Form', 'self.hasMulVal', self.hasMultipleValues);
//Ox.Log('Form', 'self.options.value', self.options.value)
if (!self.hasMultipleValues) {
if (self.options.type == 'select') {
self.options.value = [{
@ -1065,9 +1065,9 @@ Ox.Input_ = function(options, self) {
}]
}
}
//Ox.print('self.options.value', self.options.value)
//Ox.Log('Form', 'self.options.value', self.options.value)
self.values = self.options.value.length;
//Ox.print(self.options.id, 'self.values', self.values)
//Ox.Log('Form', 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) {
@ -1096,12 +1096,12 @@ Ox.Input_ = function(options, self) {
}
}
//Ox.print('self', self);
//Ox.Log('Form', 'self', self);
if (self.keyName) {
that.$key = [];
self.options[self.keyName].forEach(function(key, keyPos) {
//Ox.print('keyPos key', keyPos, key)
//Ox.Log('Form', 'keyPos key', keyPos, key)
if (self.keyName == 'label' && key.label.length == 1) {
that.$key[keyPos] = Ox.Label({
overlap: 'right',
@ -1116,10 +1116,10 @@ Ox.Input_ = function(options, self) {
})
.appendTo(that);
} else if (key.label.length > 1) {
//Ox.print('key.length > 1')
//Ox.Log('Form', '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]);
//Ox.Log('Form', 'three', self.selectedKey, keyPos, self.selectedKey[keyPos]);
that.$key[keyPos] = Ox.Select({
id: self.selectKeyId,
items: $.map(key.label, function(value, valuePos) {
@ -1174,7 +1174,7 @@ Ox.Input_ = function(options, self) {
that.$unit = Ox.Select({
id: self.selectUnitId,
items: $.map(self.options.unit, function(unit, i) {
//Ox.print('unit', unit)
//Ox.Log('Form', 'unit', unit)
return {
checked: i == 0,
id: unit.id,
@ -1215,12 +1215,12 @@ Ox.Input_ = function(options, self) {
that.$input = [];
//self.margin = 0;
self.options.value.forEach(function(v, i) {
//Ox.print('o k i', self.options, self.keyName, i);
//Ox.Log('Form', '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('.') : '';
//self.margin -= (i == 0 ? 16 : self.options.value[i - 1].width)
//Ox.print('v:', v, 'id:', id)
//Ox.Log('Form', 'v:', v, 'id:', id)
if (self.options.type == 'select') {
that.$input[i] = Ox.Select({
id: v.id,
@ -1269,7 +1269,7 @@ Ox.Input_ = function(options, self) {
//width(self.options.width);
function changeKey(data) {
//Ox.print('changeKey', data);
//Ox.Log('Form', 'changeKey', data);
if (data) { // fixme: necessary?
self.key = {
id: data.id,
@ -1337,7 +1337,7 @@ Ox.Input_ = function(options, self) {
}
function submit() {
//Ox.print('submit')
//Ox.Log('Form', 'submit')
var value = that.$input.val();
that.$input.blur();
that.triggerEvent('submit', self.options.key ? {
@ -1418,7 +1418,7 @@ Ox.InputElement_ = function(options, self) {
.change(change)
.focus(focus);
//Ox.print('InputElement self.options', self.options)
//Ox.Log('Form', 'InputElement self.options', self.options)
self.bindKeyboard = self.options.autocomplete || self.options.autocorrect
|| self.options.autosuggest || self.options.autovalidate;
@ -1509,7 +1509,7 @@ Ox.InputElement_ = function(options, self) {
self.options.key ?
self.options.autosuggest[self.options.key] : self.options.autosuggest
).forEach(function(v, i) {
//Ox.print('v...', v)
//Ox.Log('Form', 'v...', v)
var index = v.toLowerCase().indexOf(value);
index > -1 && values[index == 0 ? 0 : 1].push(v);
});
@ -1531,7 +1531,7 @@ Ox.InputElement_ = function(options, self) {
var values = values || [],
selected = values.length == 1 ? 0 : -1,
value = that.$element.val().toLowerCase();
//Ox.print('values', values);
//Ox.Log('Form', 'values', values);
if (values.length) {
values = $.map(values, function(v, i) {
if (value == v.toLowerCase()) {
@ -1589,7 +1589,7 @@ Ox.InputElement_ = function(options, self) {
function blur() {
if (!self.options.autosuggest || self.$autosuggestMenu.is(':hidden')) {
//Ox.print('losing focus...')
//Ox.Log('Form', 'losing focus...')
that.loseFocus();
self.options.parent.removeClass('OxFocus');
self.options.autocorrect && autocorrectCall(true);
@ -1617,7 +1617,7 @@ Ox.InputElement_ = function(options, self) {
}
function clickMenu(data) {
//Ox.print('clickMenu', data);
//Ox.Log('Form', 'clickMenu', data);
that.$element.val(data.title);
//self.$autosuggestMenu.hideMenu();
self.options.autosuggestSubmit && submit();
@ -1650,13 +1650,13 @@ Ox.InputElement_ = function(options, self) {
if (self.bindKeyboard) {
// fixme: different in webkit and firefox (?), see keyboard handler, need generic function
Ox.UI.$document.keydown(keydown);
//Ox.print('calling autosuggest...')
//Ox.Log('Form', 'calling autosuggest...')
self.options.autosuggest && setTimeout(autosuggestCall, 0); // fixme: why is the timeout needed?
}
}
function keydown(event) {
//Ox.print('keyCode', event.keyCode)
//Ox.Log('Form', '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();
@ -1782,7 +1782,7 @@ Ox.Range_ = function(options, self) {
var $thumb = Ox.Button({})
.addClass('OxThumb')
.appendTo($track);
//Ox.print('----')
//Ox.Log('Form', '----')
if (self.options.arrows) {
var $arrowInc = Ox.Button({
style: 'symbol',