update documentation example

This commit is contained in:
rolux 2012-06-02 11:21:54 +02:00
parent 0cefbe1997
commit 2b0b66d06d

View file

@ -19,55 +19,123 @@ section definition. Here, we mark a section named 'Primitives'.
*/ */
//@ Primitives //@ Primitives
//@ My.REQUEST_TIMEOUT <number> Request timeout, in seconds //@ My.REQUEST_TIMEOUT <number> Request timeout, in milliseconds
My.REQUEST_TIMEOUT = 60; My.REQUEST_TIMEOUT = 60000;
/*@ /*@
My.MAGIC_CONSTANT <number> Magic constant needed for HTTP requests My.MAGIC_CONSTANT <number> Magic constant, needed for HTTP requests
Please note that the value for `MAGIC_CONSTANT` is browser-dependent. Please note that the value for `MAGIC_CONSTANT` is browser-dependent.
*/ */
My.MAGIC_CONSTANT = navigator.userAgent.length % 2 == 0 ? 23 : 42; My.MAGIC_CONSTANT = navigator.userAgent.length % 2 == 0 ? 23 : 42;
//@ Objects //@ Objects
/*
*/
/*@ /*@
My.favorites <object> ... My.favorites <object> ...
array <a> My favorite array # Properties --------------------------------------------------------------
boolean <b> My favorite boolean value array <a> My favorite array
date <d> My favorite date boolean <b> My favorite boolean value
element <e> My favorite HTML element date <d> My favorite date
number <n> My favorite number error <e> My favorite error
object <o> My favorite object function <f> My favorite function
regexp <r> My favorite regular expression arguments <g> My favorite arguments
string <s> My favorite string htmlelement <h> My favorite HTML element
nodelist <l> My favorite nodelist
number <n> My favorite number
object <o> My favorite object
regexp <r> My favorite regular expression
string <s> My favorite string
undefined <u> Undefined is an all-time favorite
window <w> ...
other <+> ...
any <*> Favorite of the day
# Events -------------------------------------------------------------------
event <!> Fires when My.favorite['function'] is called
*/ */
My.favorites = { My.favorites = (function() {
array: [], var favorites = {
boolean: false, array: [],
date: new Date(0), boolean: false,
element: document.createElement('a'), date: new Date(),
number: 0, error: new Error(),
object: {}, 'function': function() {
regexp: new RegExp(''), My.triggerEvent(this, 'event');
string: '' },
arguments: (function() { return arguments; }()),
htmlelement: document.createElement('a'),
nodelist: document.getElementsByTagName('a'),
number: 0,
object: {},
regexp: new RegExp(),
string: '',
'undefined': void 0,
'window': window,
other: document
},
keys = Object.keys(favorites);
return Ox.extend(favorites, {any: favorites[keys[Ox.random(keys.length)]]});
}());
/*@
replace <array> ...
0 <regexp> ...
1 <string> replace
*/
My.HTMLUtils = {
entities: {
'"': '&quot;', '&': '&amp;', "'": '&apos;', '<': '&lt;', '>': '&gt;'
},
replace: {
namedEntity: [
new RegExp('(' + Ox.values(this.entities).join('|') + ')', 'g'),
function(match) {
return Ox.keyOf(this.entities, match);
}
],
numericEntity: [
/&#([0-9A-FX]+);/gi,
function(match, code) {
return Ox.char(
/^X/i.test(code)
? parseInt(code.slice(1), 16)
: parseInt(code, 10)
);
}
],
}
}; };
/*@ /*@
My.place <o> Default place object My.defaultPlace <o> Default place object
geometry <o>
bounds <o> ..
northEast <o>
lat <n>
lng <n>
southWest <o>
lat <n>
lng <n>
types <[s]>
name <o> Localized place names name <o> Localized place names
short <o> Short place name short <o> Short place name
de <s> Short German name de <s> Short German name
en <s> Short English name en <s> Short English name
fr <s> Short French name fr <s> Short French name
long <o> Long place name long <o> Long place name
de <s> Short German name de <s> Long German name
en <s> Short English name en <s> Long English name
fr <s> Short French name fr <s> Long French name
points <[o]> Points of interest points <[o]> Points of interest
lat <n> Latitude lat <n> Latitude
lng <n> Longitude lng <n> Longitude
@*/ @*/
My.place = { My.place = {
bounds: {
northEast: {lat: 0, lng: 0},
southWest: {lat: 0, lng: 0}
},
name: { name: {
short: { short: {
de: 'Brüssel', de: 'Brüssel',