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> ...
# Properties --------------------------------------------------------------
array <a> My favorite array array <a> My favorite array
boolean <b> My favorite boolean value boolean <b> My favorite boolean value
date <d> My favorite date date <d> My favorite date
element <e> My favorite HTML element error <e> My favorite error
function <f> My favorite function
arguments <g> My favorite arguments
htmlelement <h> My favorite HTML element
nodelist <l> My favorite nodelist
number <n> My favorite number number <n> My favorite number
object <o> My favorite object object <o> My favorite object
regexp <r> My favorite regular expression regexp <r> My favorite regular expression
string <s> My favorite string 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() {
var favorites = {
array: [], array: [],
boolean: false, boolean: false,
date: new Date(0), date: new Date(),
element: document.createElement('a'), error: new Error(),
'function': function() {
My.triggerEvent(this, 'event');
},
arguments: (function() { return arguments; }()),
htmlelement: document.createElement('a'),
nodelist: document.getElementsByTagName('a'),
number: 0, number: 0,
object: {}, object: {},
regexp: new RegExp(''), regexp: new RegExp(),
string: '' 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',