more docs

This commit is contained in:
j 2011-05-16 12:49:48 +02:00
parent bdb8d98787
commit cc75e25415
42 changed files with 664 additions and 93 deletions

View file

@ -5,15 +5,15 @@ Ox.Resizebar <f:Ox.Element> Resizebar
(options) -> <f> Resizebar object (options) -> <f> Resizebar object
(options, self) -> <f> Resizebar object (options, self) -> <f> Resizebar object
options <o> Options object options <o> Options object
collapsed <b|false> collapsed <b|false> inital collapse state
collapsible <b|true> collapsible <b|true> collapse state can be changed
edge <s|left> edge <s|left> edge
elements <a|[]> elements <a|[]> elements of the bar
orientation <s|horizontal> orientation <s|horizontal> orientation, can be horizontal or vertical
panel <o|null> panel <o|null> panel object
resizeable <b|true> resizeable <b|true> can bar be resized
resize <a|[]> resize <a|[]> array with possible sizes
size <n|0> size <n|0> default size
self <o> Shared private variable self <o> Shared private variable
@*/ @*/
/** /**

View file

@ -7,7 +7,7 @@ Ox.App <f> Basic application instance that communicates with a JSON API
(options, self) -> <f> App object (options, self) -> <f> App object
options <o> Options object options <o> Options object
timeout <n> request timeout timeout <n> request timeout
type <s> 'GET' or 'POST' type <s> HTTP Request type, i.e. 'GET' or 'POST'
url <s> JSON API url url <s> JSON API url
self <o> Shared private variable self <o> Shared private variable
load <!> app loaded load <!> app loaded
@ -109,10 +109,19 @@ Ox.App = (function() {
}; };
} }
/*@
change <f> change key/value
(key, value) -> <u> currently not implemented
@*/
self.change = function(key, value) { self.change = function(key, value) {
}; };
/*@
options <f> get/set options, see Ox.getset
() -> <o> get options
(options) -> <o> update/set options
@*/
that.options = function() { that.options = function() {
return Ox.getset(self.options, Array.prototype.slice.call(arguments), self.change, that); return Ox.getset(self.options, Array.prototype.slice.call(arguments), self.change, that);
}; };

View file

