cleanup, again

This commit is contained in:
rolux 2011-11-03 16:42:41 +01:00
parent 2809a5d06d
commit 094b1a59ec
34 changed files with 93 additions and 101 deletions

View file

@ -162,5 +162,5 @@ Ox.Progressbar = function(options, self) {
};
return that;
};

View file

@ -126,7 +126,6 @@ Ox.Resizebar = function(options, self) {
? (self.isLeftOrTop ? 'n' : 's')
: (self.isLeftOrTop ? 'w' : 'e');
}
}
return cursor + '-resize';
}
@ -172,7 +171,7 @@ Ox.Resizebar = function(options, self) {
size: self.isLeftOrTop
? self.options.elements[1][self.dimensions[1]]()
: self.options.size
});
});
}
self.setOption = function(key, value) {

View file

@ -507,7 +507,7 @@ Ox.Calendar = function(options, self) {
.css({
textAlign: 'center'
});
self.$lines = [];
getLines();
renderCalendar();
@ -713,10 +713,11 @@ Ox.Calendar = function(options, self) {
width = getPosition(event.endTime, zoom) - left;
}
return Ox.Element()
.addClass('OxEvent' +
(event.type ? ' Ox' + Ox.toTitleCase(event.type) : '' ) +
(event.current ? ' OxCurrent' : '') +
(event.id == self.options.selected ? ' OxSelected' : '')
.addClass(
'OxEvent'
+ (event.type ? ' Ox' + Ox.toTitleCase(event.type) : '' )
+ (event.current ? ' OxCurrent' : '')
+ (event.id == self.options.selected ? ' OxSelected' : '')
)
.css({
left: left + 'px',
@ -803,14 +804,14 @@ Ox.Calendar = function(options, self) {
})
.appendTo(self.$content);
}
self.lineEvents[line].push(event);
self.lineEvents[line].push(event);
});
}
function getMouseDate(e) {
return new Date(+self.options.date + (
e.clientX - that.offset().left - self.options.width / 2 - 1
) * getSecondsPerPixel() * 1000);
) * getSecondsPerPixel() * 1000);
}
function getOverlayWidths() {
@ -830,9 +831,8 @@ Ox.Calendar = function(options, self) {
function getPosition(date, zoom) {
return Math.round(
self.options.width / 2 +
(date - self.options.date) / 1000 *
getPixelsPerSecond(zoom)
self.options.width / 2
+ (date - self.options.date) / 1000 * getPixelsPerSecond(zoom)
);
}

View file

@ -88,7 +88,7 @@ Ox.ListCalendar = function(options, self) {
if (!self.durationCache[key]) {
self.durationCache[key] = Ox.formatDateRangeDuration(data.start, data.end, true);
}
return self.durationCache[key];
return self.durationCache[key];
},
id: 'id',
map: function(value, data) {

View file

@ -38,10 +38,10 @@ Ox.DocPage = function(options, self) {
var $elements = [$('<div>')
.css({paddingLeft: (level ? level * 32 - 16 : 0) + 'px'})
.html(
'<code><b>' + (name || item.name) + '</b> ' +
'&lt;' + item.types.join('&gt;</code> or <code>&lt;') + '&gt; </code>' +
(item['default'] ? '(default: <code>' + item['default'] + '</code>) ' : '') +
Ox.parseHTML(item.summary)
'<code><b>' + (name || item.name) + '</b> '
+ '&lt;' + item.types.join('&gt;</code> or <code>&lt;') + '&gt; </code>'
+ (item['default'] ? '(default: <code>' + item['default'] + '</code>) ' : '')
+ Ox.parseHTML(item.summary)
)
];
[
@ -112,11 +112,11 @@ Ox.DocPage = function(options, self) {
.addClass(className)
.css({marginLeft: (level * 32 + 16) + 'px'})
.html(
'<code><b>&gt;&nbsp;' +
Ox.encodeHTML(example.statement)
.replace(/ /g, '&nbsp;')
.replace(/\n/g, '<br/>\n&nbsp;&nbsp;') +
'</b></code>'
'<code><b>&gt;&nbsp;'
+ Ox.encodeHTML(example.statement)
.replace(/ /g, '&nbsp;')
.replace(/\n/g, '<br/>\n&nbsp;&nbsp;')
+ '</b></code>'
)
);
example.result && $elements.push($('<div>')
@ -124,7 +124,7 @@ Ox.DocPage = function(options, self) {
.css({marginLeft: (level * 32 + 16) + 'px'})
.html(
'<code>' + Ox.encodeHTML(example.result) + '</code>'
)
)
)
});
} else if (section == 'source') {
@ -133,8 +133,8 @@ Ox.DocPage = function(options, self) {
.addClass(className)
.css({marginLeft: 16 + 'px'})
.html(
'<code><b>' + self.options.item.file.replace(Ox.PATH, '') +
'</b> line ' + self.options.item.line + '</code>'
'<code><b>' + self.options.item.file.replace(Ox.PATH, '')
+ '</b> line ' + self.options.item.line + '</code>'
)
);
$elements.push(

View file

@ -225,7 +225,7 @@ Ox.Element = function(options, self) {
}
function mousemove(e) {
e = extend(e);
clearTimeout(dragTimeout);
clearTimeout(dragTimeout);
dragTimeout = setTimeout(function() {
// mouse did not move for 250 ms, trigger dragpause
that.triggerEvent('dragpause', e);

View file

@ -18,7 +18,7 @@ Ox.SyntaxHighlighter <function> Syntax Highlighter
Ox.SyntaxHighlighter = function(options, self) {
self = self || {};
self = self || {};
var that = Ox.Element({}, self)
.defaults({
lineLength: 0,
@ -40,8 +40,8 @@ Ox.SyntaxHighlighter = function(options, self) {
var $lineNumbers, $line, $source, width,
lines, source = '', tokens,
linebreak = (
self.options.showLinebreaks ?
'<span class="OxLinebreak">\u21A9</span>' : ''
self.options.showLinebreaks
? '<span class="OxLinebreak">\u21A9</span>' : ''
) + '<br/>',
tab = (
self.options.showTabs ?

View file

@ -247,7 +247,7 @@ Ox.URL = function(options) {
}
if (state.sort && state.sort.length) {
parts.push(constructSort(state.sort, state));
}
}
if (state.find) {
parts.push(constructFind(state.find));
}
@ -498,7 +498,7 @@ Ox.URL = function(options) {
!state.item ? 'list' : 'item'
], function(view) {
if (spanTypes[view] == spanType) {
state.view = view;
state.view = view;
state.span = span;
parts.shift();
return false;
@ -675,5 +675,5 @@ Ox.URL = function(options) {
}
return that;
};

View file

@ -33,10 +33,10 @@ Ox.Checkbox = function(options, self) {
width: 'auto'
})
.options(options || {})
.addClass('OxCheckbox'
+ (self.options.overlap == 'none' ? '' : ' OxOverlap'
+ Ox.toTitleCase(self.options.overlap))
)
.addClass('OxCheckbox' + (
self.options.overlap == 'none'
? '' : ' OxOverlap' + Ox.toTitleCase(self.options.overlap)
))
.attr({
disabled: self.options.disabled
});

View file

@ -10,7 +10,6 @@ Ox.CheckboxGroup <f:Ox.Element> CheckboxGroup Object
min <n|1> integer
width <n> integer, width in px
self <o> shared private variable
change <!> triggered when checked property changes
passes {checked, id, title}
@*/

View file

@ -9,7 +9,7 @@ Ox.ColorPicker <f:Ox.Element> ColorPicker Element
id <s> element id
value <s|0, 0, 0> rgb value
self <o> Shared private variable
change <!> triggered on change of value
change <!> triggered on change of value
@*/
Ox.ColorPicker = function(options, self) {

View file

@ -15,7 +15,7 @@ Ox.DateInput <f:Ox.Element> DateInput Element
weekday <n> width of weekday input element
year <n> width of year input element
self <o> Shared private variable
change <!> triggered on change of value
change <!> triggered on change of value
@*/
Ox.DateInput = function(options, self) {

View file

@ -12,7 +12,7 @@ Ox.DateTimeInput <f:Ox.Element> DateTimeInput Element
value <d> defautls to now
weekday <b|false> weekday
self <o> Shared private variable
change <!> triggered on change of value
change <!> triggered on change of value
@*/
Ox.DateTimeInput = function(options, self) {

View file

@ -98,7 +98,6 @@ Ox.Editable = function(options, self) {
width: width /*+ Ox.UI.SCROLLBAR_SIZE*/ + 'px'
});
}
//self.$input.find('input').css({width: width + 2})
/*
that.triggerEvent('change', {
value: event.value
@ -177,7 +176,7 @@ Ox.Editable = function(options, self) {
return self.options.type == 'input'
? self.options.value.replace(/ /g, '&nbsp;')
: Ox.parseHTML(self.options.value || '&nbsp;')
.replace(/<br\/?>$/, '<br/>&nbsp;');
.replace(/<br\/?>$/, '<br/>&nbsp;');
}
function formatValue() {

View file

@ -677,7 +677,7 @@ Ox.Filter = function(options, self) {
items: ['K', 'M', 'G', 'T'].map(function(prefix) {
return {id: prefix + title, title: prefix + title};
}),
width: 48
width: 48
}) : Ox.Label({
overlap: 'left',
textAlign: 'center',

View file

@ -356,7 +356,7 @@ Ox.Input = function(options, self) {
}
}
newLength = newValue.length;
//Ox.print('selectEnd', selectEnd)
if (self.options.autocompleteReplace) {
@ -484,8 +484,8 @@ Ox.Input = function(options, self) {
var cursor,
length,
regexp = type == 'float' ? new RegExp(
'(^' + (self.options.min < 0 ? '\\-?' : '') + '\\d+\\.?\\d' +
(self.options.decimals ? '{0,' + self.options.decimals + '}' : '*')
'(^' + (self.options.min < 0 ? '\\-?' : '') + '\\d+\\.?\\d'
+ (self.options.decimals ? '{0,' + self.options.decimals + '}' : '*')
+ '$)'
) : new RegExp('(^' + (self.options.min < 0 ? '\\-?' : '') + '\\d+)');
if (type == 'float') {

View file

@ -5,7 +5,6 @@ Ox.Label <f:Ox.Element> Label Object
(options) -> <f> Label Object
(options, self) -> <f> Label Object
options <o> Options object
@*/
Ox.Label = function(options, self) {

View file

@ -6,20 +6,20 @@ Ox.Range <f:Ox.Element> Range Object
(options, self) -> <f> Range Object
options <o> Options object
arrows <b> if true, show arrows
arrowStep <n> step when clicking arrows
arrowSymbols <a> arrow symbols, like ['minus', 'plus']
max <n> maximum value
min <n> minimum value
orientation <s> 'horizontal' or 'vertical'
step <n> step between values
size <n> width or height, in px
thumbSize <n> minimum width or height of thumb, in px
arrowStep <n> step when clicking arrows
arrowSymbols <a> arrow symbols, like ['minus', 'plus']
max <n> maximum value
min <n> minimum value
orientation <s> 'horizontal' or 'vertical'
step <n> step between values
size <n> width or height, in px
thumbSize <n> minimum width or height of thumb, in px
thumbValue <b> if true, display value on thumb
trackGradient <a> colors
trackGradient <a> colors
trackImages <s|[s]> one or multiple track background image URLs
trackStep <n> 0 (scroll here) or step when clicking track
value <n> initial value
valueNames <a> value names to display on thumb
trackStep <n> 0 (scroll here) or step when clicking track
value <n> initial value
valueNames <a> value names to display on thumb
self <o> shared private variable
change <!> triggered on change of the range
@*/

View file

@ -1,5 +1,5 @@
Ox.InfoList = function(options, self) {
self = self || {};
var that = Ox.Element({}, self)
.defaults({
@ -64,7 +64,7 @@ Ox.InfoList = function(options, self) {
info: {}
};
Ox.print('DATA -=-------', data)
var $icon = Ox.Element()
.css({
float: 'left',

View file

@ -72,13 +72,13 @@ Ox.List = function(options, self) {
.options(options || {})
.scroll(scroll);
that.$content.bindEvent({
that.$content.bindEvent({
mousedown: mousedown,
singleclick: singleclick,
doubleclick: doubleclick
});
if (self.options.draggable) {
that.$content.bindEvent({
that.$content.bindEvent({
dragstart: dragstart,
drag: drag,
dragpause: dragpause,
@ -87,7 +87,7 @@ Ox.List = function(options, self) {
dragend: dragend
});
} else if (self.options.sortable) {
that.$content.bindEvent({
that.$content.bindEvent({
dragstart: movestart,
drag: move,
dragend: moveend
@ -372,7 +372,7 @@ Ox.List = function(options, self) {
});
}
}
function drag(data) {
self.drag && that.triggerEvent('draganddrop', {
ids: self.drag.ids,
@ -887,7 +887,7 @@ Ox.List = function(options, self) {
clickable, editable;
if (pos > -1) {
if (
!data.metaKey && !data.shiftKey
!data.metaKey && !data.shiftKey
&& isSelected(pos) && self.selected.length > 1
) {
// click on one of multiple selected items

View file

@ -723,7 +723,7 @@ Ox.TextList = function(options, self) {
pos = getColumnPositionById(id);
self.options.columns[i].width = width;
self.columnWidths[pos] = width;
if (self.options.columnsVisible) {
if (self.options.columnsVisible) {
that.$head.$content.css({
width: (Ox.sum(self.columnWidths) + 2) + 'px'
});
@ -784,7 +784,7 @@ Ox.TextList = function(options, self) {
self.selectedColumn = getColumnIndexById(self.options.sort[0].key);
toggleSelected(self.options.columns[self.selectedColumn].id);
}
}
}
}
function updateOrder(id) {
@ -959,7 +959,7 @@ Ox.TextList = function(options, self) {
id = value;
}
$cell = getCell(id, key);
$cell && $cell.html(formatValue(key, value, that.$body.value(id)));
$cell && $cell.html(formatValue(key, value, that.$body.value(id)));
if (key == self.options.sort[0].key) {
// sort key has changed
that.$body.sort();

View file

@ -220,5 +220,5 @@ Ox.TreeList = function(options, self) {
};
return that;
};

View file

@ -521,7 +521,7 @@ Ox.ListMap = function(options, self) {
type: 'float'
}).hide()
]);
self.$placeForm = Ox.Form({
items: self.$placeFormItems,
width: 240

View file

@ -654,7 +654,7 @@ Ox.Map = function(options, self) {
}
function getMetersPerPixel() {
// m/px = m/deg * deg/px
// m/px = m/deg * deg/px
var degreesPerPixel = 360 / (Ox.MAP_TILE_SIZE * Math.pow(2, self.map.getZoom()));
return Ox.getMetersPerDegree(self.map.getCenter().lat()) * degreesPerPixel;
}
@ -883,10 +883,10 @@ Ox.Map = function(options, self) {
if (!self.isAsync) {
self.places.sort(function(a, b) {
var sort = {
a: a.selected ? Infinity :
bounds.contains(a.center) ? a.area : -Infinity,
b: b.selected ? Infinity :
bounds.contains(b.center) ? b.area : -Infinity,
a: a.selected ? Infinity
: bounds.contains(a.center) ? a.area : -Infinity,
b: b.selected ? Infinity
: bounds.contains(b.center) ? b.area : -Infinity,
};
return sort.b - sort.a;
}).forEach(function(place, i) {
@ -1434,7 +1434,7 @@ Ox.Map = function(options, self) {
that.removePlace = function() {
// fixme: removePlaceFromPlaces() ?
removePlace();
return that;
return that;
};
that.resizeMap = function() {

View file

@ -274,7 +274,7 @@ Ox.MapMarker = function(options) {
google.maps.event.addListener(that.marker, 'dragend', dragend);
return that;
};
/*@
remove <f> remove marker
() -> <f> remove marker from map, returns MapMarker

View file

@ -16,7 +16,7 @@ Ox.MapPlace <f> MapPlace Object
south <n|0>
type <s|''>
visible <b|false>
west <n|0>
west <n|0>
@*/
Ox.MapPlace = function(options) {
@ -34,7 +34,7 @@ Ox.MapPlace = function(options) {
south: 0,
type: '',
visible: false,
west: 0
west: 0
}, options);
var that = this;
@ -202,7 +202,7 @@ Ox.MapPlace = function(options) {
that.map.triggerEvent('changeplace', that);
return that;
};
/*@
undo <f> undo
@*/

View file

@ -119,5 +119,5 @@ Ox.MapRectangle = function(options, self) {
}
return that;
};

View file

@ -66,8 +66,8 @@ Ox.MapRectangleMarker = function(options, self) {
if (that.position.indexOf('e') > -1) {
that.place.east = lng;
}
Ox.print('west', that.place.west, 'east', that.place.east);
Ox.print('south', that.place.south, 'north', that.place.north);
//Ox.print('west', that.place.west, 'east', that.place.east);
//Ox.print('south', that.place.south, 'north', that.place.north);
that.place.update();
that.place.marker.update();
that.place.rectangle.update();

View file

@ -536,7 +536,7 @@ Ox.Menu = function(options, self) {
addItem <f>
@*/
that.addItem = function(item, position) {
};
/*@

View file

@ -170,12 +170,11 @@ Ox.SplitPanel = function(options, self) {
}
self.$resizebars[i == 0 ? 0 : 1].options({size: element.size});
}
});
}
/*@
isCollapsed <f> panel collapsed state
isCollapsed <f> panel collapsed state
(id) -> <b> id or position of panel, returns collapsed state
id <i> The element's id or position
@*/
@ -185,7 +184,7 @@ Ox.SplitPanel = function(options, self) {
};
/*@
repleaseElement <f> replace panel element
repleaseElement <f> replace panel element
(id, element) -> <f> replace element
id <s|i> The element's id or position
element <o> new element

View file

@ -172,7 +172,6 @@ Ox.BlockVideoTimeline = function(options, self) {
Ox.formatDuration(position)
})
.show(e.clientX, e.clientY);
} else {
self.$tooltip.hide();
}

View file

@ -97,8 +97,7 @@ Ox.SmallVideoTimeline = function(options, self) {
}
function getPosition(e) {
var position =
(
var position = (
(e.offsetX ? e.offsetX : e.clientX - $(e.target).offset().left) -
(self.options.type == 'player' ? 8 : 0)
) * self.options.duration / self.imageWidth;

View file

@ -275,7 +275,7 @@ Ox.VideoEditor = function(options, self) {
)
.bindEvent({
add: function(data) {
data.layer = layer.id;
data.layer = layer.id;
data['in'] = self.options['in'];
data.out = self.options.out;
that.triggerEvent('addannotation', data);
@ -440,7 +440,7 @@ Ox.VideoEditor = function(options, self) {
}
});
//.appendTo(self.$videobar);
if (self.options.posterFrameControls) {
self.$goToPosterButton = Ox.Button({
@ -598,7 +598,6 @@ Ox.VideoEditor = function(options, self) {
{id: 'smallText', title: 'Small', checked: true},
{id: 'mediumText', title: 'Medium'},
{id: 'largeText', title: 'Large'}
],
max: 2,
title: 'set',
@ -772,9 +771,9 @@ Ox.VideoEditor = function(options, self) {
function getSizes(scrollbarIsVisible) {
//Ox.print('getSizes', scrollbarIsVisible)
var scrollbarWidth = Ox.UI.SCROLLBAR_SIZE,
contentWidth = self.options.width -
(self.options.showAnnotations * self.options.annotationsSize) - 1 -
(scrollbarIsVisible ? scrollbarWidth : 0),
contentWidth = self.options.width
- (self.options.showAnnotations * self.options.annotationsSize) - 1
- (scrollbarIsVisible ? scrollbarWidth : 0),
height,
lines,
size = {
@ -1008,7 +1007,7 @@ Ox.VideoEditor = function(options, self) {
self.$player[0].togglePaused();
/* fixme
self.$player[0].options('paused') && that.triggerEvent('position', {
});
*/
}

View file

@ -238,7 +238,7 @@ Ox.VideoPanelPlayer = function(options, self) {
//self.$video.position(self.options.position);
self.$timeline.options({
position: self.options.position
});
});
}
function toggleAnnotations(data) {
@ -291,7 +291,7 @@ Ox.VideoPanelPlayer = function(options, self) {
/*@
toggleAnnotations <f> toggle annotations
() -> <o> toggle visibility of annotations
() -> <o> toggle visibility of annotations
@*/
that.toggleAnnotations = function() {
that.$element.toggle(1);