Ox.UI -> Ox
This commit is contained in:
parent
eaaa8602e7
commit
775aa607c8
13 changed files with 31 additions and 31 deletions
2
index.js
2
index.js
|
@ -586,7 +586,7 @@ Ox.load(/^https?:\/\/(www\.)?oxjs\.org\//.test(
|
||||||
var $item = $('<div>')
|
var $item = $('<div>')
|
||||||
.addClass('item')
|
.addClass('item')
|
||||||
.attr({id: item.id})
|
.attr({id: item.id})
|
||||||
.css({width: 224 - Ox.UI.SCROLLBAR_SIZE + 'px'})
|
.css({width: 224 - Ox.SCROLLBAR_SIZE + 'px'})
|
||||||
.appendTo($list);
|
.appendTo($list);
|
||||||
$('<div>')
|
$('<div>')
|
||||||
.addClass('OxSerif title')
|
.addClass('OxSerif title')
|
||||||
|
|
|
@ -18,7 +18,7 @@ Ox.Bar = function(options, self) {
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
.addClass('OxBar Ox' + Ox.toTitleCase(self.options.orientation));
|
.addClass('OxBar Ox' + Ox.toTitleCase(self.options.orientation));
|
||||||
|
|
||||||
self.dimensions = Ox.UI.DIMENSIONS[self.options.orientation];
|
self.dimensions = Ox.DIMENSIONS[self.options.orientation];
|
||||||
|
|
||||||
that.css(self.dimensions[0], '100%')
|
that.css(self.dimensions[0], '100%')
|
||||||
.css(self.dimensions[1], self.options.size + 'px');
|
.css(self.dimensions[1], self.options.size + 'px');
|
||||||
|
|
|
@ -66,8 +66,8 @@ Ox.Resizebar = function(options, self) {
|
||||||
|
|
||||||
self.clientXY = self.options.orientation == 'horizontal'
|
self.clientXY = self.options.orientation == 'horizontal'
|
||||||
? 'clientY' : 'clientX';
|
? 'clientY' : 'clientX';
|
||||||
self.dimensions = Ox.UI.DIMENSIONS[self.options.orientation];
|
self.dimensions = Ox.DIMENSIONS[self.options.orientation];
|
||||||
self.edges = Ox.UI.EDGES[self.options.orientation];
|
self.edges = Ox.EDGES[self.options.orientation];
|
||||||
self.isLeftOrTop = self.options.edge == 'left' || self.options.edge == 'top';
|
self.isLeftOrTop = self.options.edge == 'left' || self.options.edge == 'top';
|
||||||
|
|
||||||
that.css({cursor: getCursor()});
|
that.css({cursor: getCursor()});
|
||||||
|
|
|
@ -249,9 +249,9 @@ Ox.Editable = function(options, self) {
|
||||||
self.$test.css({display: 'inline-block'});
|
self.$test.css({display: 'inline-block'});
|
||||||
height = self.options.height || Ox.limit(self.$test.height(), self.minHeight, self.maxHeight);
|
height = self.options.height || Ox.limit(self.$test.height(), self.minHeight, self.maxHeight);
|
||||||
width = self.$test.width();
|
width = self.$test.width();
|
||||||
// +Ox.UI.SCROLLBAR_SIZE to prevent scrollbar from showing up
|
// +Ox.SCROLLBAR_SIZE to prevent scrollbar from showing up
|
||||||
if (self.options.type == 'textarea') {
|
if (self.options.type == 'textarea') {
|
||||||
width += Ox.UI.SCROLLBAR_SIZE;
|
width += Ox.SCROLLBAR_SIZE;
|
||||||
}
|
}
|
||||||
width = self.options.width || Ox.limit(width, self.minWidth, self.maxWidth);
|
width = self.options.width || Ox.limit(width, self.minWidth, self.maxWidth);
|
||||||
self.$test.css({display: 'none'});
|
self.$test.css({display: 'none'});
|
||||||
|
|
|
@ -650,7 +650,7 @@ Ox.Input = function(options, self) {
|
||||||
self.options.autovalidate && autovalidate(true);
|
self.options.autovalidate && autovalidate(true);
|
||||||
self.options.placeholder && setPlaceholder();
|
self.options.placeholder && setPlaceholder();
|
||||||
self.options.validate && validate();
|
self.options.validate && validate();
|
||||||
self.bindKeyboard && Ox.UI.$document.off('keydown', keydown);
|
self.bindKeyboard && Ox.$document.off('keydown', keydown);
|
||||||
if (!self.cancelled && !self.submitted) {
|
if (!self.cancelled && !self.submitted) {
|
||||||
that.triggerEvent('blur', {value: self.options.value});
|
that.triggerEvent('blur', {value: self.options.value});
|
||||||
self.options.value !== self.originalValue && that.triggerEvent('change', {
|
self.options.value !== self.originalValue && that.triggerEvent('change', {
|
||||||
|
@ -782,8 +782,8 @@ Ox.Input = function(options, self) {
|
||||||
self.options.placeholder && setPlaceholder();
|
self.options.placeholder && setPlaceholder();
|
||||||
if (self.bindKeyboard) {
|
if (self.bindKeyboard) {
|
||||||
// fixme: different in webkit and firefox (?), see keyboard handler, need generic function
|
// fixme: different in webkit and firefox (?), see keyboard handler, need generic function
|
||||||
Ox.UI.$document.keydown(keydown);
|
Ox.$document.keydown(keydown);
|
||||||
//Ox.UI.$document.keypress(keypress);
|
//Ox.$document.keypress(keypress);
|
||||||
// temporarily disabled autocomplete on focus
|
// temporarily disabled autocomplete on focus
|
||||||
//self.options.autocompleteSelect && setTimeout(autocomplete, 0); // fixme: why is the timeout needed?
|
//self.options.autocompleteSelect && setTimeout(autocomplete, 0); // fixme: why is the timeout needed?
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ Ox.InsertHTMLDialog = function(options, self) {
|
||||||
height: 184,
|
height: 184,
|
||||||
keys: {enter: 'insert', escape: 'cancel'},
|
keys: {enter: 'insert', escape: 'cancel'},
|
||||||
title: Ox._('Insert HTML'),
|
title: Ox._('Insert HTML'),
|
||||||
width: 416 + Ox.UI.SCROLLBAR_SIZE
|
width: 416 + Ox.SCROLLBAR_SIZE
|
||||||
});
|
});
|
||||||
|
|
||||||
function renderForm() {
|
function renderForm() {
|
||||||
|
|
|
@ -34,7 +34,7 @@ Ox.CustomList = function(options, self) {
|
||||||
self.$list.options({items: self.options.items});
|
self.$list.options({items: self.options.items});
|
||||||
},
|
},
|
||||||
itemWidth: function() {
|
itemWidth: function() {
|
||||||
var width = self.options.itemWidth - Ox.UI.SCROLLBAR_SIZE;
|
var width = self.options.itemWidth - Ox.SCROLLBAR_SIZE;
|
||||||
if (self.options.resize) {
|
if (self.options.resize) {
|
||||||
that.find('.OxItem').each(function(element) {
|
that.find('.OxItem').each(function(element) {
|
||||||
self.options.resize($(this), width);
|
self.options.resize($(this), width);
|
||||||
|
@ -58,13 +58,13 @@ Ox.CustomList = function(options, self) {
|
||||||
self.$list = Ox.List({
|
self.$list = Ox.List({
|
||||||
construct: function(data) {
|
construct: function(data) {
|
||||||
return self.options.item(
|
return self.options.item(
|
||||||
data, self.options.itemWidth - Ox.UI.SCROLLBAR_SIZE
|
data, self.options.itemWidth - Ox.SCROLLBAR_SIZE
|
||||||
).addClass('OxTarget');
|
).addClass('OxTarget');
|
||||||
},
|
},
|
||||||
draggable: self.options.draggable,
|
draggable: self.options.draggable,
|
||||||
itemHeight: self.options.itemHeight,
|
itemHeight: self.options.itemHeight,
|
||||||
itemWidth: self.options.itemWidth
|
itemWidth: self.options.itemWidth
|
||||||
- self.options.scrollbarVisible * Ox.UI.SCROLLBAR_SIZE,
|
- self.options.scrollbarVisible * Ox.SCROLLBAR_SIZE,
|
||||||
items: self.options.items,
|
items: self.options.items,
|
||||||
keys: self.options.keys.concat(self.options.unique),
|
keys: self.options.keys.concat(self.options.unique),
|
||||||
max: self.options.max,
|
max: self.options.max,
|
||||||
|
|
|
@ -46,7 +46,7 @@ Ox.IconItem = function(options, self) {
|
||||||
infoIsObject: Ox.isObject(self.options.info),
|
infoIsObject: Ox.isObject(self.options.info),
|
||||||
lineLength: self.options.itemWidth == 64 ? 15 : 23,
|
lineLength: self.options.itemWidth == 64 ? 15 : 23,
|
||||||
lines: self.options.itemWidth == 64 ? 4 : 5,
|
lines: self.options.itemWidth == 64 ? 4 : 5,
|
||||||
url: Ox.UI.PATH + 'png/transparent.png'
|
url: Ox.UI_PATH + 'png/transparent.png'
|
||||||
});
|
});
|
||||||
|
|
||||||
self.title = formatText(self.options.title, self.lines - 1 - self.infoIsObject, self.lineLength);
|
self.title = formatText(self.options.title, self.lines - 1 - self.infoIsObject, self.lineLength);
|
||||||
|
|
|
@ -167,9 +167,9 @@ Ox.InfoList = function(options, self) {
|
||||||
|
|
||||||
function getItemWidth(cached) {
|
function getItemWidth(cached) {
|
||||||
if (!cached) {
|
if (!cached) {
|
||||||
self.cachedWidth = self.$list.width() - Ox.UI.SCROLLBAR_SIZE;
|
self.cachedWidth = self.$list.width() - Ox.SCROLLBAR_SIZE;
|
||||||
} else if (!self.cachedWidth || self.cachedWidthTime < +new Date() - 5000) {
|
} else if (!self.cachedWidth || self.cachedWidthTime < +new Date() - 5000) {
|
||||||
self.cachedWidth = self.$list.width() - Ox.UI.SCROLLBAR_SIZE;
|
self.cachedWidth = self.$list.width() - Ox.SCROLLBAR_SIZE;
|
||||||
self.cachedWidthTime = +new Date();
|
self.cachedWidthTime = +new Date();
|
||||||
}
|
}
|
||||||
return self.cachedWidth;
|
return self.cachedWidth;
|
||||||
|
|
|
@ -594,7 +594,7 @@ Ox.List = function(options, self) {
|
||||||
return that.height() - (
|
return that.height() - (
|
||||||
!self.options.disableHorizontalScrolling
|
!self.options.disableHorizontalScrolling
|
||||||
&& that.$content.width() > that.width()
|
&& that.$content.width() > that.width()
|
||||||
? Ox.UI.SCROLLBAR_SIZE : 0
|
? Ox.SCROLLBAR_SIZE : 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,7 +782,7 @@ Ox.List = function(options, self) {
|
||||||
function getWidth() {
|
function getWidth() {
|
||||||
//Ox.Log('List', 'LIST THAT.WIDTH()', that.width())
|
//Ox.Log('List', 'LIST THAT.WIDTH()', that.width())
|
||||||
return that.width() - (
|
return that.width() - (
|
||||||
that.$content.height() > that.height() ? Ox.UI.SCROLLBAR_SIZE : 0
|
that.$content.height() > that.height() ? Ox.SCROLLBAR_SIZE : 0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ Ox.TableList = function(options, self) {
|
||||||
.addClass('OxHead')
|
.addClass('OxHead')
|
||||||
.css({
|
.css({
|
||||||
right: self.options.scrollbarVisible
|
right: self.options.scrollbarVisible
|
||||||
? Ox.UI.SCROLLBAR_SIZE + 'px' : 0
|
? Ox.SCROLLBAR_SIZE + 'px' : 0
|
||||||
})
|
})
|
||||||
.appendTo(that.$bar);
|
.appendTo(that.$bar);
|
||||||
that.$head.$content.addClass('OxTitles');
|
that.$head.$content.addClass('OxTitles');
|
||||||
|
@ -232,7 +232,7 @@ Ox.TableList = function(options, self) {
|
||||||
return column.id;
|
return column.id;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.css(Ox.UI.SCROLLBAR_SIZE == 16 ? {
|
.css(Ox.SCROLLBAR_SIZE == 16 ? {
|
||||||
right: 0,
|
right: 0,
|
||||||
width: '14px'
|
width: '14px'
|
||||||
} : {
|
} : {
|
||||||
|
@ -241,7 +241,7 @@ Ox.TableList = function(options, self) {
|
||||||
})
|
})
|
||||||
.bindEvent('change', changeColumns)
|
.bindEvent('change', changeColumns)
|
||||||
.appendTo(that.$bar);
|
.appendTo(that.$bar);
|
||||||
Ox.UI.SCROLLBAR_SIZE < 16 && $(that.$select.find('input')[0]).css({
|
Ox.SCROLLBAR_SIZE < 16 && $(that.$select.find('input')[0]).css({
|
||||||
marginRight: '-3px',
|
marginRight: '-3px',
|
||||||
marginTop: '1px',
|
marginTop: '1px',
|
||||||
width: '8px',
|
width: '8px',
|
||||||
|
@ -254,7 +254,7 @@ Ox.TableList = function(options, self) {
|
||||||
})
|
})
|
||||||
.addClass('OxClear')
|
.addClass('OxClear')
|
||||||
.attr({src: Ox.getImageURL('symbolClose')})
|
.attr({src: Ox.getImageURL('symbolClose')})
|
||||||
.css(Ox.UI.SCROLLBAR_SIZE == 16 ? {
|
.css(Ox.SCROLLBAR_SIZE == 16 ? {
|
||||||
paddingLeft: '4px',
|
paddingLeft: '4px',
|
||||||
paddingRight: '2px',
|
paddingRight: '2px',
|
||||||
marginRight: 0
|
marginRight: 0
|
||||||
|
@ -777,7 +777,7 @@ Ox.TableList = function(options, self) {
|
||||||
return Math.max(
|
return Math.max(
|
||||||
Ox.sum(self.columnWidths),
|
Ox.sum(self.columnWidths),
|
||||||
self.cachedWidth -
|
self.cachedWidth -
|
||||||
(self.options.scrollbarVisible ? Ox.UI.SCROLLBAR_SIZE : 0)
|
(self.options.scrollbarVisible ? Ox.SCROLLBAR_SIZE : 0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,14 +950,14 @@ Ox.TableList = function(options, self) {
|
||||||
// FIXME: not yet used
|
// FIXME: not yet used
|
||||||
that.$body.find('img').each(function(i, element) {
|
that.$body.find('img').each(function(i, element) {
|
||||||
var $element = $(element),
|
var $element = $(element),
|
||||||
data = Ox.UI.getImageData($element.attr('src'));
|
data = Ox.getImageData($element.attr('src'));
|
||||||
if (data && data.color == 'selected') {
|
if (data && data.color == 'selected') {
|
||||||
$element.attr({src: Ox.getImageURL(data.name, 'default')});
|
$element.attr({src: Ox.getImageURL(data.name, 'default')});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
that.$body.find('.OxSelected img').each(function(i, element) {
|
that.$body.find('.OxSelected img').each(function(i, element) {
|
||||||
var $element = $(element),
|
var $element = $(element),
|
||||||
data = Ox.UI.getImageData($element.attr('src'));
|
data = Ox.getImageData($element.attr('src'));
|
||||||
if (data && data.color == 'default') {
|
if (data && data.color == 'default') {
|
||||||
$element.attr({src: Ox.getImageURL(data.name, 'selected')});
|
$element.attr({src: Ox.getImageURL(data.name, 'selected')});
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ Ox.TreeList = function(options, self) {
|
||||||
function constructItem(data) {
|
function constructItem(data) {
|
||||||
var $item = $('<div>').css({
|
var $item = $('<div>').css({
|
||||||
width: self.options.width == 'auto' ? '100%'
|
width: self.options.width == 'auto' ? '100%'
|
||||||
: self.options.width - Ox.UI.SCROLLBAR_SIZE + 'px'
|
: self.options.width - Ox.SCROLLBAR_SIZE + 'px'
|
||||||
}),
|
}),
|
||||||
$cell = $('<div>').addClass('OxCell').css({width: '8px'}),
|
$cell = $('<div>').addClass('OxCell').css({width: '8px'}),
|
||||||
$icon = data.id ? getIcon(data.id, data.expanded || (
|
$icon = data.id ? getIcon(data.id, data.expanded || (
|
||||||
|
@ -112,7 +112,7 @@ Ox.TreeList = function(options, self) {
|
||||||
$('<div>')
|
$('<div>')
|
||||||
.addClass('OxCell OxTarget')
|
.addClass('OxCell OxTarget')
|
||||||
.css({
|
.css({
|
||||||
width: self.options.width - padding - 32 - Ox.UI.SCROLLBAR_SIZE + 'px'
|
width: self.options.width - padding - 32 - Ox.SCROLLBAR_SIZE + 'px'
|
||||||
})
|
})
|
||||||
.html(data.title || '')
|
.html(data.title || '')
|
||||||
.appendTo($item);
|
.appendTo($item);
|
||||||
|
|
|
@ -788,7 +788,7 @@ Ox.Menu = function(options, self) {
|
||||||
if (!that.is(':hidden')) {
|
if (!that.is(':hidden')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
that.parent().length == 0 && that.appendTo(Ox.UI.$body);
|
that.parent().length == 0 && that.appendTo(Ox.$body);
|
||||||
that.css({
|
that.css({
|
||||||
left: '-1000px',
|
left: '-1000px',
|
||||||
top: '-1000px'
|
top: '-1000px'
|
||||||
|
@ -797,13 +797,13 @@ Ox.Menu = function(options, self) {
|
||||||
width = self.options.element.outerWidth(),
|
width = self.options.element.outerWidth(),
|
||||||
height = self.options.element.outerHeight(),
|
height = self.options.element.outerHeight(),
|
||||||
menuWidth = that.width(),
|
menuWidth = that.width(),
|
||||||
windowWidth = Ox.UI.$window.width(),
|
windowWidth = Ox.$window.width(),
|
||||||
windowHeight = Ox.UI.$window.height(),
|
windowHeight = Ox.$window.height(),
|
||||||
left = offset.left + self.options.offset.left + (self.options.edge == 'bottom' ? 0 : width),
|
left = offset.left + self.options.offset.left + (self.options.edge == 'bottom' ? 0 : width),
|
||||||
right,
|
right,
|
||||||
top = offset.top + self.options.offset.top + (self.options.edge == 'bottom' ? height : 0),
|
top = offset.top + self.options.offset.top + (self.options.edge == 'bottom' ? height : 0),
|
||||||
menuHeight = that.$content.outerHeight(), // fixme: why is outerHeight 0 when hidden?
|
menuHeight = that.$content.outerHeight(), // fixme: why is outerHeight 0 when hidden?
|
||||||
menuMaxHeight = Math.floor(Ox.UI.$window.height() - top - 16);
|
menuMaxHeight = Math.floor(Ox.$window.height() - top - 16);
|
||||||
if (self.options.edge == 'bottom' && left + menuWidth > windowWidth) {
|
if (self.options.edge == 'bottom' && left + menuWidth > windowWidth) {
|
||||||
left = offset.left + width - menuWidth;
|
left = offset.left + width - menuWidth;
|
||||||
that.is('.OxRight') && that.removeClass('OxRight') && that.addClass('OxLeft');
|
that.is('.OxRight') && that.removeClass('OxRight') && that.addClass('OxLeft');
|
||||||
|
|
Loading…
Reference in a new issue