@ -1,13 +1,13 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@ /*@
Ox.Clipboard <f> Basic clipboard handler Ox.Clipboard <o> Basic clipboard handler
() -> <o> Clipboard object copy <f> copy to clipbloard
(options) -> <o> Clipboard object (data) -> <u> set clipboard to data
(options, self) -> <o> Clipboard object paste <f> paste from clipbload
copy(data) <f> copy data to clipboard () -> <o> get clipboard data
paste <f> paste data from clipboard _print <f> debug function
options <o> Options object () -> <u> print clipboard contents to console
self <o> Shared private variable data <o> clipboard object
@*/ @*/
Ox.Clipboard = function() { Ox.Clipboard = function() {
var clipboard = {}; var clipboard = {};

View file

@ -5,7 +5,7 @@
// would append (length - 1)? // would append (length - 1)?
/*@ /*@
Ox.Container <f> Container Ox.Container <f> Container (depricated)
() -> <o> Container object () -> <o> Container object
(options) -> <o> Container object (options) -> <o> Container object
(options, self) -> <o> Container object (options, self) -> <o> Container object

View file

@ -4,6 +4,7 @@ Ox.DocPage <f> DocPage
(options) -> <o> DocPage object (options) -> <o> DocPage object
(options, self) -> <o> DocPage object (options, self) -> <o> DocPage object
options <o> Options object options <o> Options object
item <o> doc item
self <o> Shared private variable self <o> Shared private variable
@*/ @*/
Ox.DocPage = function(options, self) { Ox.DocPage = function(options, self) {

View file

@ -1,13 +1,9 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.Focus <o> Basic focus handler
@*/
Ox.Focus = function() { Ox.Focus = function() {
/***
Ox.Focus
Basic focus handler
Methods
blur(id) blur element
focus(id) focus element
focused() return id of focused element, or null
***/
var stack = []; var stack = [];
return { return {
_print: function() { _print: function() {
@ -17,6 +13,10 @@ Ox.Focus = function() {
$('.OxFocus').removeClass('OxFocus'); $('.OxFocus').removeClass('OxFocus');
stack = []; stack = [];
}, },
/*@
blur <f> blur element
(id) -> <u> blur element by id
@*/
blur: function(id) { blur: function(id) {
var index = stack.indexOf(id); var index = stack.indexOf(id);
if (index > -1 && index == stack.length - 1) { if (index > -1 && index == stack.length - 1) {
@ -28,6 +28,10 @@ Ox.Focus = function() {
Ox.print('blur', id, stack); Ox.print('blur', id, stack);
} }
}, },
/*@
focus <f> focus element
(id) -> <u> focus element by id
@*/
focus: function(id) { focus: function(id) {
var index = stack.indexOf(id); var index = stack.indexOf(id);
if (index == -1 || index < stack.length - 1) { if (index == -1 || index < stack.length - 1) {
@ -38,6 +42,10 @@ Ox.Focus = function() {
Ox.print('focus', id, stack); Ox.print('focus', id, stack);
} }
}, },
/*@
focused <f> return id of focused element, or null
() -> <s> get id of currently focused element
@*/
focused: function() { focused: function() {
return stack.length ? stack[stack.length - 1] : null; return stack.length ? stack[stack.length - 1] : null;
} }

View file

@ -32,6 +32,7 @@ Ox.LoadingIcon = function(options, self) {
}, 250); }, 250);
return that; return that;
}; };
/*@ /*@
stop <f> Stop loading animation stop <f> Stop loading animation
() -> <f> Loading Icon Element () -> <f> Loading Icon Element

View file

@ -1,22 +1,21 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
Ox.Checkbox = function(options, self) { /*@
Ox.Checkbox <f:Ox.Element> Checkbox Element
() -> <f> Checkbox Element
(options) -> <f> Checkbox Element
(options, self) -> <f> Checkbox Element
options <o> Options object
disabled <b> if true, checkbox is disabled
id <s> element id
group <b> if true, checkbox is part of a group
checked <b> if true, checkbox is checked
title <s> text on label
width <n> width in px
self <o> Shared private variable
change <!> triggered when checked property changes, passes {checked, id, title}
@*/
/** Ox.Checkbox = function(options, self) {
options
disabled boolean, if true, checkbox is disabled
id element id
group boolean, if true, checkbox is part of a group
checked boolean, if true, checkbox is checked
title string, text on label
width integer, width in px
methods:
toggleChecked function()
toggles checked property
returns that
events:
change triggered when checked property changes
passes {checked, id, title}
*/
var self = self || {}, var self = self || {},
that = new Ox.Element({}, self) that = new Ox.Element({}, self)
@ -91,10 +90,18 @@ Ox.Checkbox = function(options, self) {
} }
}; };
/*@
checked <f> get current checked state
() -> <b> returns self.options.checked
@*/
that.checked = function() { that.checked = function() {
return self.options.checked; return self.options.checked;
} }
/*@
toggleChecked <f> toggle current checked state
() -> <f> toggle state, returns Checkbox Element
@*/
that.toggleChecked = function() { that.toggleChecked = function() {
self.$button.toggleTitle(); self.$button.toggleTitle();
return that; return that;

View file

@ -1,4 +1,14 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.ColorInput <f:Ox.InputGroup> ColorInput Element
() -> <f> ColorInput Element
(options) -> <f> ColorInput Element
(options, self) -> <f> ColorInput Element
options <o> Options object
id <s> element id
value <s|0, 0, 0> rgb value
self <o> Shared private variable
@*/
Ox.ColorInput = function(options, self) { Ox.ColorInput = function(options, self) {
var self = $.extend(self || {}, { var self = $.extend(self || {}, {

View file

@ -1,4 +1,17 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.ColorPicker <f:Ox.Element> ColorPicker Element
() -> <f> ColorPicker Element
(options) -> <f> ColorPicker Element
(options, self) -> <f> ColorPicker Element
options <o> Options object
id <s> element id
value <s|0, 0, 0> rgb value
self <o> Shared private variable
change <!> triggered on change of value
@*/
Ox.ColorPicker = function(options, self) { Ox.ColorPicker = function(options, self) {
var self = self || {}, var self = self || {},

View file

@ -1,18 +1,19 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
Ox.DateInput = function(options, self) {
/** /*@
options: Ox.DateInput <f:Ox.Element> DateInput Element
format: 'short' () -> <f> DateInput Element
value: date value (options) -> <f> DateInput Element
weekday: false (options, self) -> <f> DateInput Element
width: { options <o> Options object
day: 32, format <s|short> format can be short, medium, long
month: options.format == 'long' ? 80 : (options.format == 'medium' ? 40 : 32), value <d> date value, defaults to now
weekday: options.format == 'long' ? 80 : 40, weekday <b|false> weekday
year: 48 width: <o> width object with day, month, weekday, year width
} self <o> Shared private variable
*/ change <!> triggered on change of value
@*/
Ox.DateInput = function(options, self) {
var self = $.extend(self || {}, { var self = $.extend(self || {}, {
options: $.extend({ options: $.extend({

View file

@ -1,4 +1,20 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.DateTimeInput <f:Ox.Element> DateTimeInput Element
() -> <f> DateTimeInput Element
(options) -> <f> DateTimeInput Element
(options, self) -> <f> DateTimeInput Element
options <o> Options object
ampm <b|false> false is 24h true is am/pm
format <s|short> options are short, medium, long
seconds <b|false> show seconds
value <d> defautls to now
weekday <b|false> weekday
self <o> Shared private variable
change <!> triggered on change of value
@*/
Ox.DateTimeInput = function(options, self) { Ox.DateTimeInput = function(options, self) {
var self = self || {}, var self = self || {},

View file

@ -1,11 +1,19 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
Ox.Filter = function(options, self) {
/*** /*@
Options: Ox.Filter <f:Ox.Element> Filter Element
Methods: () -> <f> Filter Element
Events: (options) -> <f> Filter Element
***/ (options, self) -> <f> Filter Element
options <o> Options object
findKeys <a|[]> keys
query <o> query object with conditions, operator
sortKeys <a|[]> keys to sort by
viewKeys <a|[]> visible keys
self <o> Shared private variable
@*/
Ox.Filter = function(options, self) {
var self = self || {}, var self = self || {},
that = new Ox.Element({}, self) that = new Ox.Element({}, self)

View file

@ -8,8 +8,8 @@ Ox.Form <f:Ox.Element> Form Object
options <o> Options object options <o> Options object
error <s> error error <s> error
id <s> id id <s> id
items <a> [] items <a|[]> []
submit <f> null submit <f|null> on submit function
self <o> shared private variable self <o> shared private variable
@*/ @*/

View file

@ -1,4 +1,19 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.FormElementGroup <f:Ox.Element> FormElementGroup Element
() -> <f> FormElementGroup Element
(options) -> <f> FormElementGroup Element
(options, self) -> <f> FormElementGroup Element
options <o> Options object
id <s> element id
elements <a|[]> elements in group
float <s|left> alignment
separators <a|[]> separators (not implemented)
width <n|0> group width
self <o> Shared private variable
@*/
Ox.FormElementGroup = function(options, self) { Ox.FormElementGroup = function(options, self) {
var self = self || {}, var self = self || {},

View file

@ -1,4 +1,16 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.FormItem <f:Ox.Element> FormItem Element, wrap form element with an error message
() -> <f> FormItem Element
(options) -> <f> FormItem Element
(options, self) -> <f> FormItem Element
options <o> Options object
element <o|null> element
error <s> error message
self <o> Shared private variable
@*/
Ox.FormItem = function(options, self) { Ox.FormItem = function(options, self) {
var self = self || {}, var self = self || {},
@ -15,10 +27,18 @@ Ox.FormItem = function(options, self) {
.addClass('OxFormMessage') .addClass('OxFormMessage')
.appendTo(that); .appendTo(that);
/*@
setMessage <f> set message
(message) -> <u> set message
@*/
that.setMessage = function(message) { that.setMessage = function(message) {
self.$message.html(message)[message !== '' ? 'show' : 'hide'](); self.$message.html(message)[message !== '' ? 'show' : 'hide']();
} }
/*@
value <f> get value
() -> <s> get value of wrapped element
@*/
that.value = function() { that.value = function() {
return self.options.element.value(); return self.options.element.value();
}; };

View file

@ -1,4 +1,14 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.OptionGroup <f> OptionGroup
(items, min, max, property) -> <f> OptionGroup
items <a> array of items
min <n> minimum number of selected items
max <n> maximum number of selected items
property <s|checked> property to check
@*/
Ox.OptionGroup = function(items, min, max, property) { Ox.OptionGroup = function(items, min, max, property) {
/* /*
@ -41,6 +51,10 @@ Ox.OptionGroup = function(items, min, max, property) {
return num; return num;
} }
/*@
[property] <f> returns an array with the positions of all checked item
() -> <a> returns checked items
@*/
this[property] = function() { this[property] = function() {
// returns an array with the positions of all checked item // returns an array with the positions of all checked item
var checked = []; var checked = [];
@ -52,6 +66,10 @@ Ox.OptionGroup = function(items, min, max, property) {
return checked; return checked;
}; };
/*@
init <f> init group
() -> <a> returns items
@*/
this.init = function() { this.init = function() {
var num = getNumber(), var num = getNumber(),
count = 0; count = 0;
@ -76,6 +94,10 @@ Ox.OptionGroup = function(items, min, max, property) {
return items; return items;
}; };
/*@
toggle <f> toggle options
(pos) -> <a> returns toggled state
@*/
this.toggle = function(pos) { this.toggle = function(pos) {
var last, var last,
num = getNumber(), num = getNumber(),

View file

@ -5,7 +5,13 @@ Ox.Picker <f:Ox.Element> Picker Object
(options) -> <f> Picker Object (options) -> <f> Picker Object
(options, self) -> <f> Picker Object (options, self) -> <f> Picker Object
options <o> Options object options <o> Options object
element <o|null> picker element
elementHeight <n|128> height
elemementWidth <n|256> width
id <s> picker id
overlap <s|none> select button overlap value
show <!> picker is shown
hide <!> picker is hidden
@*/ @*/
Ox.Picker = function(options, self) { Ox.Picker = function(options, self) {

View file

@ -1,4 +1,16 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.PlaceInput <f:Ox.FormElementGroup> PlaceInput Object
() -> <f> PlaceInput Object
(options) -> <f> PlaceInput Object
(options, self) -> <f> PlaceInput Object
options <o> Options object
id <s> element id
value <s|United States> default value of place input
self <o> shared private variable
@*/
Ox.PlaceInput = function(options, self) { Ox.PlaceInput = function(options, self) {
var self = $.extend(self || {}, { var self = $.extend(self || {}, {

View file

@ -1,4 +1,16 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.PlacePicker <f:Ox.Element> PlacePicker Object
() -> <f> PlacePicker Object
(options) -> <f> PlacePicker Object
(options, self) -> <f> PlacePicker Object
options <o> Options object
id <s> element id
value <s|United States> default value of place input
self <o> shared private variable
@*/
Ox.PlacePicker = function(options, self) { Ox.PlacePicker = function(options, self) {
var self = $.extend(self || {}, { var self = $.extend(self || {}, {

View file

@ -16,10 +16,12 @@ Ox.Range <f:Ox.Element> Range Object
thumbSize <n> minimum width or height of thumb, in px thumbSize <n> minimum width or height of thumb, in px
thumbValue <b> if true, display value on thumb thumbValue <b> if true, display value on thumb
trackGradient <a> colors trackGradient <a> colors
trackImages <s> or array one or multiple track background image URLs trackImages <s> or <a> one or multiple track background image URLs
trackStep <n> 0 (scroll here) or step when clicking track trackStep <n> 0 (scroll here) or step when clicking track
value <n> initial value value <n> initial value
valueNames <a> value names to display on thumb valueNames <a> value names to display on thumb
self <o> shared private variable
change <!> triggered on change of the range
@*/ @*/
Ox.Range = function(options, self) { Ox.Range = function(options, self) {

View file

@ -1,4 +1,26 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.Select <f:Ox.Element> Select Object
() -> <f> Select Object
(options) -> <f> Select Object
(options, self) -> <f> Select Object
options <o> Options object
id <s> element id
items <a|[]> items
max <n|1> minimum number of selected items
min <n|1> maximum number of selected items
overlap <s|'none'> can be none, left or right
selectable <b|true> is selectable
size <s|'medium'> size, can be small, medium, large
title <s|''> select title
type <s|'text'> can be 'text' or 'image'
width <s|n|'auto'> can be auto or width in pixels
self <o> shared private variable
click <!> on click event
change <!> on change event
@*/
Ox.Select = function(options, self) { Ox.Select = function(options, self) {
// fixme: selected item needs attribute "checked", not "selected" ... that's strange // fixme: selected item needs attribute "checked", not "selected" ... that's strange
@ -130,6 +152,10 @@ Ox.Select = function(options, self) {
}; };
/*@
selectItem <f> select item in group
() -> <o> returns object of selected items with id, title
@*/
that.selected = function() { that.selected = function() {
return $.map(/*self.checked*/self.optionGroup.checked(), function(v) { return $.map(/*self.checked*/self.optionGroup.checked(), function(v) {
return { return {
@ -139,6 +165,11 @@ Ox.Select = function(options, self) {
}); });
}; };
/*@
selectItem <f> select item in group
(id) -> <u> select item by id
id <s> item id
@*/
that.selectItem = function(id) { that.selectItem = function(id) {
//Ox.print('selectItem', id, 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( self.options.type == 'text' && self.$title.html(

View file

@ -1,4 +1,18 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.TimeInput <f:Ox.Element> TimeInput Object
() -> <f> TimeInput Object
(options) -> <f> TimeInput Object
(options, self) -> <f> TimeInput Object
options <o> Options object
ampm <b|false> 24h/ampm
seconds <b|false> show seconds
milliseconds <b|false> show milliseconds
value <d> value, defaults to now
self <o> shared private variable
@*/
Ox.TimeInput = function(options, self) { Ox.TimeInput = function(options, self) {
// fixme: seconds get set even if options.seconds is false // fixme: seconds get set even if options.seconds is false

View file

@ -1,4 +1,21 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.IconItem <f:Ox.Element> IconItem Object
() -> <f> IconItem Object
(options) -> <f> IconItem Object
(options, self) -> <f> IconItem Object
options <o> Options object
height <n|128> icon height
id <s> element id
info <s> icon info
size <n|128> icon size
title <s> title
width <n|128> icon width
url <s> icon url
self <o> shared private variable
@*/
Ox.IconItem = function(options, self) { Ox.IconItem = function(options, self) {
//Ox.print('IconItem', options, self) //Ox.print('IconItem', options, self)

View file

@ -1,4 +1,26 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.IconList <f:Ox.Element> IconList Object
() -> <f> IconList Object
(options) -> <f> IconList Object
(options, self) -> <f> IconList Object
options <o> Options object
centerSelection <b|false> scroll list so selection is always centered
draggable <b|true> can be dragged
id <s|''> element id
item <f|null> called with data, sort, size,
extends data with information needed for Ox.IconItem
items <f|null> items array or callback function
keys <a|[]> available item keys
max <n|-1> maximum selected selected items
min <n|0> minimum of selcted items
orientation <s|both> list orientation
selected <a|[]> array of selected items
size <n|128> list size
sort <a|[]> sort keys
self <o> shared private variable
@*/
Ox.IconList = function(options, self) { Ox.IconList = function(options, self) {
var self = self || {}, var self = self || {},
@ -81,6 +103,10 @@ Ox.IconList = function(options, self) {
}); });
} }
/*@
setOption <f> set key/value
(key, value) -> <u> set eky in options to value
@*/
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'items') { if (key == 'items') {
that.$element.options(key, value); that.$element.options(key, value);
@ -91,28 +117,53 @@ Ox.IconList = function(options, self) {
} }
} }
/*@
closePreview <f> close preview
() -> <u> close
@*/
that.closePreview = function() { that.closePreview = function() {
that.$element.closePreview(); that.$element.closePreview();
}; };
/*@
paste <f> paste to list
(data) -> <f> paste data, returns IconList
@*/
that.paste = function(data) { that.paste = function(data) {
that.$element.paste(data); that.$element.paste(data);
return that; return that;
}; };
/*@
reloadList <f> reload list
() -> <u> reload iconlist
@*/
that.reloadList = function() { that.reloadList = function() {
that.$element.reloadList(); that.$element.reloadList();
return that; return that;
}; };
/*@
scrollToSelection <f> set key/value
() -> <u> scroll list ot selection
@*/
that.scrollToSelection = function() { that.scrollToSelection = function() {
that.$element.scrollToSelection(); that.$element.scrollToSelection();
}; };
/*@
size <f> set key/value
() -> <n> get size of list
@*/
that.size = function() { that.size = function() {
that.$element.size(); that.$element.size();
}; };
/*@
sortList <f> sort list
(key, operator) -> <u> sort list by key with operator
operator <s> can be + / -
@*/
that.sortList = function(key, operator) { that.sortList = function(key, operator) {
self.options.sort = [{ self.options.sort = [{
key: key, key: key,
@ -122,6 +173,12 @@ Ox.IconList = function(options, self) {
that.$element.sortList(key, operator); that.$element.sortList(key, operator);
}; };
/*@
value <f> get/set value of item in list
(id) -> <o> get all data for item
(id, key) -> <s> get value of key of item with id
(id, key, value) -> <f> set value, returns IconList
@*/
that.value = function(id, key, value) { that.value = function(id, key, value) {
// fixme: make this accept id, {k: v, ...} // fixme: make this accept id, {k: v, ...}
if (arguments.length == 1) { if (arguments.length == 1) {

View file

@ -1,4 +1,20 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.ItemInput <f:Ox.Element> ItemInput Object
() -> <f> ItemInput Object
(options) -> <f> ItemInput Object
(options, self) -> <f> ItemInput Object
options <o> Options object
type <s|textarea> can be textare
value <s> default value
height <n|300> height
width <n|100> width
self <o> shared private variable
cancel <!> triggered if cancel button is pressed
save <!> triggered if save button is pressed
@*/
Ox.ItemInput = function(options, self) { Ox.ItemInput = function(options, self) {
var self = self || {}, var self = self || {},

View file

@ -27,7 +27,15 @@ Ox.List <f:Ox.Element> List Element
type <s|text> type <s|text>
unique <s|''> name of the key that acts as unique id unique <s|''> name of the key that acts as unique id
self <o> shared private variable self <o> shared private variable
add <!> item added
delete <!> item removed
copy <!> copy
paste <!> paste
movie <!> move item
load <!> list loaded
openpreview <!> preview of selected item opened
closepreview <!> preview closed
select <!> select item
@*/ @*/

View file

@ -1,4 +1,21 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.ListItem <f:Ox.Element> ListItem Object
() -> <f> ListItem Object
(options) -> <f> ListItem Object
(options, self) -> <f> ListItem Object
options <o> Options object
construct <f> construct function
data <o|{}> item data
draggable <b|false> can be dragged
position <n|0> item position
unique <s|''> unique key
self <o> shared private variable
cancel <!> triggered if cancel button is pressed
save <!> triggered if save button is pressed
@*/
Ox.ListItem = function(options, self) { Ox.ListItem = function(options, self) {
var self = self || {}, var self = self || {},

View file

@ -1,10 +1,25 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@ /*@
Ox.TextList <f:Ox.Element> TextList Object Ox.TextList <f:Ox.Element> TextList Object
() -> <f> TextList Object () -> <f> TextList Object
(options) -> <f> TextList Object (options) -> <f> TextList Object
(options, self) -> <f> TextList Object (options, self) -> <f> TextList Object
options <o> Options object options <o> Options object
columns <a|[]>
columnsMovable <b|false>
columnsRemovable <b|false>
columnsResizable <b|false>
columnsVisible <b|false>
columnWidth <a|[40, 800]>
id <s|''>
items <f|null> function() {} {sort, range, keys, callback} or array
max <n|-1>
min <n|0>
pageLength <n|100>
scrollbarVisible <b|false>
selected <a|[]>
sort <a|[]>
self <o> shared private variable self <o> shared private variable
@*/ @*/

View file

@ -6,6 +6,12 @@ Ox.ListMap <f:Ox.Element> ListMap Object
(options) -> <f> ListMap Object (options) -> <f> ListMap Object
(options, self) -> <f> ListMap Object (options, self) -> <f> ListMap Object
options <o> Options object options <o> Options object
addPlace <f|null>
height <n|256>
labels <b|false>
places <f|null>
selected <a|[]>
width <n|256>
self <o> shared private variable self <o> shared private variable
@*/ @*/
@ -349,6 +355,9 @@ Ox.ListMap = function(options, self) {
return val.toFixed(8); return val.toFixed(8);
} }
/*@
setOption <f> setOption
@*/
self.setOption = function(key, value) { self.setOption = function(key, value) {
Ox.print('ONCHANGE') Ox.print('ONCHANGE')
if (key == 'height' || key == 'width') { if (key == 'height' || key == 'width') {
@ -362,16 +371,25 @@ Ox.ListMap = function(options, self) {
} }
} }
/*@
focusList <f> focusList
@*/
that.focusList = function() { that.focusList = function() {
self.$list.gainFocus(); self.$list.gainFocus();
return that; return that;
} }
/*@
reloadList <f> reloadList
@*/
that.reloadList = function() { that.reloadList = function() {
self.$list.reloadList(); self.$list.reloadList();
return that; return that;
} }
/*@
resizeMap <f> resizeMap
@*/
that.resizeMap = function() { that.resizeMap = function() {
Ox.print('Ox.ListMap.resizeMap()') Ox.print('Ox.ListMap.resizeMap()')
self.$map.resizeMap(); self.$map.resizeMap();

View file

@ -6,20 +6,16 @@ Ox.MapImage <f:Ox.Element> MapImage Object
(options) -> <f> MapImage Object (options) -> <f> MapImage Object
(options, self) -> <f> MapImage Object (options, self) -> <f> MapImage Object
options <o> Options object options <o> Options object
height <n|360> image height (px)
places <a|o|[]> array of either names (''), points ([0, 0]),
or objects ({name, point, highlight})
type <s|satellite> map type ('hybrid', 'roadmap', 'satellite', 'terrain')
width <n|640> image width (px)
self <o> shared private variable self <o> shared private variable
@*/ @*/
Ox.MapImage = function(options, self) { Ox.MapImage = function(options, self) {
/**
options
height image height (px)
places array of either names (''), points ([0, 0]),
or objects ({name, point, highlight})
type map type ('hybrid', 'roadmap', 'satellite', 'terrain')
width image width (px)
*/
var self = self || {}, var self = self || {},
that = new Ox.Element('<img>', self) that = new Ox.Element('<img>', self)
.defaults({ .defaults({

View file

@ -1,5 +1,15 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapMarker <f> MapMarker Object
(options) -> <f> MapMarker Object
options <o> Options object
color <a|[255, 0, 0]> marker color
map <o|null> map
place <o|null> place
size <n|16> size
@*/
Ox.MapMarker = function(options) { Ox.MapMarker = function(options) {
options = Ox.extend({ options = Ox.extend({
@ -150,33 +160,56 @@ Ox.MapMarker = function(options) {
} }
} }
/*@
add <f> add to map
() -> <f> add to map, returns MapMarker
@*/
that.add = function() { that.add = function() {
that.marker.setMap(that.map.map); that.marker.setMap(that.map.map);
google.maps.event.addListener(that.marker, 'click', click); google.maps.event.addListener(that.marker, 'click', click);
return that; return that;
}; };
/*@
edit <f> edit marker
() -> <f> edit marker, returns MapMarker
@*/
that.edit = function() { that.edit = function() {
setOptions(); setOptions();
google.maps.event.addListener(that.marker, 'dragstart', dragstart); google.maps.event.addListener(that.marker, 'dragstart', dragstart);
google.maps.event.addListener(that.marker, 'drag', drag); google.maps.event.addListener(that.marker, 'drag', drag);
google.maps.event.addListener(that.marker, 'dragend', dragend); google.maps.event.addListener(that.marker, 'dragend', dragend);
return that;
}; };
/*@
remove <f> remove marker
() -> <f> remove marker from map, returns MapMarker
@*/
that.remove = function() { that.remove = function() {
that.marker.setMap(null); that.marker.setMap(null);
google.maps.event.clearListeners(that.marker); google.maps.event.clearListeners(that.marker);
return that; return that;
}; };
/*@
submit <f> submit marker
() -> <f> clear edit listeners, returns MapMarker
@*/
that.submit = function() { that.submit = function() {
google.maps.event.clearListeners(that.marker, 'dragstart'); google.maps.event.clearListeners(that.marker, 'dragstart');
google.maps.event.clearListeners(that.marker, 'drag'); google.maps.event.clearListeners(that.marker, 'drag');
google.maps.event.clearListeners(that.marker, 'dragend'); google.maps.event.clearListeners(that.marker, 'dragend');
return that;
} }
/*@
update <f> update marker
() -> <f> update marker, returns MapMarker
@*/
that.update = function() { that.update = function() {
setOptions(); setOptions();
return that;
} }
return that; return that;

View file

@ -1,5 +1,15 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapMarkerImage <f:google.maps.MarkerImage> MapMarkerImage Object
(options) -> <f> google.maps.MarkerImage
options <o> Options object
color <a|[255, 0, 0]> marker color
mode <s|normal> can be: normal, selected, editing
size <n|16> size
type <s|place> can be: place, result, rectangle
@*/
Ox.MapMarkerImage = (function() { Ox.MapMarkerImage = (function() {
var cache = {}; var cache = {};

View file

@ -1,5 +1,24 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapPlace <f> MapPlace Object
(options) -> <f> MapPlace Object
options <o> Options object
east <n|0>
editing <b|false>
geoname <s|''>
map <o|null>
markerColor <a|[255> 0> 0]>
markerSize <n|16>
name <s|''>
north <n|0>
selected <b|false>
south <n|0>
type <a|[]>
visible <b|false>
west <n|0>
@*/
Ox.MapPlace = function(options) { Ox.MapPlace = function(options) {
options = Ox.extend({ options = Ox.extend({
@ -70,12 +89,18 @@ Ox.MapPlace = function(options) {
return that.map.options('editable') && that.editable; return that.map.options('editable') && that.editable;
} }
/*@
add <f> add
@*/
that.add = function() { that.add = function() {
that.visible = true; that.visible = true;
that.marker.add(); that.marker.add();
return that; return that;
}; };
/*@
cancel <f> cancel
@*/
that.cancel = function() { that.cancel = function() {
if (editable()) { if (editable()) {
that.undo(); that.undo();
@ -86,10 +111,16 @@ Ox.MapPlace = function(options) {
return that; return that;
}; };
/*@
crossesDateline <f> crossesDateline
@*/
that.crossesDateline = function() { that.crossesDateline = function() {
return that.west > that.east; return that.west > that.east;
} }
/*@
deselect <f> dselect
@*/
that.deselect = function() { that.deselect = function() {
that.editing && that.submit(); that.editing && that.submit();
that.selected = false; that.selected = false;
@ -98,6 +129,9 @@ Ox.MapPlace = function(options) {
return that; return that;
}; };
/*@
edit <f> edit
@*/
that.edit = function() { that.edit = function() {
if (editable()) { if (editable()) {
that.editing = true; that.editing = true;
@ -113,6 +147,9 @@ Ox.MapPlace = function(options) {
return that; return that;
} }
/*@
remove <f> remove
@*/
that.remove = function() { that.remove = function() {
that.editing && that.submit(); that.editing && that.submit();
that.selected && that.deselect(); that.selected && that.deselect();
@ -121,6 +158,9 @@ Ox.MapPlace = function(options) {
return that; return that;
}; };
/*@
select <f> select
@*/
that.select = function() { that.select = function() {
that.selected = true; that.selected = true;
!that.visible && that.add(); !that.visible && that.add();
@ -129,6 +169,9 @@ Ox.MapPlace = function(options) {
return that; return that;
}; };
/*@
submit <f> submit
@*/
that.submit = function() { that.submit = function() {
if (editable()) { if (editable()) {
that.editing = false; that.editing = false;
@ -138,11 +181,17 @@ Ox.MapPlace = function(options) {
return that; return that;
}; };
/*@
update <f> update
@*/
that.update = function() { that.update = function() {
update(); update();
return that; return that;
}; };
/*@
undo <f> undo
@*/
that.undo = function() { that.undo = function() {
if (editable()) { if (editable()) {
Ox.forEach(that.original, function(v, k) { Ox.forEach(that.original, function(v, k) {

View file

@ -1,4 +1,16 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapRectangle <f> MapRectangle Object
() -> <f> MapRectangle Object
(options) -> <f> MapRectangle Object
(options, self) -> <f> MapRectangle Object
options <o> Options object
map <o|null> map
place <o|null> place
self <o> shared private variable
@*/
Ox.MapRectangle = function(options, self) { Ox.MapRectangle = function(options, self) {
var options = Ox.extend({ var options = Ox.extend({
@ -11,10 +23,16 @@ Ox.MapRectangle = function(options, self) {
that[key] = val; that[key] = val;
}); });
/*@
rectangle <f> google.maps.Rectangle
@*/
that.rectangle = new google.maps.Rectangle({ that.rectangle = new google.maps.Rectangle({
clickable: true, clickable: true,
bounds: that.place.bounds, bounds: that.place.bounds,
}); });
/*@
markers <a> array of markers
@*/
that.markers = Ox.map(that.place.points, function(point, position) { that.markers = Ox.map(that.place.points, function(point, position) {
return new Ox.MapRectangleMarker({ return new Ox.MapRectangleMarker({
map: that.map, map: that.map,
@ -48,12 +66,18 @@ Ox.MapRectangle = function(options, self) {
}) })
} }
/*@
add <f> add
@*/
that.add = function() { that.add = function() {
that.rectangle.setMap(that.map.map); that.rectangle.setMap(that.map.map);
google.maps.event.addListener(that.rectangle, 'click', click); google.maps.event.addListener(that.rectangle, 'click', click);
return that; return that;
}; };
/*@
deselect <f> deselect
@*/
that.deselect = function() { that.deselect = function() {
setOptions(); setOptions();
Ox.print('MARKERS', that.markers) Ox.print('MARKERS', that.markers)
@ -62,12 +86,18 @@ Ox.MapRectangle = function(options, self) {
}); });
}; };
/*@
remove <f> remove
@*/
that.remove = function() { that.remove = function() {
that.rectangle.setMap(null); that.rectangle.setMap(null);
google.maps.event.clearListeners(that.rectangle); google.maps.event.clearListeners(that.rectangle);
return that return that
} }
/*@
select <f> select
@*/
that.select = function() { that.select = function() {
setOptions(); setOptions();
Ox.forEach(that.markers, function(marker) { Ox.forEach(that.markers, function(marker) {
@ -75,6 +105,9 @@ Ox.MapRectangle = function(options, self) {
}); });
}; };
/*@
update <f> udpate
@*/
that.update = function() { that.update = function() {
that.rectangle.setOptions({ that.rectangle.setOptions({
bounds: that.place.bounds bounds: that.place.bounds

View file

@ -1,5 +1,17 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@
Ox.MapRectangleMarker <f> MapRectangleMarker Object
() -> <f> MapRectangleMarker Object
(options) -> <f> MapRectangleMarker Object
(options, self) -> <f> MapRectangleMarker Object
options <o> Options object
map <o|null> map
place <o|null> place
position <s|''>
self <o> shared private variable
@*/
Ox.MapRectangleMarker = function(options, self) { Ox.MapRectangleMarker = function(options, self) {
options = Ox.extend({ options = Ox.extend({
@ -73,6 +85,9 @@ Ox.MapRectangleMarker = function(options, self) {
} }
} }
/*@
add <f> add
@*/
that.add = function() { that.add = function() {
that.marker.setMap(that.map.map); that.marker.setMap(that.map.map);
google.maps.event.addListener(that.marker, 'dragstart', dragstart); google.maps.event.addListener(that.marker, 'dragstart', dragstart);
@ -80,11 +95,17 @@ Ox.MapRectangleMarker = function(options, self) {
google.maps.event.addListener(that.marker, 'dragend', dragend); google.maps.event.addListener(that.marker, 'dragend', dragend);
}; };
/*@
remove <f> remove
@*/
that.remove = function() { that.remove = function() {
that.marker.setMap(null); that.marker.setMap(null);
google.maps.event.clearListeners(that.marker); google.maps.event.clearListeners(that.marker);
}; };
/*@
update <f> update
@*/
that.update = function() { that.update = function() {
that.marker.setOptions({ that.marker.setOptions({
position: that.place.points[that.position] position: that.place.points[that.position]

View file

@ -6,9 +6,9 @@ Ox.MainMenu <f:Ox.Bar> MainMenu Object
(options) -> <f> MainMenu Object (options) -> <f> MainMenu Object
(options, self) -> <f> MainMenu Object (options, self) -> <f> MainMenu Object
options <o> Options object options <o> Options object
extras <a> [] extras <a|[]> extra menus
menus <a> [] menus <a|[]> submenus
size <s> medium size <s|medium> can be small, medium, large
self <o> shared private variable self <o> shared private variable
@*/ @*/
@ -117,6 +117,9 @@ Ox.MainMenu = function(options, self) {
}; };
/*@
checkItem <f> checkItem
@*/
that.checkItem = function(id) { that.checkItem = function(id) {
var ids = id.split('_'), var ids = id.split('_'),
itemId = ids.pop(), itemId = ids.pop(),
@ -124,12 +127,18 @@ Ox.MainMenu = function(options, self) {
that.getMenu(menuId).checkItem(itemId); that.getMenu(menuId).checkItem(itemId);
}; };
/*@
disableItem <f> disableItem
@*/
that.disableItem = function(id) { that.disableItem = function(id) {
that.getItem(id).options({ that.getItem(id).options({
disabled: true disabled: true
}); });
}; };
/*@
enableItem <f> enableItem
@*/
that.enableItem = function(id) { that.enableItem = function(id) {
Ox.print('ENABLE ITEM', id) Ox.print('ENABLE ITEM', id)
that.getItem(id).options({ that.getItem(id).options({
@ -137,6 +146,9 @@ Ox.MainMenu = function(options, self) {
}); });
}; };
/*@
getItem <f> getItem
@*/
that.getItem = function(id) { that.getItem = function(id) {
var ids = id.split('_'), var ids = id.split('_'),
item; item;
@ -152,6 +164,9 @@ Ox.MainMenu = function(options, self) {
return item; return item;
}; };
/*@
getMenu <f> getMenu
@*/
that.getMenu = function(id) { that.getMenu = function(id) {
var ids = id.split('_'), var ids = id.split('_'),
menu; menu;
@ -173,18 +188,27 @@ Ox.MainMenu = function(options, self) {
}; };
/*@
selectNextMenu <f> selectNextMenu
@*/
that.selectNextMenu = function() { that.selectNextMenu = function() {
if (self.selected < self.options.menus.length - 1) { if (self.selected < self.options.menus.length - 1) {
clickTitle(self.selected + 1); clickTitle(self.selected + 1);
} }
}; };
/*@
selectPreviousMenu <f> selectPreviousMenu
@*/
that.selectPreviousMenu = function() { that.selectPreviousMenu = function() {
if (self.selected) { if (self.selected) {
clickTitle(self.selected - 1); clickTitle(self.selected - 1);
} }
}; };
/*@
uncheckItem <f> uncheckItem
@*/
that.uncheckItem = function(id) { that.uncheckItem = function(id) {
that.getItem(id).options({ that.getItem(id).options({
checked: false checked: false

View file

@ -658,21 +658,21 @@ Ox.print(options)
}; };
/*@ /*@
removeItem <f> removeItem <f> removeItem
@*/ @*/
that.removeItem = function() { that.removeItem = function() {
}; };
/*@ /*@
selectFirstItem <f> selectFirstItem <f> selectFirstItem
@*/ @*/
that.selectFirstItem = function() { that.selectFirstItem = function() {
selectNextItem(); selectNextItem();
}; };
/*@ /*@
showMenu <f> showMenu <f> showMenu
() -> <f> Menu Object () -> <f> Menu Object
@*/ @*/
that.showMenu = function() { that.showMenu = function() {
@ -722,7 +722,7 @@ Ox.print(options)
}; };
/*@ /*@
toggelMenu <f> toggelMenu <f> toggleMenu
@*/ @*/
that.toggleMenu = function() { that.toggleMenu = function() {
that.is(':hidden') ? that.showMenu() : that.hideMenu(); that.is(':hidden') ? that.showMenu() : that.hideMenu();

View file

@ -5,6 +5,17 @@ Ox.MenuItem <f:Ox.Element> MenuItem Object
(options) -> <f> MenuItem Object (options) -> <f> MenuItem Object
(options, self) -> <f> MenuItem Object (options, self) -> <f> MenuItem Object
options <o> Options object options <o> Options object
bind <a|[]> fixme: what's this?
checked <f|null>
disabled <b|false>
group <s|''>
icon <s|''> icon
id <s|''> id
items <a|[]> items
keyboard <s|''> keyboard
menu <o|null> menu
position <n|0> position
title <a|[]> title
self <o> shared private variable self <o> shared private variable
@*/ @*/
@ -90,6 +101,9 @@ Ox.MenuItem = function(options, self) {
}; };
} }
/*@
setOption <f> setOption
@*/
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'checked') { if (key == 'checked') {
that.$status.html(value ? Ox.UI.symbols.check : '') that.$status.html(value ? Ox.UI.symbols.check : '')
@ -105,6 +119,9 @@ Ox.MenuItem = function(options, self) {
// toggle id and title // toggle id and title
}; };
/*@
toggelChecked <f> toggleChecked
@*/
that.toggleChecked = function() { that.toggleChecked = function() {
that.options({ that.options({
checked: !self.options.checked checked: !self.options.checked
@ -115,6 +132,9 @@ Ox.MenuItem = function(options, self) {
}; };
/*@
toggelTitle <f> toggleTitle
@*/
that.toggleTitle = function() { that.toggleTitle = function() {
//Ox.print('s.o.t', self.options.title) //Ox.print('s.o.t', self.options.title)
that.options({ that.options({

View file

@ -1,11 +1,15 @@
// vim: et:ts=4:sw=4:sts=4:ft=js // vim: et:ts=4:sw=4:sts=4:ft=js
/*@ /*@
Ox.CollapsePanel <f:Ox.Element> CollapsePanel Object Ox.CollapsePanel <f:Ox.Panel> CollapsePanel Object
() -> <f> CollapsePanel Object () -> <f> CollapsePanel Object
(options) -> <f> CollapsePanel Object (options) -> <f> CollapsePanel Object
(options, self) -> <f> CollapsePanel Object (options, self) -> <f> CollapsePanel Object
options <o> Options object options <o> Options object
collapsed <b|false> collapsed state
extras <a|[]> panel extras
size <n|16> size
title <s> title
self <o> shared private variable self <o> shared private variable
@*/ @*/
@ -76,6 +80,10 @@ Ox.CollapsePanel = function(options, self) {
collapsed: self.options.collapsed collapsed: self.options.collapsed
}); });
} }
/*@
setOption <f> setOption
(key, value) -> <u> set key to value
@*/
self.setOption = function(key, value) { self.setOption = function(key, value) {
if (key == 'collapsed') { if (key == 'collapsed') {
@ -83,7 +91,11 @@ Ox.CollapsePanel = function(options, self) {
$title.html(self.options.title); $title.html(self.options.title);
} }
}; };
that.update = function() { // fixme: used anywhere?
/*@
update <f> update // fixme: used anywhere?
@*/
that.update = function() {
self.options.collapsed && that.$content.css({ self.options.collapsed && that.$content.css({
marginTop: -that.$content.height() marginTop: -that.$content.height()
}); });

View file

@ -6,6 +6,11 @@ Ox.AnnotationPanel <f:Ox.Element> AnnotationPanel Object
(options) -> <f> AnnotationPanel Object (options) -> <f> AnnotationPanel Object
(options, self) -> <f> AnnotationPanel Object (options, self) -> <f> AnnotationPanel Object
options <o> Options object options <o> Options object
id <s> id
items <a|[]> items
titles <s> title
type <s|text> panel type
width <n|0>
self <o> shared private variable self <o> shared private variable
@*/ @*/
@ -109,6 +114,9 @@ Ox.AnnotationPanel = function(options, self) {
} }
/*@
addItem <f> addItem
@*/
that.addItem = function(item) { that.addItem = function(item) {
var pos = 0; var pos = 0;
self.options.items.splice(pos, 0, item); self.options.items.splice(pos, 0, item);
@ -116,9 +124,16 @@ Ox.AnnotationPanel = function(options, self) {
self.$annotations.editItem(pos); self.$annotations.editItem(pos);
} }
/*@
removeItems <f> removeItems
@*/
that.removeItems = function(ids) { that.removeItems = function(ids) {
self.$annotations.removeItems(ids); self.$annotations.removeItems(ids);
} }
/*@
deselectItems <f> deselectItems
@*/
that.deselectItems = function() { that.deselectItems = function() {
if(self.$annotations.options('selected')) if(self.$annotations.options('selected'))
self.$annotations.options('selected',[]); self.$annotations.options('selected',[]);

View file

@ -1,3 +1,5 @@
// vim: et:ts=4:sw=4:sts=4:ft=js
/*@ /*@
Ox.VideoPlayer <f> Generic Video Player Ox.VideoPlayer <f> Generic Video Player
(options, self) -> <o> Video Player (options, self) -> <o> Video Player