From b1b3be9352df1c5d1d5dd4536750537b0f596890 Mon Sep 17 00:00:00 2001 From: Bryan Berry Date: Wed, 14 Oct 2009 06:41:32 +0000 Subject: updates jsdocs in docs/ --- diff --git a/docs/files.html b/docs/files.html index 06584aa..c9de086 100755 --- a/docs/files.html +++ b/docs/files.html @@ -186,33 +186,31 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • +
  • Karma
  • -
  • jQueryanonymous-KGraphic
  • +
  • Karma#geometry
  • -
  • jQueryanonymous-KGroup
  • +
  • Karma#graphics
  • -
  • jQueryanonymous-KImage
  • +
  • Karma#math
  • -
  • jQueryanonymous-KMedia
  • +
  • Karma.KGraphic
  • -
  • jQueryanonymous-KObject
  • +
  • Karma.KGroup
  • -
  • jQueryanonymous-KRectangle
  • +
  • Karma.KImage
  • -
  • jQueryanonymous-KShape
  • +
  • Karma.KMedia
  • -
  • jQueryanonymous-KSound
  • +
  • Karma.KObject
  • -
  • jQueryanonymous-KSurface
  • +
  • Karma.KRectangle
  • -
  • Karma
  • +
  • Karma.KShape
  • -
  • Karma#geometry
  • - -
  • Karma#graphics
  • +
  • Karma.KSound
  • -
  • Karma#math
  • +
  • Karma.KSurface

  • @@ -223,7 +221,7 @@ ul.inheritsList
    -

    jquery.karma.js

    +

    jquery.karma.js

    Contains karma library
    @@ -245,7 +243,7 @@ Contains karma library
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:34:17 GMT-0700 (PDT)
    \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index f3dbfec..2f7dc13 100755 --- a/docs/index.html +++ b/docs/index.html @@ -186,33 +186,31 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • +
  • Karma
  • -
  • jQueryanonymous-KGraphic
  • +
  • Karma#geometry
  • -
  • jQueryanonymous-KGroup
  • +
  • Karma#graphics
  • -
  • jQueryanonymous-KImage
  • +
  • Karma#math
  • -
  • jQueryanonymous-KMedia
  • +
  • Karma.KGraphic
  • -
  • jQueryanonymous-KObject
  • +
  • Karma.KGroup
  • -
  • jQueryanonymous-KRectangle
  • +
  • Karma.KImage
  • -
  • jQueryanonymous-KShape
  • +
  • Karma.KMedia
  • -
  • jQueryanonymous-KSound
  • +
  • Karma.KObject
  • -
  • jQueryanonymous-KSurface
  • +
  • Karma.KRectangle
  • -
  • Karma
  • +
  • Karma.KShape
  • -
  • Karma#geometry
  • +
  • Karma.KSound
  • -
  • Karma#graphics
  • - -
  • Karma#math
  • +
  • Karma.KSurface

  • @@ -229,86 +227,80 @@ ul.inheritsList
    -

    jQuery

    +

    Karma


    -

    jQueryanonymous-KGraphic

    - General methods for any Graphic object +

    Karma#geometry

    + Geometry functions.

    -

    jQueryanonymous-KGroup

    - An object that collects multiple KGraphic objects +

    Karma#graphics

    + Graphics functions.

    -

    jQueryanonymous-KImage

    - General methods for any Image object +

    Karma#math

    + Math functions.

    -

    jQueryanonymous-KMedia

    +

    Karma.KGraphic

    General methods for any Graphic object

    -

    jQueryanonymous-KObject

    - The basic Karma object -
    -
    - -
    -

    jQueryanonymous-KRectangle

    - General methods for a rectangle object +

    Karma.KGroup

    + An object that collects multiple KGraphic objects

    -

    jQueryanonymous-KShape

    - General methods for any Shape object +

    Karma.KImage

    + General methods for any Image object

    -

    jQueryanonymous-KSound

    - General methods for any Sound object +

    Karma.KMedia

    + General methods for any Graphic object

    -

    jQueryanonymous-KSurface

    - KSurface class +

    Karma.KObject

    + The basic Karma object

    -

    Karma

    - Represents a Karma (master) object. +

    Karma.KRectangle

    + General methods for a rectangle object

    -

    Karma#geometry

    - Geometry functions. +

    Karma.KShape

    + General methods for any Shape object

    -

    Karma#graphics

    - Graphics functions. +

    Karma.KSound

    + General methods for any Sound object

    -

    Karma#math

    - Math functions. +

    Karma.KSurface

    + KSurface class

    @@ -316,7 +308,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:34:17 GMT-0700 (PDT)
    \ No newline at end of file diff --git a/docs/jsdoc/files.html b/docs/jsdoc/files.html deleted file mode 100755 index 06584aa..0000000 --- a/docs/jsdoc/files.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - JsDoc Reference - File Index - - - - - - - - -
    -
    Class Index -| File Index
    -
    -

    Classes

    - -
    -
    - -
    -

    File Index

    - - -
    -

    jquery.karma.js

    - -Contains karma library -
    - -
    Author:
    -
    Felipe Lopez Toledo
    - - -
    Version:
    -
    0.1
    - - - -
    -
    -
    - - -
    -
    - - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) -
    - - \ No newline at end of file diff --git a/docs/jsdoc/index.html b/docs/jsdoc/index.html deleted file mode 100755 index f3dbfec..0000000 --- a/docs/jsdoc/index.html +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - JsDoc Reference - Index - - - - - - - - -
    -
    Class Index -| File Index
    -
    -

    Classes

    - -
    -
    - -
    -

    Class Index

    - - -
    -

    _global_

    - -
    -
    - -
    -

    jQuery

    - -
    -
    - -
    -

    jQueryanonymous-KGraphic

    - General methods for any Graphic object -
    -
    - -
    -

    jQueryanonymous-KGroup

    - An object that collects multiple KGraphic objects -
    -
    - -
    -

    jQueryanonymous-KImage

    - General methods for any Image object -
    -
    - -
    -

    jQueryanonymous-KMedia

    - General methods for any Graphic object -
    -
    - -
    -

    jQueryanonymous-KObject

    - The basic Karma object -
    -
    - -
    -

    jQueryanonymous-KRectangle

    - General methods for a rectangle object -
    -
    - -
    -

    jQueryanonymous-KShape

    - General methods for any Shape object -
    -
    - -
    -

    jQueryanonymous-KSound

    - General methods for any Sound object -
    -
    - -
    -

    jQueryanonymous-KSurface

    - KSurface class -
    -
    - -
    -

    Karma

    - Represents a Karma (master) object. -
    -
    - -
    -

    Karma#geometry

    - Geometry functions. -
    -
    - -
    -

    Karma#graphics

    - Graphics functions. -
    -
    - -
    -

    Karma#math

    - Math functions. -
    -
    - - -
    -
    - - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) -
    - - \ No newline at end of file diff --git a/docs/jsdoc/symbols/Karma#geometry.html b/docs/jsdoc/symbols/Karma#geometry.html deleted file mode 100755 index 23c80a1..0000000 --- a/docs/jsdoc/symbols/Karma#geometry.html +++ /dev/null @@ -1,518 +0,0 @@ - - - - - - - JsDoc Reference - Karma#geometry - - - - - - - - - - - -
    - -
    Class Index -| File Index
    -
    -

    Classes

    - -
    - -
    - -
    - -

    - - Namespace Karma#geometry -

    - - -

    - - - Geometry functions. - - -
    Defined in: jquery.karma.js. - -

    - - - - - - - - - - - - - - - - - -
    Namespace Summary
    Constructor AttributesConstructor Name and Description
      - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Method Summary
    Method AttributesMethod Name and Description
    <static>   -
    Karma#geometry.distance(Point, Point) -
    -
    Gets the Euclidian (ordinary) distance between 2 points.
    -
    <static>   -
    Karma#geometry.distance2(Point, Point) -
    -
    Gets the square of the Euclidian (ordinary) distance between 2 points.
    -
    <static>   -
    Karma#geometry.radians(angle) -
    -
    Converts a value from degrees to radians.
    -
    - - - - - - - - - -
    -
    - Namespace Detail -
    - -
    - Karma#geometry -
    - -
    - - -
    - - - - - - - - - - - - -
    - - - - - - - -
    - Method Detail -
    - - -
    <static> - - {Number} - Karma#geometry.distance(Point, Point) - -
    -
    - Gets the Euclidian (ordinary) distance between 2 points.
    - Warning: It's slower than distance2 function - - -
    - - - - -
    -
    Parameters:
    - -
    - {Number} Point - -
    -
    Point No. 0
    - -
    - {Number} Point - -
    -
    Point No. 1
    - -
    - - - - - -
    -
    Returns:
    - -
    {Number} The Euclidian distance
    - -
    - - - - -
    - - -
    <static> - - {Number} - Karma#geometry.distance2(Point, Point) - -
    -
    - Gets the square of the Euclidian (ordinary) distance between 2 points. - - -
    - - - - -
    -
    Parameters:
    - -
    - {Number} Point - -
    -
    Point No. 0
    - -
    - {Number} Point - -
    -
    Point No. 1
    - -
    - - - - - -
    -
    Returns:
    - -
    {Number} The square of the Euclidian distance
    - -
    - - - - -
    - - -
    <static> - - {Number} - Karma#geometry.radians(angle) - -
    -
    - Converts a value from degrees to radians. - - -
    - - - - -
    -
    Parameters:
    - -
    - {Number} angle - -
    -
    The angle in degrees
    - -
    - - - - - -
    -
    Returns:
    - -
    {Number} The The angle in radians
    - -
    - - - - - - - - - - - -
    -
    - - - -
    - - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) -
    - - diff --git a/docs/jsdoc/symbols/Karma#graphics.html b/docs/jsdoc/symbols/Karma#graphics.html deleted file mode 100755 index 723280f..0000000 --- a/docs/jsdoc/symbols/Karma#graphics.html +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - - JsDoc Reference - Karma#graphics - - - - - - - - - - - -
    - -
    Class Index -| File Index
    -
    -

    Classes

    - -
    - -
    - -
    - -

    - - Namespace Karma#graphics -

    - - -

    - - - Graphics functions. - - -
    Defined in: jquery.karma.js. - -

    - - - - - - - - - - - - - - - - - -
    Namespace Summary
    Constructor AttributesConstructor Name and Description
      - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Method Summary
    Method AttributesMethod Name and Description
    <static>   -
    Karma#graphics.circle(args) -
    -
    Creates a new circle.
    -
    <static>   -
    Karma#graphics.rectangle(args) -
    -
    Creates a new rectangle.
    -
    - - - - - - - - - -
    -
    - Namespace Detail -
    - -
    - Karma#graphics -
    - -
    - - -
    - - - - - - - - - - - - -
    - - - - - - - -
    - Method Detail -
    - - -
    <static> - - - Karma#graphics.circle(args) - -
    -
    - Creates a new circle. It's a shortcut for calling 'new KCircle(..)'. - - -
    - - - - -
    -
    Parameters:
    - -
    - args - -
    -
    - -
    - - - - - - - - -
    - - -
    <static> - - - Karma#graphics.rectangle(args) - -
    -
    - Creates a new rectangle. It's a shortcut for calling 'new KRectangle(..)'. - - -
    - - - - -
    -
    Parameters:
    - -
    - args - -
    -
    - -
    - - - - - - - - - - - - - - - -
    -
    - - - -
    - - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) -
    - - diff --git a/docs/jsdoc/symbols/Karma#math.html b/docs/jsdoc/symbols/Karma#math.html deleted file mode 100755 index b485daa..0000000 --- a/docs/jsdoc/symbols/Karma#math.html +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - - JsDoc Reference - Karma#math - - - - - - - - - - - -
    - -
    Class Index -| File Index
    -
    -

    Classes

    - -
    - -
    - -
    - -

    - - Namespace Karma#math -

    - - -

    - - - Math functions. - - -
    Defined in: jquery.karma.js. - -

    - - - - - - - - - - - - - - - - - -
    Namespace Summary
    Constructor AttributesConstructor Name and Description
      - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Method Summary
    Method AttributesMethod Name and Description
    <static>   -
    Karma#math.rand(lower, upper) -
    -
    Generates a random bumber between lower bound and upper bound inclusive.
    -
    - - - - - - - - - -
    -
    - Namespace Detail -
    - -
    - Karma#math -
    - -
    - - -
    - - - - - - - - - - - - -
    - - - - - - - -
    - Method Detail -
    - - -
    <static> - - {Number} - Karma#math.rand(lower, upper) - -
    -
    - Generates a random bumber between lower bound and upper bound inclusive. - - -
    - - - - -
    -
    Parameters:
    - -
    - {Number} lower - -
    -
    The lower bound
    - -
    - {Number} upper - -
    -
    The upper bound
    - -
    - - - - - -
    -
    Returns:
    - -
    {Number} The generated number
    - -
    - - - - - - - - - - - -
    -
    - - - -
    - - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) -
    - - diff --git a/docs/jsdoc/symbols/_global_.html b/docs/jsdoc/symbols/_global_.html deleted file mode 100755 index bf8e16b..0000000 --- a/docs/jsdoc/symbols/_global_.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - JsDoc Reference - _global_ - - - - - - - - - - - -
    - -
    Class Index -| File Index
    -
    -

    Classes

    - -
    - -
    - -
    - -

    - - Built-In Namespace _global_ -

    - - -

    - - - - - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Method Summary
    Method AttributesMethod Name and Description
      - -
    -
    - - - - - - - - - - - - - - - -
    - Method Detail -
    - - -
    - - - jQueryanonymous($) - -
    -
    - - -
    - Defined in: jquery.karma.js. - - -
    - - - - -
    -
    Parameters:
    - -
    - $ - -
    -
    - -
    - - - - - - - - - - - - - - - -
    -
    - - - -
    - - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:58 GMT-0500 (CDT) -
    - - diff --git a/docs/jsdoc/symbols/jQueryanonymous-KObject.html b/docs/symbols/KObject.html index 8641378..90ccb90 100644 --- a/docs/jsdoc/symbols/jQueryanonymous-KObject.html +++ b/docs/symbols/KObject.html @@ -5,7 +5,7 @@ - JsDoc Reference - jQueryanonymous-KObject + JsDoc Reference - KObject + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class jQuery.fn.Karma-Karma +

    + + +

    + + + Represents a Karma (master) object. + + +
    Defined in: jquery.karma-0.5.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
    <inner>   +
    + jQuery.fn.Karma-Karma(options) +
    +
    Karma
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <inner>   + +
    Gets the language acording to the browser language
    +
    <inner>   +
    i18nWrapper(options) +
    +
    Creates a new Gettext object and returns a shortcut function to localise + defined strings.
    +
    <inner>   + +
    It will attempt to load a language file, the posible languages are defined + on language.alternatives.
    +
    <inner>   + +
    Localises the inline html content and it creates the localised paths for + "images", "sounds" and "videos".
    +
    + + + + + + + + + +
    +
    + Class Detail +
    + +
    <inner> + jQuery.fn.Karma-Karma(options) +
    + +
    + Karma + +
    + + + + + +
    +
    Parameters:
    + +
    + {String | Object} options + +
    +
    Constructor arguments
    + +
    + {String | Object} options.container + Optional +
    +
    Target DIV-class that will contain + any canvas element created using Karma functions
    + +
    + {String} options.language + Optional +
    +
      +
    • if it's seted: + Karma will assume that the according language file exists and Karma will try + to load it.
    • +
    • if it's not seted: + Karma will localise the content according to the Browser language +
    • +
    + +
    + {Array} options.language.alternatives + Optional +
    +
    Alternatives for localizing the content. The first has the priority.
    + +
    + {Object} options.i18n + Optional +
    +
    Object that contains data for i18n.
    + +
    + {Object | String} options.i18n.root + Optional, Default: self +
    +
    Parent element where the i18n shortcut function will be attached.
    + +
    + {String} options.i18n.shortcut + Optional, Default: _ +
    +
    Shortcut for calling i18n.
    + +
    + {Number} options.fps + Optional, Default: 24 +
    +
    Frames per second at which Karma will perform any refresh action.
    + +
    + + + + + + + + +
    + + + + + + + +
    + Method Detail +
    + + +
    <inner> + + {Object} + getLanguage() + +
    +
    + Gets the language acording to the browser language + + +
    + + + + + + + + +
    +
    Returns:
    + +
    {Object}
    + lang: countryCode and langCode (if specified) + langCode*: language code represented as xx, example: en.
    + countryCode*: country code represented as YY, example: US.
    +optional
    + +
    + + + + +
    + + +
    <inner> + + {Function} + i18nWrapper(options) + +
    +
    + Creates a new Gettext object and returns a shortcut function to localise + defined strings.
    We use karma.Gettext.js it's a modification of + + Gettext.js from beril OS. + + +
    + + + + +
    +
    Parameters:
    + +
    + {Object} options + +
    +
    The arguments of the Gettext constructor
    + +
    + + + + + +
    +
    Returns:
    + +
    {Function} A generic function to call Gettext functions + The generic function will call a Gettext function according to the number of arguments passed + + + + + + + + + + + + + + + + + + + + + + + + + +
    No. paramsParametersGettext function called
    1msgidgettext
    2context, msgidpgettext
    3number, singular, pluralngettext
    4number, context, singular, pluralnpgettext
    + +
    + + +
    +
    Requires:
    + +
    karma.Gettext.js
    + +
    + + + +
    + + +
    <inner> + + {String} + loadAlternatives() + +
    +
    + It will attempt to load a language file, the posible languages are defined + on language.alternatives. +

    The language file type could be: .po (Pootle) or .json (JSON). The + precedence between file types is defined according to which is defined first + in supportedLangFileTypes. By default Pootle files has precedence over JSON, + files.

    + + +
    + + + + + + + + +
    +
    Returns:
    + +
    {String} The name of the language file loaded. Example: en-US.po
    + +
    + + + +
    +
    See:
    + +
    Karma
    + +
    + + +
    + + +
    <inner> + + + localiseContent(lang) + +
    +
    + Localises the inline html content and it creates the localised paths for + "images", "sounds" and "videos". + Note:Inline html localisation under development
    + + +
    + + + + +
    +
    Parameters:
    + +
    + {String} lang + +
    +
    The language that will be used to localise the content
    + +
    + + + + + + + +
    +
    See:
    + +
    + Karma Bundle_layout
    + +
    + + + + + + + + + +
    +
    + + + +
    + + Documentation generated by JsDoc Toolkit 2.3.0 on Thu Sep 03 2009 07:49:38 GMT+0545 (NPT) +
    + + diff --git a/docs/jsdoc/symbols/jQuery.html b/docs/symbols/jQuery.fn.html index 465eabf..5306993 100644 --- a/docs/jsdoc/symbols/jQuery.html +++ b/docs/symbols/jQuery.fn.html @@ -5,7 +5,7 @@ - JsDoc Reference - jQuery + JsDoc Reference - jQuery.fn + + + + + + + + + +
    + +
    Class Index +| File Index
    +
    +

    Classes

    + +
    + +
    + +
    + +

    + + Class jQuery.fn.karma-Karma +

    + + +

    + + + Represents a Karma (master) object. + + +
    Defined in: jquery.karma-0.5.js. + +

    + + + + + + + + + + + + + + + + + +
    Class Summary
    Constructor AttributesConstructor Name and Description
    <inner>   +
    + jQuery.fn.karma-Karma(options) +
    +
    Karma
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Method Summary
    Method AttributesMethod Name and Description
    <inner>   + +
    Gets the language acording to the browser language
    +
    <inner>   +
    i18nWrapper(options) +
    +
    Creates a new Gettext object and returns a shortcut function to localise + defined strings.
    +
    <inner>   + +
    It will attempt to load a language file, the posible languages are defined + on language.alternatives.
    +
    <inner>   + +
    Localises the inline html content and it creates the localised paths for + "images", "sounds" and "videos".
    +
    + + + + + + + + + +
    +
    + Class Detail +
    + +
    <inner> + jQuery.fn.karma-Karma(options) +
    + +
    + Karma + +
    + + + + + +
    +
    Parameters:
    + +
    + {String | Object} options + +
    +
    Constructor arguments
    + +
    + {String | Object} options.container + Optional +
    +
    Target DIV-class that will contain + any canvas element created using Karma functions
    + +
    + {String} options.language + Optional +
    +
      +
    • if it's seted: + Karma will assume that the according language file exists and Karma will try + to load it.
    • +
    • if it's not seted: + Karma will localise the content according to the Browser language +
    • +
    + +
    + {Array} options.language.alternatives + Optional +
    +
    Alternatives for localizing the content. The first has the priority.
    + +
    + {Object} options.i18n + Optional +
    +
    Object that contains data for i18n.
    + +
    + {Object | String} options.i18n.root + Optional, Default: self +
    +
    Parent element where the i18n shortcut function will be attached.
    + +
    + {String} options.i18n.shortcut + Optional, Default: _ +
    +
    Shortcut for calling i18n.
    + +
    + {Number} options.fps + Optional, Default: 24 +
    +
    Frames per second at which Karma will perform any refresh action.
    + +
    + + + + + + + + +
    + + + + + + + +
    + Method Detail +
    + + +
    <inner> + + {Object} + getLanguage() + +
    +
    + Gets the language acording to the browser language + + +
    + + + + + + + + +
    +
    Returns:
    + +
    {Object}
    + lang: countryCode and langCode (if specified) + langCode*: language code represented as xx, example: en.
    + countryCode*: country code represented as YY, example: US.
    +optional
    + +
    + + + + +
    + + +
    <inner> + + {Function} + i18nWrapper(options) + +
    +
    + Creates a new Gettext object and returns a shortcut function to localise + defined strings.
    We use karma.Gettext.js it's a modification of + + Gettext.js from beril OS. + + +
    + + + + +
    +
    Parameters:
    + +
    + {Object} options + +
    +
    The arguments of the Gettext constructor
    + +
    + + + + + +
    +
    Returns:
    + +
    {Function} A generic function to call Gettext functions + The generic function will call a Gettext function according to the number of arguments passed + + + + + + + + + + + + + + + + + + + + + + + + + +
    No. paramsParametersGettext function called
    1msgidgettext
    2context, msgidpgettext
    3number, singular, pluralngettext
    4number, context, singular, pluralnpgettext
    + +
    + + +
    +
    Requires:
    + +
    karma.Gettext.js
    + +
    + + + +
    + + +
    <inner> + + {String} + loadAlternatives() + +
    +
    + It will attempt to load a language file, the posible languages are defined + on language.alternatives. +

    The language file type could be: .po (Pootle) or .json (JSON). The + precedence between file types is defined according to which is defined first + in supportedLangFileTypes. By default Pootle files has precedence over JSON, + files.

    + + +
    + + + + + + + + +
    +
    Returns:
    + +
    {String} The name of the language file loaded. Example: en-US.po
    + +
    + + + +
    +
    See:
    + +
    Karma
    + +
    + + +
    + + +
    <inner> + + + localiseContent(lang) + +
    +
    + Localises the inline html content and it creates the localised paths for + "images", "sounds" and "videos". + Note:Inline html localisation under development
    + + +
    + + + + +
    +
    Parameters:
    + +
    + {String} lang + +
    +
    The language that will be used to localise the content
    + +
    + + + + + + + +
    +
    See:
    + +
    + Karma Bundle_layout
    + +
    + + + + + + + + + +
    +
    + + + +
    + + Documentation generated by JsDoc Toolkit 2.3.0 on Thu Sep 03 2009 07:49:05 GMT+0545 (NPT) +
    + + diff --git a/docs/symbols/jQuery.html b/docs/symbols/jQuery.html index 465eabf..4fdf01a 100755 --- a/docs/symbols/jQuery.html +++ b/docs/symbols/jQuery.html @@ -238,7 +238,7 @@ ul.inheritsList -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -402,7 +402,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:58 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:18:47 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KGraphic.html b/docs/symbols/jQueryanonymous-KGraphic.html index b9a0ae2..02f17ca 100755 --- a/docs/symbols/jQueryanonymous-KGraphic.html +++ b/docs/symbols/jQueryanonymous-KGraphic.html @@ -191,8 +191,6 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • -
  • jQueryanonymous-KGraphic
  • jQueryanonymous-KGroup
  • @@ -228,7 +226,7 @@ ul.inheritsList

    - Class jQueryanonymous-KGraphic + Namespace jQueryanonymous-KGraphic

    @@ -237,17 +235,17 @@ ul.inheritsList KObject.
    - General methods for any Graphic object + Karma -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    - + @@ -259,7 +257,7 @@ ul.inheritsList @@ -280,11 +278,11 @@ ul.inheritsList
    - Class Detail + Namespace Detail
    <inner> - jQueryanonymous-KGraphic(options) + jQueryanonymous-KGraphic
    @@ -370,7 +368,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:58 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:19:23 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KGroup.html b/docs/symbols/jQueryanonymous-KGroup.html index c0860cc..b5be6e3 100755 --- a/docs/symbols/jQueryanonymous-KGroup.html +++ b/docs/symbols/jQueryanonymous-KGroup.html @@ -191,18 +191,12 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • - -
  • jQueryanonymous-KGraphic
  • -
  • jQueryanonymous-KGroup
  • jQueryanonymous-KImage
  • jQueryanonymous-KMedia
  • -
  • jQueryanonymous-KObject
  • -
  • jQueryanonymous-KRectangle
  • jQueryanonymous-KShape
  • @@ -219,6 +213,10 @@ ul.inheritsList
  • Karma#math
  • +
  • Karma.jQueryanonymous-KGraphic
  • + +
  • Karma.KObject
  • +
    @@ -240,7 +238,7 @@ ul.inheritsList An object that collects multiple KGraphic objects -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -322,7 +320,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:28:31 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KImage.html b/docs/symbols/jQueryanonymous-KImage.html index d10b28f..955fa16 100755 --- a/docs/symbols/jQueryanonymous-KImage.html +++ b/docs/symbols/jQueryanonymous-KImage.html @@ -191,18 +191,12 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • - -
  • jQueryanonymous-KGraphic
  • -
  • jQueryanonymous-KGroup
  • jQueryanonymous-KImage
  • jQueryanonymous-KMedia
  • -
  • jQueryanonymous-KObject
  • -
  • jQueryanonymous-KRectangle
  • jQueryanonymous-KShape
  • @@ -219,6 +213,10 @@ ul.inheritsList
  • Karma#math
  • +
  • Karma.jQueryanonymous-KGraphic
  • + +
  • Karma.KObject
  • +
    @@ -240,7 +238,7 @@ ul.inheritsList General methods for any Image object -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -339,7 +337,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:28:31 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KMedia.html b/docs/symbols/jQueryanonymous-KMedia.html index 9633275..19b8af4 100755 --- a/docs/symbols/jQueryanonymous-KMedia.html +++ b/docs/symbols/jQueryanonymous-KMedia.html @@ -191,18 +191,12 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • - -
  • jQueryanonymous-KGraphic
  • -
  • jQueryanonymous-KGroup
  • jQueryanonymous-KImage
  • jQueryanonymous-KMedia
  • -
  • jQueryanonymous-KObject
  • -
  • jQueryanonymous-KRectangle
  • jQueryanonymous-KShape
  • @@ -219,6 +213,10 @@ ul.inheritsList
  • Karma#math
  • +
  • Karma.jQueryanonymous-KGraphic
  • + +
  • Karma.KObject
  • +
    @@ -240,7 +238,7 @@ ul.inheritsList General methods for any Graphic object -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -346,7 +344,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:28:31 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KObject.html b/docs/symbols/jQueryanonymous-KObject.html index 8641378..a8d07f1 100755 --- a/docs/symbols/jQueryanonymous-KObject.html +++ b/docs/symbols/jQueryanonymous-KObject.html @@ -191,8 +191,6 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • -
  • jQueryanonymous-KGraphic
  • jQueryanonymous-KGroup
  • @@ -238,7 +236,7 @@ ul.inheritsList The basic Karma object -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -337,7 +335,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:19:23 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KRectangle.html b/docs/symbols/jQueryanonymous-KRectangle.html index f1e9ded..15741c5 100755 --- a/docs/symbols/jQueryanonymous-KRectangle.html +++ b/docs/symbols/jQueryanonymous-KRectangle.html @@ -191,18 +191,12 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • - -
  • jQueryanonymous-KGraphic
  • -
  • jQueryanonymous-KGroup
  • jQueryanonymous-KImage
  • jQueryanonymous-KMedia
  • -
  • jQueryanonymous-KObject
  • -
  • jQueryanonymous-KRectangle
  • jQueryanonymous-KShape
  • @@ -219,6 +213,10 @@ ul.inheritsList
  • Karma#math
  • +
  • Karma.jQueryanonymous-KGraphic
  • + +
  • Karma.KObject
  • +
    @@ -240,7 +238,7 @@ ul.inheritsList General methods for a rectangle object -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -357,7 +355,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:28:31 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KShape.html b/docs/symbols/jQueryanonymous-KShape.html index 7c11509..a638dac 100755 --- a/docs/symbols/jQueryanonymous-KShape.html +++ b/docs/symbols/jQueryanonymous-KShape.html @@ -191,18 +191,12 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • - -
  • jQueryanonymous-KGraphic
  • -
  • jQueryanonymous-KGroup
  • jQueryanonymous-KImage
  • jQueryanonymous-KMedia
  • -
  • jQueryanonymous-KObject
  • -
  • jQueryanonymous-KRectangle
  • jQueryanonymous-KShape
  • @@ -219,6 +213,10 @@ ul.inheritsList
  • Karma#math
  • +
  • Karma.jQueryanonymous-KGraphic
  • + +
  • Karma.KObject
  • +
    @@ -240,7 +238,7 @@ ul.inheritsList General methods for any Shape object -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -358,7 +356,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:28:31 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KSound.html b/docs/symbols/jQueryanonymous-KSound.html index ad3a13d..351d760 100755 --- a/docs/symbols/jQueryanonymous-KSound.html +++ b/docs/symbols/jQueryanonymous-KSound.html @@ -191,18 +191,12 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • - -
  • jQueryanonymous-KGraphic
  • -
  • jQueryanonymous-KGroup
  • jQueryanonymous-KImage
  • jQueryanonymous-KMedia
  • -
  • jQueryanonymous-KObject
  • -
  • jQueryanonymous-KRectangle
  • jQueryanonymous-KShape
  • @@ -219,6 +213,10 @@ ul.inheritsList
  • Karma#math
  • +
  • Karma.jQueryanonymous-KGraphic
  • + +
  • Karma.KObject
  • +
    @@ -240,7 +238,7 @@ ul.inheritsList General methods for any Sound object -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -339,7 +337,7 @@ ul.inheritsList
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:28:31 GMT-0700 (PDT)
    diff --git a/docs/symbols/jQueryanonymous-KSurface.html b/docs/symbols/jQueryanonymous-KSurface.html index f136bcd..81be53c 100755 --- a/docs/symbols/jQueryanonymous-KSurface.html +++ b/docs/symbols/jQueryanonymous-KSurface.html @@ -191,33 +191,31 @@ ul.inheritsList
  • _global_
  • -
  • jQuery
  • +
  • jQueryanonymous-KSurface
  • -
  • jQueryanonymous-KGraphic
  • +
  • Karma
  • -
  • jQueryanonymous-KGroup
  • +
  • Karma#geometry
  • -
  • jQueryanonymous-KImage
  • +
  • Karma#graphics
  • -
  • jQueryanonymous-KMedia
  • +
  • Karma#math
  • -
  • jQueryanonymous-KObject
  • +
  • Karma.jQueryanonymous-KRectangle
  • -
  • jQueryanonymous-KRectangle
  • +
  • Karma.KGraphic
  • -
  • jQueryanonymous-KShape
  • +
  • Karma.KGroup
  • -
  • jQueryanonymous-KSound
  • +
  • Karma.KImage
  • -
  • jQueryanonymous-KSurface
  • +
  • Karma.KMedia
  • -
  • Karma
  • +
  • Karma.KShape
  • -
  • Karma#geometry
  • +
  • Karma.KSound
  • -
  • Karma#graphics
  • - -
  • Karma#math
  • +
  • KObject

  • @@ -238,7 +236,7 @@ ul.inheritsList KSurface class -
    Defined in: jquery.karma.js. +
    Defined in: jquery.karma.js.

    @@ -388,7 +386,7 @@ There are 2 ways to create a new KSurface:
    - Documentation generated by JsDoc Toolkit 2.3.0 on Mon Sep 14 2009 20:12:59 GMT-0500 (CDT) + Documentation generated by JsDoc Toolkit 2.3.0 on Tue Oct 13 2009 23:32:24 GMT-0700 (PDT)
    diff --git a/docs/jsdoc/symbols/jQueryanonymous-KGraphic.html b/docs/symbols/jQueryanonymous-Karma-KGraphic.html index b9a0ae2..a5450da 100644 --- a/docs/jsdoc/symbols/jQueryanonymous-KGraphic.html +++ b/docs/symbols/jQueryanonymous-Karma-KGraphic.html @@ -5,7 +5,7 @@ - JsDoc Reference - jQueryanonymous-KGraphic + JsDoc Reference - jQueryanonymous-Karma-KGraphic
      1 /*
    +  2  * jQuery JavaScript Library v1.3.2
    +  3  * http://jquery.com/
    +  4  *
    +  5  * Copyright (c) 2009 John Resig
    +  6  * Dual licensed under the MIT and GPL licenses.
    +  7  * http://docs.jquery.com/License
    +  8  *
    +  9  * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
    + 10  * Revision: 6246
    + 11  */
    + 12 (function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if( 13 /*
    + 14  * Sizzle CSS Selector Engine - v0.9.3
    + 15  *  Copyright 2009, The Dojo Foundation
    + 16  *  Released under the MIT, BSD, and GPL Licenses.
    + 17  *  More information: http://sizzlejs.com/
    + 18  */
    + 19 (function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T
      1 /*
    +	
      1 /*
       2 *	Karma Framework
       3 *	http://wiki.sugarlabs.org/go/Karma
       4 *	
    @@ -38,1131 +38,938 @@
      31 
      32 /**
      33 * @fileOverview Contains karma library
    - 34 * @version 0.1
    + 34 * @version 0.5
      35 * @author Felipe Lopez Toledo <zer.subzero@gmail.com>
      36 */
      37 
      38  
      39 /**
    - 40  * See <a href="http://jquery.com">jQuery</a>.
    + 40  * See (http://jquery.com/).
      41  * @class
      42  * @name jQuery
      43  * @exports $ as jQuery
      44 */
      45 
    - 46 (function ($) {
    - 47 //helpers
    - 48 /**
    - 49 Checks if the argument 'arg' is set and if its type is 'type'.<br>
    - 50 1. if arg is set: it returns 'toReturn' if specified, otherwise it returns 
    - 51 	'true'
    - 52 2. if arg is not set: it returns 'false'
    - 53 @param arg The param to check
    - 54 @param {Object} [type] The expeted type of 'arg'
    - 55 @param [toReturn] object or value to return in case 1
    - 56 @returns true | false | toReturn
    - 57 @example
    - 58 var msg = "hi";
    - 59 valid(msg); //returns true
    - 60 valid(msg, "String" ); //returns true
    - 61 valid(msg, "Number"); //returns false
    - 62 valid(msg, "String",false ); //returns false
    - 63 valid(msg, "String", "hello" ); //returns "hello"
    - 64 valid(msg123); //returns false
    - 65 **/
    - 66 var valid = function ( arg, type, toReturn ) {
    - 67 	if ( type ) {
    - 68 		if ( typeof arg === type ) {
    - 69 			if ( toReturn )
    - 70 				return toReturn;
    - 71 			return true;
    - 72 		}
    - 73 		return false
    - 74 	}
    - 75 	if ( typeof arg !== "undefined" && arg!== "null" ) return true;
    - 76 	return false;
    - 77 }
    - 78 /**
    - 79 Clones an object
    - 80 @param {object} obj The source object
    - 81 @returns {object} The cloned object
    - 82 **/
    - 83 var clone = function( obj ){
    - 84     if(obj == null || typeof(obj) != 'object')
    - 85         return obj;
    - 86     var temp = new obj.constructor(); 
    - 87     for(var key in obj)
    - 88         temp[ key ] = clone( obj[ key ] );
    - 89     return temp;
    - 90 }
    - 91 
    - 92 /**
    - 93 Karma
    - 94 @name Karma
    - 95 @class Represents a Karma (master) object.
    - 96 @param {String | Object } options Constructor arguments 
    - 97 @param {String | Object } [options.container] Target DIV-class that will contain
    - 98 	any canvas element created using Karma functions
    - 99 @param {String} [options.language] 
    -100 */
    -101 var Karma = function( options ) {
    -102 	var that = this;
    -103 	this.version = "0.01";
    -104 	//
    -105 	//relative path to the po, images, sounds, etc.  from the html
    -106 	//defined here: http://wiki.sugarlabs.org/go/Karma/Bundle_layout
    -107 	//localized is recalculated inside localizeContent ( $ = language.lang )
    -108 	this.paths = {
    -109 		po: "po/",
    -110 		images: {
    -111 				localized:	"assets/$/images/",
    -112 				generic:	"assets/generic/images/"
    -113 				},
    -114 		sounds: {
    -115 				localized:	"assets/$/sounds/",
    -116 				generic:	"assets/generic/sounds/"
    -117 				},
    -118 		videos: {
    -119 				localized:	"assets/$/videos/",
    -120 				generic:	"assets/generic/videos/"
    -121 				}
    -122 	};
    -123 	this.supportedLangFileTypes = [ 
    -124 		{ ext: "po",   type: 'application/x-po' },
    -125 		{ ext: "json", type: 'application/json'}
    -126 	];
    -127 	//
    -128 	//PRIVATE STUFF start
    -129 	/**
    -130 	Gets the language acording to the browser language
    -131 	@returns {Object} <br>
    -132 	lang: countryCode and langCode (if specified)
    -133 	langCode*: language code represented as xx, example: en.<br>
    -134 	countryCode*: country code represented as YY, example: US.<br>
    -135 	*optional
    -136 	**/
    -137 	var getLanguage = function () {
    -138 		//console.log +=  navigator.language +"\n";
    -139 		var lang = navigator.language || navigator.browserLanguage; //mozilla/ie
    -140 		lang = lang.replace(/_/, '-').toLowerCase();
    -141 		if (lang.length > 3 ) {
    -142 			var country = lang.substring(3, 5);
    -143 			lang = lang.substring(0, 2);
    -144 			if ( country.match(/[^a-zA-Z]/) === null ) {
    -145 				country = country.toUpperCase();
    -146 				return  { 
    -147 					"lang": lang + "-" + country, 
    -148 					"langCode": lang, 
    -149 					"countryCode": country 
    -150 				};
    -151 			}
    -152 		}
    -153 		return { "lang": lang };
    -154 	}
    -155 	/**
    -156 	Creates a new Gettext object and returns a shortcut function to localise 
    -157 	defined strings.<br>We use karma.Gettext.js it's a modification of 
    -158 	<a href=http://jsgettext.berlios.de/doc/html/Gettext.html> 
    -159 	Gettext.js</a> from beril OS.
    -160 	@requires karma.Gettext.js
    -161 	@param {Object}  options The arguments of the Gettext constructor
    -162 	@returns {Function} A generic function to call Gettext functions
    -163 	**/
    -164 	var i18nWrapper = function ( options ) {
    -165 		var gt = new Gettext( options );
    -166 		if ( typeof ( gt ) === 'undefined' )
    -167 			throw new Error("Unable to initialize Gettext object");
    -168 		return (function (str1, str2, str3, str4 ) {
    -169 			var n, context, singular, plural;
    -170 			if (typeof(str4) != 'undefined') {
    -171 				// number, context, singular, plural
    -172 				return gt.npgettext(str2, str3, str4, str1);
    -173 			} else if (typeof(str3) != 'undefined') {
    -174 				// number, singular, plural
    -175 				return gt.ngettext(str2, str3, str1);
    -176 			} else if (typeof(str2) != 'undefined') {
    -177 				// context, msgid
    -178 				return gt.pgettext(str1, str2);
    -179 			} else if (typeof(str1) != 'undefined') {
    -180 				// msgid
    -181 				return gt.gettext(str1);
    -182 			} else {
    -183 				// nothing passed in; return blank string.
    -184 				// XXX: we could error here, but that may cause more harm than good.
    -185 				return '';
    -186 			}
    -187 		});
    -188 	};
    -189 	/**
    -190 	Localises the inline html content and it creates the localised paths for 
    -191 	"images", "sounds" and "videos".
    -192 	<b>Note:</b>Inline html localisation under development<br> 
    -193 	@param {String} lang The language that will be used to localise the content
    -194 	@see <a href="http://wiki.sugarlabs.org/go/Karma/Bundle_layout">
    -195 		Karma Bundle_layout</a>
    -196 	**/
    -197 	var localiseContent = function ( lang ) {
    -198 		
    -199 		var toFix = ["images", "sounds", "videos"];
    -200 		for (var i = 0; i < toFix.length; i++) {
    -201 			that.paths[ toFix[ i ] ].localized = that.paths[ 
    -202 				toFix[ i ] ].localized.replace('\$', lang );
    -203 		}
    -204 		//dirty hack to support {lang}_AudioFile
    -205 		var prefix = lang+"_";
    -206 		that.paths[ "sounds" ].localized+=prefix;
    -207 	}
    -208 	/**
    -209 	It will attempt to load a language file, the posible languages are defined 
    -210 	on language.alternatives.
    -211 	<p>The language file type could be: .po (Pootle) or .json (JSON). The 
    -212 	precedence between file types is defined according to which is defined first 
    -213 	in supportedLangFileTypes. By default Pootle files has precedence over JSON,
    -214 	files.</p>
    -215 	@see Karma
    -216 	@returns {String} The name of the language file loaded. Example: en-US.po
    -217 	**/
    -218 	var loadAlternatives = function ( ) {
    -219 		var loaded = undefined;
    -220 		var tryNext = true;
    -221 		//try to load the po or json language file if it exists. 
    -222 		//the lang order is acording to options.language.alternatives
    -223 		//the type (po or json or ...) is defined in supportedLangFileTypes
    -224 		$.each( that.language.alternatives, function ( c, lang ) {
    -225 			for (var i=0; i < that.supportedLangFileTypes.length 
    -226 			&& tryNext === true; i++) {
    -227 				$.ajax({
    -228 					url: that.paths.po +  lang + "." + 
    -229 						 that.supportedLangFileTypes[i].ext,
    -230 					cache: true,
    -231 					dataType: "text",
    -232 					async: false, //important: touch it at your own risk
    -233 					success: function( data, textStatus ){
    -234 						
    -235 						loaded =  lang + "." + 
    -236 								  that.supportedLangFileTypes[i].ext;
    -237 						//i18n
    -238 						//we pass the data so we avoid re-loading the file
    -239 						//creates the shorcout
    -240 						that.i18n.root[ that.i18n.shortcut ] =  i18nWrapper(
    -241 							{ 
    -242 								domain 	: lang, 
    -243 								file 	: { 
    -244 										  type: that.supportedLangFileTypes[i].type, 
    -245 										  uri: this.url, data: data 
    -246 										} 
    -247 							}
    -248 						);
    -249 						localiseContent( lang );
    -250 						tryNext = false;
    -251 					},
    -252 					error: function ( XHR, textStatus, errorThrown ) {
    -253 						//the file doesn't exist or it wasn't possible to load it
    -254 						tryNext = true;
    -255 					}
    -256 				});
    -257 				return tryNext;
    -258 			}
    -259 		});
    -260 		return loaded;
    -261 	}
    -262 	//PRIVATE STUFF end
    -263 	// default options 
    -264 	var defaultOptions ={
    -265 		container:   "#karma-main",
    -266 		language:   { 
    -267 						lang: 			undefined,
    -268 						alternatives: 	['en-US', 'en'],
    -269 						countryCode: 	undefined,
    -270 						langCode:		undefined,
    -271 					},
    -272 		i18n:		{
    -273 						root: 			self, // self is global
    -274 						shortcut: 		"_"
    -275 					}
    -276 	};
    -277 	//
    -278 	this.library = { "images": [], "sounds": [], "videos":[], "shapes":[] };
    -279 	
    -280 	//initializes the defaultOptions argument
    -281 	//1 argument: string.  assume it's the container
    -282 	if ( typeof options === "string" ) {
    -283 		options = { container: options };
    -284 		options.language = getLanguage() ;
    -285 	} else if (typeof options === "object" ){
    -286 		if ( typeof options.lang === "string" ) {
    -287 			//if language is string, assume  it's the language.lang
    -288 			options.language = { lang: options.lang };
    -289 		}
    -290 	}
    -291 	$.extend( true, defaultOptions, options );
    -292 	//
    -293 	//copy defaultOptions to this, we use this.xyz instead this.defaultOptions.xyz 
    -294 	for (var i in defaultOptions ) {
    -295 		this[ i ] = defaultOptions[i];
    -296 	}
    -297 	
    -298 	//initializes i18n
    -299 	//add the localized language to the language.alternatives
    -300 	if ( typeof this.language.countryCode !== "undefined" ) {
    -301 		this.language.alternatives.unshift( 
    -302 			this.language.langCode, 
    -303 			this.language.countryCode 
    -304 		);
    + 46 
    + 47 
    + 48 (function ($) {
    + 49 //helpers
    + 50 /**
    + 51 Checks if the argument (arg) is seted and if its type is 'type'.<br>
    + 52 1. if arg is seted: it returns toReturn if specified, otherwise it returns 
    + 53 	'true'
    + 54 2. if arg is not seted: it returns 'false'
    + 55 @param arg The param to check
    + 56 @param {Object} [type] The expeted type of 'arg'
    + 57 @param [toReturn] object or value to return in case 1
    + 58 @returns true | false | toReturn
    + 59 @example
    + 60 var msg = "hi";
    + 61 valid(msg); //returns true
    + 62 valid(msg, "String" ); //returns true
    + 63 valid(msg, "Number"); //returns false
    + 64 valid(msg, "String",false ); //returns false
    + 65 valid(msg123); //returns false
    + 66 **/
    + 67 var valid = function ( arg, type, toReturn ) {
    + 68 	if ( type ) {
    + 69 		if ( typeof arg === type ) {
    + 70 			if ( toReturn )
    + 71 				return toReturn;
    + 72 			return true;
    + 73 		}
    + 74 		return false
    + 75 	}
    + 76 	if ( typeof arg !== "undefined" ) return true;
    + 77 	return false;
    + 78 }
    + 79 /**
    + 80  * Karma
    + 81  * @name Karma
    + 82  * @class Represents a Karma (master) object.
    + 83  * @param {String | Object } options Constructor arguments 
    + 84  * @param {String | Object } [options.container] Target DIV-class that will contain any canvas element created using Karma functions
    + 85  * @param {String} [options.language] 
    + 86 */
    + 87 var Karma = function(options ) {
    + 88 
    + 89 
    + 90 	var that = this;
    + 91 	this.version = "0.3 alpha";
    + 92 	//
    + 93 	//relative path to the po, images, sounds, etc.  from the html
    + 94 	//defined here: http://wiki.sugarlabs.org/go/Karma/Bundle_layout
    + 95 	//localized is recalculated inside localizeContent ( $ = language.lang )
    + 96 	this.paths = {
    + 97 		po: "po/",
    + 98 		images: {
    + 99 				localized:	"assets/$/images/",
    +100 				generic:	"assets/generic/images/"
    +101 				},
    +102 		sounds: {
    +103 				localized:	"assets/$/sounds/",
    +104 				generic:	"assets/generic/sounds/"
    +105 				},
    +106 		videos: {
    +107 				localized:	"assets/$/videos/",
    +108 				generic:	"assets/generic/videos/"
    +109 				}
    +110 	};
    +111 	this.supportedLangFileTypes = [ 
    +112 		{ ext: "po",   type: 'application/x-po' },
    +113 		{ ext: "json", type: 'application/json'}
    +114 	];
    +115 	//
    +116 	//PRIVATE STUFF start
    +117 	/**
    +118 	Gets the language acording to the browser language
    +119 	@returns {Object} <br>
    +120 	lang: countryCode and langCode (if specified)
    +121 	langCode*: language code represented as xx, example: en.<br>
    +122 	countryCode*: country code represented as YY, example: US.<br>
    +123 	*optional
    +124 	**/
    +125 	var getLanguage = function () {
    +126 		//console.log +=  navigator.language +"\n";
    +127 		var lang = navigator.language || navigator.browserLanguage; //mozilla/ie
    +128 		lang = lang.replace(/_/, '-').toLowerCase();
    +129 		if (lang.length > 3 ) {
    +130 			var country = lang.substring(3, 5);
    +131 			lang = lang.substring(0, 2);
    +132 			if ( country.match(/[^a-zA-Z]/) === null ) {
    +133 				country = country.toUpperCase();
    +134 				return  { 
    +135 					"lang": lang + "-" + country, 
    +136 					"langCode": lang, 
    +137 					"countryCode": country 
    +138 				};
    +139 			}
    +140 		}
    +141 		return { "lang": lang };
    +142 	}
    +143 	/**
    +144 	Creates a new Gettext object and returns a shortcut function to localise 
    +145 	defined strings.<br>We use karma.Gettext.js it's a modification of 
    +146 	<a href=http://jsgettext.berlios.de/doc/html/Gettext.html> 
    +147 	Gettext.js</a> from beril OS.
    +148 	@requires karma.Gettext.js
    +149 	@param {Object}  options The arguments of the Gettext constructor
    +150 	@returns {Function} A generic function to call Gettext functions
    +151 	**/
    +152 	var i18nWrapper = function ( options ) {
    +153 		var gt = new Gettext( options );
    +154 		if ( typeof ( gt ) === 'undefined' )
    +155 			throw new Error("Unable to initialize Gettext object");
    +156 		return (function (str1, str2, str3, str4 ) {
    +157 			var n, context, singular, plural;
    +158 			if (typeof(str4) != 'undefined') {
    +159 				// number, context, singular, plural
    +160 				return gt.npgettext(str2, str3, str4, str1);
    +161 			} else if (typeof(str3) != 'undefined') {
    +162 				// number, singular, plural
    +163 				return gt.ngettext(str2, str3, str1);
    +164 			} else if (typeof(str2) != 'undefined') {
    +165 				// context, msgid
    +166 				return gt.pgettext(str1, str2);
    +167 			} else if (typeof(str1) != 'undefined') {
    +168 				// msgid
    +169 				return gt.gettext(str1);
    +170 			} else {
    +171 				// nothing passed in; return blank string.
    +172 				// XXX: we could error here, but that may cause more harm than good.
    +173 				return '';
    +174 			}
    +175 		});
    +176 	};
    +177 	/**
    +178 	Localises the inline html content and it creates the localised paths for 
    +179 	"images", "sounds" and "videos".
    +180 	<b>Note:</b>Inline html localisation under development<br> 
    +181 	@param {String} lang The language that will be used to localise the content
    +182 	@see <a href="http://wiki.sugarlabs.org/go/Karma/Bundle_layout">
    +183 		Karma Bundle_layout</a>
    +184 	**/
    +185 	var localiseContent = function ( lang ) {
    +186 		
    +187 		var toFix = ["images", "sounds", "videos"];
    +188 		for (var i = 0; i < toFix.length; i++) {
    +189 			that.paths[ toFix[ i ] ].localized = that.paths[ 
    +190 				toFix[ i ] ].localized.replace('\$', lang );
    +191 		}
    +192 		//dirty hack to support {lang}_AudioFile
    +193 		var prefix = lang.substring(0, 2)+"_";
    +194 		that.paths[ "sounds" ].localized+=prefix;
    +195 		that.paths[ "sounds" ].generic+=prefix;
    +196 	}
    +197 	/**
    +198 	It will attempt to load a language file, the posible languages are defined 
    +199 	on language.alternatives.
    +200 	<p>The language file type could be: .po (Pootle) or .json (JSON). The 
    +201 	precedence between file types is defined according to which is defined first 
    +202 	in supportedLangFileTypes. By default Pootle files has precedence over JSON,
    +203 	files.</p>
    +204 	@see Karma
    +205 	@returns {String} The name of the language file loaded. Example: en-US.po
    +206 	**/
    +207 	var loadAlternatives = function ( ) {
    +208 		var loaded = undefined;
    +209 		var tryNext = true;
    +210 		//try to load the po or json language file if it exists. 
    +211 		//the lang order is acording to options.language.alternatives
    +212 		//the type (po or json or ...) is defined in supportedLangFileTypes
    +213 		$.each( that.language.alternatives, function ( c, lang ) {
    +214 			for (var i=0; i < that.supportedLangFileTypes.length 
    +215 			&& tryNext === true; i++) {
    +216 				$.ajax({
    +217 					url: that.paths.po +  lang + "." + 
    +218 						 that.supportedLangFileTypes[i].ext,
    +219 					cache: true,
    +220 					dataType: "text",
    +221 					async: false, //important: touch it at your own risk
    +222 					success: function( data, textStatus ){
    +223 						
    +224 						loaded =  lang + "." + 
    +225 								  that.supportedLangFileTypes[i].ext;
    +226 						//i18n
    +227 						//we pass the data so we avoid re-loading the file
    +228 						//creates the shorcout
    +229 						that.i18n.root[ that.i18n.shortcut ] =  i18nWrapper(
    +230 							{ 
    +231 								domain 	: lang, 
    +232 								file 	: { 
    +233 										  type: that.supportedLangFileTypes[i].type, 
    +234 										  uri: this.url, data: data 
    +235 										} 
    +236 							}
    +237 						);
    +238 						localiseContent( lang );
    +239 						tryNext = false;
    +240 					},
    +241 					error: function ( XHR, textStatus, errorThrown ) {
    +242 						//the file doesn't exist or it wasn't possible to load it
    +243 						tryNext = true;
    +244 					}
    +245 				});
    +246 				return tryNext;
    +247 			}
    +248 		});
    +249 		return loaded;
    +250 	}
    +251 	//PRIVATE STUFF end
    +252 	// default options 
    +253 	var defaultOptions ={
    +254 		container:   "#karma-ma1in",
    +255 		language:   { 
    +256 						lang: 			undefined,
    +257 						alternatives: 	['en-US', 'en'],
    +258 						countryCode: 	undefined,
    +259 						langCode:		undefined,
    +260 					},
    +261 		i18n:		{
    +262 						root: 			self, // self is global
    +263 						shortcut: 		"_"
    +264 					}
    +265 	};
    +266 	//
    +267 
    +268 	this.library = { "images": [], "sounds": [], "videos":[], "shapes":[] }
    +269 	
    +270 	//initializes the defaultOptions argument
    +271 	//1 argument: string.  assume it's the container
    +272 	if ( typeof options === "string" ) {
    +273 		options = { container: options };
    +274 		options.language = getLanguage() ;
    +275 	} else if (typeof options === "object" ){
    +276 		if ( typeof options.lang === "string" ) {
    +277 			//if language is string, assume  it's the language.lang
    +278 			options.language = { lang: options.lang };
    +279 		}
    +280 	}
    +281 	$.extend( true, defaultOptions, options );
    +282 	//
    +283 	//copy defaultOptions to this, we use this.xyz instead this.defaultOptions.xyz 
    +284 	for (var i in defaultOptions ) {
    +285 		this[ i ] = defaultOptions[i];
    +286 	}
    +287 	
    +288 	//initializes i18n
    +289 	//add the localized language to the language.alternatives
    +290 	if ( typeof this.language.countryCode !== "undefined" ) {
    +291 		this.language.alternatives.unshift( 
    +292 			this.language.langCode, 
    +293 			this.language.countryCode 
    +294 		);
    +295 	}
    +296 	if ( typeof this.language.lang !== "undefined" ) {
    +297 		this.language.alternatives.unshift( this.language.lang );
    +298 	}
    +299 	//try to load the localized lang file (po or json or ...)
    +300 	this.language.fileLoaded = loadAlternatives( );
    +301 	//initializes the container
    +302 	if ( typeof this.container === "string" ) {
    +303 		this.container = $( this.container )[ 0 ];
    +304 		if ( !valid(this.container) ) delete this.container;
     305 	}
    -306 	if ( typeof this.language.lang !== "undefined" ) {
    -307 		this.language.alternatives.unshift( this.language.lang );
    +306 	gk = {
    +307 		"paths": this.paths
     308 	}
    -309 	//try to load the localized lang file (po or json or ...)
    -310 	this.language.fileLoaded = loadAlternatives( );
    -311 	//initializes the container
    -312 	if ( typeof this.container === "string" ) {
    -313 		this.container = $( this.container )[ 0 ];
    -314 		if ( !valid(this.container) ) delete this.container;
    -315 	}
    -316 	
    -317 	gk = {
    -318 		"paths": this.paths
    -319 	}
    -320 	this.surfaces = {};
    -321 }
    -322 
    -323 /**
    -324 @memberOf Karma 
    -325 @namespace Geometry functions.
    -326 **/
    -327 Karma.prototype.geometry = {
    -328 	/**
    -329 	Converts a value from degrees to radians.
    -330 	@param {Number} angle The angle in degrees 
    -331 	@returns {Number} The The angle in radians 
    -332 	**/
    -333 	radians : function( angle ){
    -334 		return ( angle / 180 ) * Math.PI;
    -335 	},
    -336 	/**
    -337 	Gets the square of the Euclidian (ordinary) distance between 2 points.
    -338 	@param {Number} Point Point No. 0 
    -339 	@param {Number} Point Point No. 1
    -340 	@returns {Number} The square of the Euclidian distance 
    -341 	**/
    -342 	distance2 : function ( p0, p1 ) {
    -343 		return   (p1.x - p0.x) * (p1.x - p0.x) + (p1.y - p1.y) * (p1.y - p1.y); 
    -344 	},
    -345 	/**
    -346 	Gets the Euclidian (ordinary) distance between 2 points.<br>
    -347 	<b>Warning:</b> It's slower than distance2 function
    -348 	@param {Number} Point Point No. 0 
    -349 	@param {Number} Point Point No. 1
    -350 	@returns {Number} The Euclidian distance 
    -351 	**/
    -352 	distance : function ( p0, p1 ) {
    -353 		return   Math.sqrt( Karma.prototype.geometry.distance2( p0, p1 ) ); 
    -354 	}
    -355 }
    -356 /**
    -357 @memberOf Karma
    -358 @namespace Graphics functions.
    -359 **/
    -360 Karma.prototype.graphics = {
    -361 	/**
    -362 	Creates a new rectangle. It's a shortcut for calling 'new KRectangle(..)'.
    -363 	**/
    -364 	rectangle: function ( args ) { return new KRectangle( args ); },
    -365 	/**
    -366 	Creates a new circle. It's a shortcut for calling 'new KCircle(..)'.
    -367 	**/
    -368 	circle: function ( args ) { return new KCircle( args ); }
    -369 }
    -370 /**
    -371 @memberOf Karma 
    -372 @namespace Math functions.
    -373 **/
    -374 Karma.prototype.math = {
    -375 	/**
    -376 	Generates a random bumber between lower bound and upper bound inclusive.
    -377 	@param {Number} lower The lower bound
    -378 	@param {Number} upper The upper bound
    -379 	@returns {Number} The generated number
    -380 	**/
    -381 	rand : function ( lower, upper ){
    -382 		return Math.round ( Math.random() * (upper - lower) + lower );
    -383 	}
    -384 }
    -385 //FIXME
    -386 //everything inside karma.graphics is exported to karma.prototype
    -387 $.extend( Karma.prototype, Karma.prototype.graphics);
    -388 //
    -389 /**
    -390 @param {Object} [toLoad] The Object that has the arrays for preloading.
    -391 @param {Array} [toLoad.images] The images 
    -392 @param {Array} [toLoad.sounds] The sounds 
    -393 @param {Array} [toLoad.videos] The videos 
    -394 @memberOf Karma 
    -395 @returns {Object} this
    -396 **/
    -397 Karma.prototype.init = function( toLoad ) {
    -398 	this.pendingToLoad = toLoad;
    -399 	return this; //chaining :)
    -400 }
    -401 
    -402 /**
    -403 Main function. Any Karma function call should be inside the callback function.
    -404 The callback function will be executed when the preloading finishes.
    -405 @param {Function} cb The callback funtion
    -406 @memberOf Karma 
    -407 @see Karma#init
    -408 **/
    -409 Karma.prototype.main = function ( cb ) {
    -410 	if ( valid( this.pendingToLoad ) ) {
    -411 		//loader
    -412 		var loaderDiv = $("body").append('<div id=\"karma-loader\">Karma is \
    -413 		loading ...<div id=\"karma-loader\" class=\"status\"></div></div>');
    -414 		var statusDiv = $("#karma-loader .status");
    -415 		
    -416 		var statusUpdate = function ( current, error, total) {
    -417 			statusDiv.html(current + "/" + total + (error > 0 ? " [ "+error+" ]":''));
    +309 	this.layers={};
    +310 	this.clayers=0;
    +311 }
    +312 
    +313 /** @memberOf Karma **/
    +314 Karma.prototype.layer = function ( options ) {
    +315 	if ( !valid(options, "object") ){
    +316 		var options = { id: "klayer-"+(clayers++) };
    +317 	}
    +318 	options.mainContainer = this.container;
    +319 	options.paths = this.paths;
    +320 	this.layers[ options.id ] = new KLayer( options ); 
    +321 	return this.layer[ options.id ];
    +322 }
    +323 
    +324 
    +325 /** @memberOf Karma **/
    +326 Karma.prototype.geometry = {
    +327 	/**
    +328 	Converts a value from degrees to radians.
    +329 	@param {Number} angle The angle in degrees 
    +330 	@returns {Number} The The angle in radians 
    +331 	**/
    +332 	radians : function( angle ){
    +333 		return ( angle / 180 ) * Math.PI;
    +334 	},
    +335 	/**
    +336 	@param {Number} Point Point No. 0 
    +337 	@param {Number} Point Point No. 1
    +338 	@returns {Number} The square of the Euclidian distance 
    +339 	**/
    +340 	distance2 : function ( p0, p1 ) {
    +341 		return   (p1.x - p0.x) * (p1.x - p0.x) + (p1.y - p1.y) * (p1.y - p1.y); 
    +342 	},
    +343 	/**
    +344 	Get the Euclidian (ordinary) distance between 2 points.<br>
    +345 	<b>Warning:</b> It's slower than distance2 function
    +346 	@param {Number} Point Point No. 0 
    +347 	@param {Number} Point Point No. 1
    +348 	@returns {Number} The Euclidian distance 
    +349 	**/
    +350 	distance : function ( p0, p1 ) {
    +351 		return   Math.sqrt( Karma.prototype.geometry.distance2( p0, p1 ) ); 
    +352 	}
    +353 }
    +354 /**
    +355 @memberOf Karma
    +356 @namespace Graphics functions.
    +357 **/
    +358 Karma.prototype.graphics = {
    +359 	/**
    +360 	Creates a new rectangle. It's a shortcut for calling 'new KRectangle(..)'.
    +361 	**/
    +362 	rectangle: function ( args ) { return new KRectangle( args ); },
    +363 	/**
    +364 	Creates a new circle. It's a shortcut for calling 'new KCircle(..)'.
    +365 	**/
    +366 	circle: function ( args ) { return new KCircle( args ); }
    +367 }
    +368 /**
    +369 @memberOf Karma 
    +370 @namespace Math functions.
    +371 **/
    +372 Karma.prototype.math = {
    +373 	/**
    +374 	Generates a random bumber between lower bound and upper bound inclusive.
    +375 	@param {Number} lower The lower bound
    +376 	@param {Number} upper The upper bound
    +377 	@returns {Number} The generated number
    +378 	**/
    +379 	rand : function ( lower, upper ){
    +380 		return Math.round ( Math.random() * (upper - lower) + lower );
    +381 	}
    +382 }
    +383 //
    +384 //everything inside karma.graphics is exported to karma.prototype
    +385 $.extend( Karma.prototype, Karma.prototype.graphics);
    +386 //
    +387 /**
    +388 @param {Object} [toLoad] The Object that has the arrays for preloading.
    +389 @param {Array} [toLoad.images] The images 
    +390 @param {Array} [toLoad.sounds] The sounds 
    +391 @param {Array} [toLoad.videos] The videos 
    +392 @memberOf Karma 
    +393 @returns {Object} this
    +394 **/
    +395 Karma.prototype.init = function( toLoad ) {
    +396 	this.pendingToLoad = toLoad;
    +397 	return this; //chaining :)
    +398 }
    +399 
    +400 /**
    +401 Main function. Any Karma function call should be inside the callback function.
    +402 The callback function will be executed when the preloading finishes.
    +403 @param {Function} cb The callback funtion
    +404 @memberOf Karma 
    +405 @see Karma#init
    +406 **/
    +407 Karma.prototype.main = function ( cb ) {
    +408 	if ( valid( this.pendingToLoad ) ) {
    +409 		var that = this;
    +410 		var categories = ["images", "sounds", "videos" ];
    +411 		var counters = { "loaded":0, "error": 0 };
    +412 		var totalItems = 0;
    +413 		//get the total items
    +414 		for ( var i=0; i < categories.length; i++ ) {
    +415 			if ( valid ( this.pendingToLoad[ categories[ i ] ] ) ) {
    +416 				totalItems += this.pendingToLoad[ categories[ i ] ].length;
    +417 			}
     418 		}
    -419 		
    -420 		var that = this;
    -421 		var categories = ["images", "sounds", "videos" ];
    -422 		var counters = { "loaded":0, "error": 0 };
    -423 		var totalItems = 0;
    -424 		//creates the surfaces
    -425 		if ( valid( this.pendingToLoad[ "surfaces" ] ) ) {
    -426 			$.each (this.pendingToLoad[ "surfaces" ], function( key, config ){
    -427 				Karma.prototype.surface.call( that, config );
    -428 			});
    +419 		/**
    +420 		callback to check if all the items were loaded or got an error when 
    +421 		loading
    +422 		**/
    +423 		var checkAllLoaded = function ( ev ) {
    +424 			if ( ev.type === "load") counters.loaded += 1;
    +425 			else counters.error += 1;
    +426 			if ( counters.loaded + counters.error === totalItems ) {
    +427 				if ( cb ) cb();
    +428 			}
     429 		}
    -430 		statusUpdate( 0, 0, totalItems);
    -431 		//get the total items
    -432 		for ( var i=0; i < categories.length; i++ ) {
    -433 			if ( valid ( this.pendingToLoad[ categories[ i ] ] ) ) {
    -434 				totalItems += this.pendingToLoad[ categories[ i ] ].length;
    -435 			}
    -436 		}
    -437 		
    -438 		/**
    -439 		callback to check if all the items were loaded or got an error when 
    -440 		loading
    -441 		**/
    -442 		var errors=[];
    -443 		var checkAllLoaded = function ( ev ) {
    -444 			if ( ev.type === "load") counters.loaded += 1;
    -445 			else {
    -446 				errors.push( ev.target.src );
    -447 				counters.error += 1; 
    -448 			}
    -449 			statusUpdate( counters.loaded, counters.error, totalItems);
    -450 			if ( counters.loaded + counters.error === totalItems ) {
    -451 				if ( counters.error > 0 ){
    -452 					throw ( "Media files not found: " + errors );
    -453 				}
    -454 				$("#karma-loader:hiden:first").fadeOut("slow",function(){ 
    -455 					$(this).remove();});
    -456 				if ( cb ) cb();
    -457 			}
    -458 		}
    -459 		
    -460 		for ( var i=0; i < categories.length; i++ ) {
    -461 			var category = categories[ i ];
    -462 		    if ( valid ( this.pendingToLoad[ category ] ) ) {
    -463 				//load all the category elements
    -464 				var type = category.substr( 0, category.length-1 )
    -465 				$.each (this.pendingToLoad[ category ], function( key, config ){
    -466 					var name = config.name;
    -467 					delete config.name;
    -468 					//register the elements into the library
    -469 					that.library[ category ][ name ] =  Karma.prototype[ type ]( 
    -470 						config
    -471 					);
    -472 					that.library[ category ][ name ].media.addEventListener(
    -473 						"load",checkAllLoaded,false
    -474 					);
    -475 					that.library[ category ][ name ].media.addEventListener(
    -476 						"error",checkAllLoaded,false
    -477 					);
    -478 				});
    -479 			}
    -480 		}
    -481 	}else {
    -482 		if ( cb ) cb();
    -483 	}
    -484 }
    +430 		
    +431 		for ( var i=0; i < categories.length; i++ ) {
    +432 			var category = categories[ i ];
    +433 			if ( valid ( this.pendingToLoad[ category ] ) ) {
    +434 				//load all the category elements
    +435 				var type = category.substr( 0, category.length-1 )
    +436 				$.each (this.pendingToLoad[ category ], function( key, config ){
    +437 					var id = config.id;
    +438 					delete config.id;
    +439 					//register the elements into the library
    +440 					that.library[ category ][ id ] =  Karma.prototype[ type ]( 
    +441 						config
    +442 					);
    +443 					that.library[ category ][ id ].media.addEventListener(
    +444 						"load",checkAllLoaded,false
    +445 					);
    +446 					that.library[ category ][ id ].media.addEventListener(
    +447 						"error",checkAllLoaded,false
    +448 					);
    +449 				});
    +450 			}
    +451 		}
    +452 	}else {
    +453 		if ( cb ) cb();
    +454 	}
    +455 }
    +456 /**A shortcut for calling 'KImage( )'
    +457 @see KImage
    +458 @memberOf Karma 
    +459 **/
    +460 Karma.prototype.image = function ( args ) { return new KImage( args ) };
    +461 /**A shortcut for calling 'KSound( )'
    +462 @see KSound
    +463 @memberOf Karma 
    +464 **/
    +465 Karma.prototype.sound = function ( args ) { return new KSound( args ) };
    +466 /**A shortcut for calling 'KVideo( )'
    +467 @see KVideo
    +468 @memberOf Karma 
    +469 **/
    +470 Karma.prototype.video = function ( args ) { alert("Not implemented yet"); };
    +471 /**A shortcut for calling 'KGroup( )'
    +472 @see KGroup
    +473 @memberOf Karma 
    +474 **/
    +475 Karma.prototype.group = function ( args ) { return new KGroup( args ) };
    +476 /**A shortcut for calling 'KButton( )'
    +477 @see KButton
    +478 @memberOf Karma 
    +479 **/
    +480 Karma.prototype.button = function ( args ) { return new KButton( args ) };
    +481 /**
    +482 Mouse
    +483 **/
    +484 var mouse = {};
     485 /**
    -486 A shortcut for calling 'KImage( )'
    -487 @see KImage
    -488 @memberOf Karma 
    -489 @returns {Object} new instance of KImage object
    -490 **/
    -491 Karma.prototype.image = function ( args ) { return new KImage( args ) };
    -492 /**
    -493 A shortcut for calling 'KSound( )'
    -494 @see KSound
    -495 @memberOf Karma 
    -496 @returns {Object} new instance of KSound object
    -497 **/
    -498 Karma.prototype.sound = function ( args ) { return new KSound( args ) };
    -499 /**
    -500 A shortcut for calling 'KVideo( )'
    -501 @see KVideo
    -502 @memberOf Karma 
    -503 @returns {Object} new instance of KVideo object
    -504 **/
    -505 Karma.prototype.video = function ( args ) { alert("Not implemented yet"); };
    -506 /**
    -507 A shortcut for calling 'KGroup( )'
    -508 @see KGroup
    -509 @memberOf Karma 
    -510 @returns {Object} new instance of KGroup object
    -511 **/
    -512 Karma.prototype.group = function ( args ) { return new KGroup( args ) };
    -513 /**
    -514 A shortcut for calling 'KButton( )'
    -515 @see KButton
    -516 @memberOf Karma 
    -517 @returns {Object} new instance of KButton object
    -518 **/
    -519 Karma.prototype.button = function ( args ) { return new KButton( args ) };
    -520 /**
    -521 A shortcut for calling 'KSurface(.. )'.  
    -522 @see KSurface
    -523 @memberOf Karma 
    -524 @returns {Object} new instance of KSurface object 
    -525 **/
    -526 Karma.prototype.surface = function ( options ) {
    -527 	if ( !valid(options, "object") ){
    -528 		var options = { name: "ksurface-"+ ( this.surfaces.length + 1 ) };
    -529 	}
    -530 	options.mainContainer = this.container;
    -531 	options.paths = this.paths;
    -532 	this.surfaces[ options.name ] = new KSurface( options ); 
    -533 	return this.surface[ options.name ];
    -534 }
    -535 
    -536 /**
    -537 Mouse
    -538 **/
    -539 var mouse = {};
    -540 /**
    -541 Gets the 'x' and 'y' mouse coordinates relatives to the canvas  
    -542 @returns {Object} An Object with 'x' and 'y' attributes
    -543 **/
    -544 mouse.getRelativeCanvasPosition = function ( ev ) {
    -545 	if ( !ev ) return;
    -546 	var xy ={x:0, y:0};
    -547 	xy.x = ev.layerX;
    -548     xy.y = ev.layerY;
    -549 	return xy;
    -550 }
    -551 
    -552 //Events stuff
    -553 var master ={}
    -554 master.buttons =[];
    -555 var handleEvents = function( ev ) {
    -556 	var xy = mouse.getRelativeCanvasPosition( ev  );
    -557 	for (var i in master.buttons) {
    -558 		if (master.buttons[i].isPointInPath( xy.x, xy.y) ){
    -559 			master.buttons[i].onClick( ev );
    -560 		}
    -561 	}
    -562 	/*switch(ev.type){
    -563 		case "click": break;
    -564 	}*/
    -565 	/*var s="";
    -566 	for (var i in ev) {
    -567 		s+=i+"="+ev[i]+"\n";
    -568 	}
    -569 	alert(s);*/
    -570 };
    -571 
    -572 /**
    -573 Master class creator. It will merge all the properties and methods of the 
    -574 recived arguments (objects) into one new class that wil be returned.
    -575 @returns {Object} The new class 
    -576 **/
    -577 var Class = function ( ) {
    -578 	var log="";
    -579 	var parents = [];
    -580 	for ( var i = 0; i < arguments.length; i++ ) {
    -581 		if ( arguments[i].prototype && arguments[i].init ) {
    -582 			parents.push( arguments[i].init );
    -583 		}
    -584 	}
    -585 	var o = function ( ) {
    -586 		//we inject all the init functions 
    -587 		/*for ( var i = 0; i < this.__parents.length; i++ ) {
    -588 			this.__parents[ i ].apply ( this, arguments );
    -589 		}*/
    -590 		//call the real  class init
    -591 		if ( this.init )
    -592 			this.init.apply( this, arguments );
    -593 	};
    -594 
    -595 	o.prototype ={};
    -596 	var a;
    -597 	for ( var i =0; i < arguments.length; i++) {
    -598 		a = arguments[i];
    -599 		log += "**" + typeof a+"\n";
    -600 		//if ( a === "function") {
    -601 		if (a.prototype) {
    -602 			for ( var j in a.prototype ) {
    -603 				//log += j+" = "+a.prototype[j]+"\n";
    -604 				o[ j ] = o.prototype[ j ] = a.prototype [ j ];
    -605 			}
    -606 		}
    -607 		else {
    -608 		//if ( typeof a === "object") {
    -609 			for (var j in a) {
    -610 				//log += j+" = "+a[j]+"\n";
    -611 				o[ j ] = o.prototype[ j ] = a [ j ];
    -612 			}
    -613 		}
    -614 		
    -615 	}
    -616 	o.prototype.__parents = parents;
    -617 	//alert( log );
    -618 	return  o; //(function ( ) { return new o( arguments );});
    -619 };
    -620 
    -621 /**
    -622 Creates a new surface. A surface is a 'canvas' element with additional methods
    -623 that makes easier its manipulation. <br>
    -624 There are 2 ways to create a new KSurface:
    -625 <ol>
    -626 	<li><b>Using an existing canvas element:</b>You must provide at least 
    -627 		the 'canvas' parameter. The 'name' is optional (if it's not provided the
    -628 		'canvas' parameter will be used).
    -629 	</li>
    -630 	<li><b>Creating a new canvas element:</b> A new 'canvas' element will be
    -631 		created and it will be appended to the specific 'container'. 
    -632 		You must provide at least the 'name' and 'container' parameters.
    -633 	</li>
    -634 </ol>
    -635 @class KSurface class
    -636 @param {object} options Constructor options.
    -637 @param {string} [options.name]  The desired name for the surface. The value must
    -638 	be unique among others KSurfaces-name objects.
    -639 @param {string} [options.canvas]  The name of the element. Commonly the 
    -640 	canvas-id value.
    -641 @param {string | object} [options.container] The the name of the container 
    -642 	element. Commonly a div-id value.
    -643 @param {number} [width=100] The width of the canvas.
    -644 @param {number} [height=100] The height of the canvas.
    -645 @param {number} [fps=24] The frames per second for any refresh operation.
    -646 @param {boolean} [visible=true] 'true' if the content is visible (will be drawn).
    -647 @memberOf_ Karma 
    -648 **/
    -649 var KSurface = Class(
    -650 	{
    -651 		init: function( options ){
    -652 			//fix the container
    -653 			if ( valid( options.container, "string" ) && !valid( options.canvas)
    -654 			) {
    -655 				var name=options.container;
    -656 				options.container = $( options.container )[ 0 ];
    -657 				if ( !valid (options.container) ){
    -658 					// the container must be created inside the mainContainer
    -659 					if ( !valid( options.mainContainer ) ){
    -660 						throw ("You need to create the Karma master container");
    -661 					}
    -662 					var div = document.createElement("div");
    -663 					div.id = name;
    -664 					options.container=options.mainContainer.appendChild( div );
    -665 				} 
    -666 			}else {
    -667 				if ( !valid( options.mainContainer ) ){
    -668 					throw ("You need to create the Karma master container");
    -669 				}
    -670 				options.container = options.mainContainer;
    -671 			}
    -672 			
    -673 			var defaultOptions = {
    -674 				//mainContainer: '',//must be overwritten by Karma.container
    -675 				name: '',//must be overwritten by the Karma.surface OR user
    -676 				container: '', //must be overwritten by Karma.container OR user
    -677 				
    -678 				width: 100,
    -679 				height: 100,
    -680 				fps: 24,
    -681 				visible: true
    -682 			}
    -683 			$.extend( this, defaultOptions, options);
    -684 			
    -685 			if ( !this.canvas ) {
    -686 				this.canvas = document.createElement("canvas");
    -687 				this.canvas.width  = this.width; 
    -688 				this.canvas.height = this.height;
    -689 				this.canvas.id = this.name;
    -690 				this.container.appendChild( this.canvas );
    -691 			}else {
    -692 			    this.canvas = document.getElementById( options.canvas );
    -693 			    if ( !this.canvas ){
    -694 					throw new Error ("The canvas id doesn't exist");
    -695 			    }
    -696 			    this.width = this.canvas.width;
    -697 			    this.height = this.canvas.height;
    -698 			    if (!this.name){
    -699 					this.name = this.canvas.id;
    -700 			    }
    -701 			}
    -702 			if ( this.canvas.getContext ) {
    -703 				this.ctx = this.canvas.getContext("2d");
    -704 			}else {
    -705 				throw new Error ("Your browser doesn't support canvas, \
    -706 				try the newest Firefox, Safari or Google Chrome");
    -707 			}
    -708 			//ctx methods chaining stuff
    -709 			var toChain = [
    -710 			"globalAlpha", "globalCompositeOperation", "lineWidth", "lineCap", 
    -711 			"lineJoin", "miterLimit", "font", "textAlign", "textBaseline", "save", 
    -712 			"restore", "scale", "rotate", "translate", "transform", "setTransform", 
    -713 			"clearRect", "fillRect", "strokeRect", "beginPath", "closePath", 
    -714 			"moveTo", "lineTo", "quadraticCurveTo", "bezierCurveTo", "arcTo", 
    -715 			"arc", "rect", "fill", "stroke", "clip", "fillText", "strokeText", 
    -716 			"measureText", "isPointInPath", "strokeStyle", "fillStyle", 
    -717 			"createLinearGradient", "createRadialGradient", "createPattern", 
    -718 			"shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor", 
    -719 			//"mozTextStyle", "mozDrawText", "mozMeasureText", "mozPathText", 
    -720 			"mozTextAlongPath", "drawImage", "getImageData", "putImageData", 
    -721 			"createImageData", "drawWindow"
    -722 			];
    -723 			var that=this;
    -724 			var chainMaker = function ( name ){
    -725 				that[ name ] = function ( ){
    -726 					var type = typeof that.ctx[name];
    -727 					if ( type === "function") {
    -728 						that.ctx[ name ].apply( that.ctx, arguments );
    -729 					}else if ( type === "string" ){
    -730 						that.ctx[ name ] = arguments[0];
    -731 					}else {
    -732 						throw ("wtf?!: impossible to chain " + name + "!");
    -733 					}
    -734 					return that;
    -735 				}
    -736 			}
    -737 			for (var i=0; i<toChain.length; i++){
    -738 				chainMaker(  toChain[ i ] );
    -739 			}
    -740 
    -741 			
    -742 			//events
    -743 			this.canvas.addEventListener("contextmenu", function(ev){
    -744 				//
    -745 				},false
    -746 			);
    -747 			this.canvas.addEventListener("click", 
    -748 				handleEvents,
    -749 				false
    -750 			);
    -751 			
    -752 		},
    -753 		/**
    -754 		Adds an event listener to the surface
    -755 		@param {string} type Event type
    -756 		@param {function} cb Function call back
    -757 		@param {boolean} [bubble=false] If the event must be captured on
    -758 			bubbling phase
    -759 		**/
    -760 		addEventListener : function ( type, cb, bubble ) {
    -761 			this.canvas.addEventListener( type, cb, bubble || false );
    +486 Gets the 'x' and 'y' mouse coordinates relatives to the canvas  
    +487 @returns {Object} An Object with 'x' and 'y' attributes
    +488 **/
    +489 mouse.getRelativeCanvasPosition = function ( ev ) {
    +490 	if ( !ev ) return;
    +491 	var xy ={x:0, y:0};
    +492 	xy.x = ev.layerX;
    +493     xy.y = ev.layerY;
    +494 	return xy;
    +495 }
    +496 
    +497 //Events stuff
    +498 var master ={}
    +499 master.buttons =[];
    +500 var handleEvents = function( ev ) {
    +501 	var xy = mouse.getRelativeCanvasPosition( ev  );
    +502 	for (var i in master.buttons) {
    +503 		if (master.buttons[i].isPointInPath( xy.x, xy.y) ){
    +504 			master.buttons[i].onClick( ev );
    +505 		}
    +506 	}
    +507 	/*switch(ev.type){
    +508 		case "click": break;
    +509 	}*/
    +510 	/*var s="";
    +511 	for (var i in ev) {
    +512 		s+=i+"="+ev[i]+"\n";
    +513 	}
    +514 	alert(s);*/
    +515 };
    +516 
    +517 /**
    +518 @returns {Object} A new class 
    +519 **/
    +520 var Class = function ( ) {
    +521 	var log="";
    +522 	var parents = [];
    +523 	for ( var i = 0; i < arguments.length; i++ ) {
    +524 		if ( arguments[i].prototype && arguments[i].init ) {
    +525 			parents.push( arguments[i].init );
    +526 		}
    +527 	}
    +528 	var o = function ( ) {
    +529 		//we inject all the init functions 
    +530 		/*for ( var i = 0; i < this.__parents.length; i++ ) {
    +531 			this.__parents[ i ].apply ( this, arguments );
    +532 		}*/
    +533 		//call the real  class init
    +534 		if ( this.init )
    +535 			this.init.apply( this, arguments );
    +536 	};
    +537 
    +538 	o.prototype ={};
    +539 	var a;
    +540 	for ( var i =0; i < arguments.length; i++) {
    +541 		a = arguments[i];
    +542 		log += "**" + typeof a+"\n";
    +543 		//if ( a === "function") {
    +544 		if (a.prototype) {
    +545 			for ( var j in a.prototype ) {
    +546 				//log += j+" = "+a.prototype[j]+"\n";
    +547 				o[ j ] = o.prototype[ j ] = a.prototype [ j ];
    +548 			}
    +549 		}
    +550 		else {
    +551 		//if ( typeof a === "object") {
    +552 			for (var j in a) {
    +553 				//log += j+" = "+a[j]+"\n";
    +554 				o[ j ] = o.prototype[ j ] = a [ j ];
    +555 			}
    +556 		}
    +557 		
    +558 	}
    +559 	o.prototype.__parents = parents;
    +560 	//alert( log );
    +561 	return  o; //(function ( ) { return new o( arguments );});
    +562 };
    +563 
    +564 /**
    +565 creates a new layer
    +566 @param {object} options
    +567 @param {string} [options.id] 
    +568 @param {string | object} [options.container]
    +569 @param {number} [width=100] 
    +570 @param {number} [height=100]
    +571 @param {number} [fps=24]
    +572 @param {boolean} [visible=true]
    +573 @memberOf Karma 
    +574 **/
    +575 var KLayer = Class(
    +576 	{
    +577 		init: function( options ){
    +578 			//fix the container
    +579 			if ( valid( options.container, "string" ) ) {
    +580 				var name=options.container;
    +581 				options.container = $( options.container )[ 0 ];
    +582 				if ( !valid (options.container) ){
    +583 					// the container must be created inside the mainContainer
    +584 					if ( !valid( options.mainContainer ) ){
    +585 						throw ("You need to create the Karma master container");
    +586 					}
    +587 					var div = document.createElement("div");
    +588 					div.id = name;
    +589 					options.container=options.mainContainer.appendChild( div );
    +590 				} 
    +591 			}else {
    +592 				if ( !valid( options.mainContainer ) ){
    +593 					throw ("You need to create the Karma master container");
    +594 				}
    +595 				options.container = options.mainContainer;
    +596 			}
    +597 			var defaultOptions = {
    +598 				//mainContainer: '',//must be overwritten by Karma.container
    +599 				id: '',//must be overwritten by the Karma.layer OR user
    +600 				container: '', //must be overwritten by Karma.container OR user
    +601 				paths: '',	//must be overwritten by Karma.paths
    +602 				width: 100,
    +603 				height: 100,
    +604 				fps: 24,
    +605 				visible: true
    +606 			}
    +607 			$.extend( this, defaultOptions, options);
    +608 			
    +609 			this.canvas = document.createElement("canvas");
    +610 			this.canvas.width  = this.width; 
    +611 			this.canvas.height = this.height;
    +612 			this.canvas.id = this.id;
    +613 			if ( this.canvas.getContext ) {
    +614 				this.ctx = this.canvas.getContext("2d");
    +615 				this.container.appendChild( this.canvas );
    +616 			}else {
    +617 				throw new Error ("Your browser doesn't support canvas, \
    +618 				try the newest Firefox, Safari or Google Chrome");
    +619 			}
    +620 			//events
    +621 			this.canvas.addEventListener("contextmenu", function(ev){
    +622 				//
    +623 				},false
    +624 			);
    +625 			this.canvas.addEventListener("click", 
    +626 				handleEvents,
    +627 				false
    +628 			);
    +629 		},
    +630 		/**
    +631 		Clears a rectangular area within the canvas
    +632 		@param {Number} [x=0] Start position of x
    +633 		@param {Number} [y=0] Start position of y
    +634 		@param {Number} [width=canvas width] Square width
    +635 		@param {Number} [height=canvas height] Square height
    +636 		**/
    +637 		clear : function ( x, y, width, height ) {
    +638 			this.ctx.clearRect(
    +639 				x || 0,
    +640 				y || 0, 
    +641 				width  || this.canvas.width, 
    +642 				height || this.canvas.width
    +643 			);
    +644 		},
    +645 		draw: function (  ) {
    +646 			
    +647 		}
    +648 	}
    +649 );
    +650 
    +651 /**
    +652 Karma basic Object 
    +653 @class The basic Karma object
    +654 @param {Object} [options] Options 
    +655 @param {String} [options.localized = true] The object will be localized
    +656 @memberOf Karma 
    +657 **/
    +658 var KObject = Class(
    +659 	{
    +660 		init: function ( options ) {
    +661 			if ( valid(options.localized, "boolean" ) ) {
    +662 				this.localized = options.localized;
    +663 			}else {
    +664 				this.localized = true;
    +665 			}
    +666 		}
    +667 	}
    +668 );
    +669 /**
    +670 Graphics basic Object
    +671 @class General methods for any Graphic object
    +672 @param {Object} [options] Options 
    +673 @param {Number} [options.x = 0] The 'x' position of the object
    +674 @param {Number} [options.y = 0] The 'y' position of the object
    +675 @param {Number} [options.z = 0] The 'z' index of the object
    +676 @param {Number} [options.width = 0] The 'width' of the object
    +677 @param {Number} [options.height = 0] The 'height' of the object
    +678 @param {Boolean} [options.visible = true] Defines if the object will be visible 
    +679 	when drawing
    +680 @augments KObject
    +681 @memberOf Karma 
    +682 **/
    +683 var KGraphic = Class(
    +684 	KObject,
    +685 	{
    +686 		init: function ( options ) {
    +687 			if ( valid( options.localized ) ) 
    +688 				KObject.init.call(this, options.localized );
    +689 			var defaultOptions = {
    +690 				x : 0,
    +691 				y : 0,
    +692 				z : 0,
    +693 				width: 0,
    +694 				height: 0,
    +695 				visible : true
    +696 			}
    +697 			$.extend( this, defaultOptions, options);
    +698 		},
    +699 		/**
    +700 		@memberOf KGraphic
    +701 		Determines if the 'x' and 'y' coodinates are inside the object.
    +702 		@returns {Boolean} 'true' if the coordinates are inside or on the border
    +703 			of the object, otherwise 'false'
    +704 		**/
    +705 		isPointInPath : function( x, y ) {
    +706 			return (this.x <= x &&  (this.x + this.width) >= x && 
    +707 					this.y <= y &&  (this.y+this.width)>=y); 
    +708 		},
    +709 		addEventListener : function (type, cb, bubble) {
    +710 			//FIXME
    +711 		}
    +712 	}
    +713 );
    +714 /**
    +715 Supports multiple objects
    +716 @class 
    +717 @memberOf Karma 
    +718 **/
    +719 var KGroup = Class(
    +720 	KGraphic,
    +721 	{
    +722 		init: function ( options ) {
    +723 			this.childNodes = [];
    +724 			this.sorted = true;
    +725 		},
    +726 		/**
    +727 		@memberOf KGroup
    +728 		Adds each argument passed to the funtion to chilNodes.
    +729 		@param {Array:KGraphic} arguments The elements to add to childNodes		
    +730 		@see KGroup#draw
    +731 		**/
    +732 		appendChild : function (  ) {
    +733 			if ( arguments.length > 0 ) {
    +734 				for ( var i = 0; i< arguments.length; i++) {
    +735 					this.childNodes.push ( arguments[ i ] );
    +736 				}
    +737 				this.sorted = false;
    +738 				
    +739 			}
    +740 		},
    +741 		removeChild: function () {
    +742 			//FIXME
    +743 		},
    +744 		/**
    +745 		@memberOf KGroup
    +746 		Draws all the elements in childNodes. The elements are drawed according
    +747 		to its 'z' (z-index) value.
    +748 		@see KGroup#appendChild
    +749 		**/
    +750 		draw : function() {
    +751 			if ( this.visible && this.childNodes.length > 0 ) {
    +752 				if ( !this.sorted ) {
    +753 					this.childNodes.sort ( function ( g1, g2 ) {
    +754 						return g1.z - g2.z;
    +755 					});
    +756 					this.sorted = true;
    +757 				}
    +758 				for (var i in this.childNodes) {
    +759 					this.childNodes[ i ].draw();
    +760 				}
    +761 			}
     762 		},
    -763 		/**
    -764 		Removes an event listener attached to the surface
    -765 		@param {string} type Event type
    -766 		@param {function} cb Function call back
    -767 		@param {boolean} [bubble=false] If the event must be captured on
    -768 			bubbling phase
    -769 		**/
    -770 		removeEventListener : function ( type, cb, bubble ) {
    -771 			this.canvas.removeEventListener( type, cb, bubble || false );
    -772 		},
    -773 		/**
    -774 		Clears a rectangular area within the canvas
    -775 		@param {Number} [x=0] Start position of x
    -776 		@param {Number} [y=0] Start position of y
    -777 		@param {Number} [width=canvas width] Square width
    -778 		@param {Number} [height=canvas height] Square height
    -779 		**/
    -780 		clear : function ( x, y, width, height ) {
    -781 			this.ctx.clearRect(
    -782 				x || 0,
    -783 				y || 0, 
    -784 				width  || this.width, 
    -785 				height || this.height
    -786 			);
    -787 		    return this;
    -788 		},
    -789 		draw: function (  ) {
    -790 			
    -791 		}
    -792 	}
    -793 );
    -794 
    -795 /**
    -796 Karma basic Object 
    -797 @class The basic Karma object
    -798 @param {Object} [options] Options 
    -799 @param {String} [options.localized = true] The object will be localized
    -800 @memberOf_ Karma 
    -801 **/
    -802 var KObject = Class(
    -803 	{
    -804 		init: function ( options ) {
    -805 			if ( valid(options.localized, "boolean" ) ) {
    -806 				this.localized = options.localized;
    -807 			}else {
    -808 				this.localized = true;
    -809 			}
    -810 		}
    -811 	}
    -812 );
    -813 /**
    -814 Graphics basic Object
    -815 @class General methods for any Graphic object
    -816 @param {object} [options] Options 
    -817 @param {number} [options.x = 0] The 'x' position of the object
    -818 @param {number} [options.y = 0] The 'y' position of the object
    -819 @param {number} [options.z = 0] The 'z' index of the object
    -820 @param {number} [options.width = 0] The 'width' of the object
    -821 @param {number} [options.height = 0] The 'height' of the object
    -822 @param {boolean} [options.visible = true] Defines if the object will be visible 
    -823 	when drawing
    -824 @augments KObject
    -825 @memberOf_ Karma 
    -826 **/
    -827 var KGraphic = Class(
    -828 	KObject,
    -829 	{
    -830 		init: function ( options ) {
    -831 			if ( valid( options.localized ) ) 
    -832 				KObject.init.call(this, options.localized );
    -833 			var defaultOptions = {
    -834 				x : 0,
    -835 				y : 0,
    -836 				z : 0,
    -837 				width: 0,
    -838 				height: 0,
    -839 				visible : true
    -840 			}
    -841 			$.extend( this, defaultOptions, options);
    -842 		},
    -843 		/**
    -844 		@memberOf KGraphic
    -845 		Determines if the 'x' and 'y' coodinates are inside the object.
    -846 		@returns {boolean} 'true' if the coordinates are inside or on the border
    -847 			of the object, otherwise 'false'
    -848 		**/
    -849 		isPointInPath : function( x, y ) {
    -850 			return (this.x <= x &&  (this.x + this.width) >= x && 
    -851 					this.y <= y &&  (this.y+this.width)>=y); 
    -852 		},
    -853 		addEventListener : function (type, cb, bubble) {
    -854 			//FIXME
    -855 		}
    -856 	}
    -857 );
    -858 /**
    -859 An object that collects multiple KGraphic objects. Supports multiple objects.
    -860 @class An object that collects multiple KGraphic objects 
    -861 @augments KGraphic
    -862 @memberOf_ Karma 
    -863 **/
    -864 var KGroup = Class(
    -865 	KGraphic,
    -866 	{
    -867 		init: function ( options ) {
    -868 			this.childNodes = [];
    -869 			this.sorted = true;
    -870 		},
    -871 		/**
    -872 		@memberOf KGroup
    -873 		Adds each argument passed to the funtion to chilNodes.
    -874 		@param {Array:KGraphic} arguments The elements to add to childNodes		
    -875 		@see KGroup#draw
    -876 		**/
    -877 		appendChild : function (  ) {
    -878 			if ( arguments.length > 0 ) {
    -879 				for ( var i = 0; i< arguments.length; i++) {
    -880 					this.childNodes.push ( arguments[ i ] );
    -881 				}
    -882 				this.sorted = false;
    -883 				
    -884 			}
    -885 		},
    -886 		removeChild: function () {
    -887 			//FIXME
    -888 		},
    -889 		/**
    -890 		@memberOf_ KGroup
    -891 		Draws all the elements in childNodes. The elements are drawn according
    -892 		to its 'z' (z-index) value.
    -893 		@see KGroup#appendChild
    -894 		**/
    -895 		draw : function() {
    -896 			if ( this.visible && this.childNodes.length > 0 ) {
    -897 				if ( !this.sorted ) {
    -898 					this.childNodes.sort ( function ( g1, g2 ) {
    -899 						return g1.z - g2.z;
    -900 					});
    -901 					this.sorted = true;
    -902 				}
    -903 				for (var i in this.childNodes) {
    -904 					this.childNodes[ i ].draw();
    -905 				}
    -906 			}
    -907 		},
    -908 		isPointInPath : function() {
    -909 			//TODO 
    -910 		}
    -911 		
    -912 	}
    -913 );
    -914 
    -915 /**
    -916 Graphics basic Media object.
    -917 @class General methods for any Graphic object
    -918 @param {String} file  The name of the file that must be loaded
    -919 @param {String} type 'image', 'sound' or 'video'
    -920 @param {Object} [options] Options that will be passed to the media element
    -921 	constructor  
    -922 @augments KObject
    -923 @memberOf_ Karma 
    -924 **/
    -925 var KMedia = Class(
    -926 	KObject,
    -927 	{
    -928 		init: function (file, type, options ) {
    -929 			if ( !file || !type ) {
    -930 				throw new Error ("file and type needed");
    -931 			}
    -932 			if ( valid ( options ) ) 
    -933 				KObject.init.call (this, options);
    -934 				
    -935 			this.file = file;
    -936 			this.type = type;
    -937 			
    -938 			this.status = undefined;
    -939 			this.path = undefined;
    -940 			this.media = undefined;
    -941 			switch ( this.type ) {
    -942 				case "image": this.media = new Image(); break;
    -943 				case "sound": this.media = new Audio(); break;
    -944 				default: throw new Error ("Media type not supported"); 
    -945 			}
    -946 			this.path = gk.paths[ this.type + "s" ][ 
    -947 				this.localized ? "localized": "generic" 
    -948 			];
    -949 			this.media.src = this.src = this.path + this.file;
    -950 
    -951 			var that = this;
    -952 			this.media.addEventListener("load", 
    -953 			function (e) { that.status = "loaded";}, false);
    -954 			this.media.addEventListener("error", 
    -955 			function (e) { that.status = "error";}, false);
    -956 			this.media.addEventListener("abort", 
    -957 			function (e) { that.status = "aborted";}, false);
    -958 		}
    -959 	}
    -960 );
    -961 
    -962 /**
    -963 Image object
    -964 @class General methods for any Image object
    -965 @param {Object} options Constructor arguments.
    -966 @param {Object} options.file The image file that will be loaded.
    -967 @augments KGraphic
    -968 @augments KMedia
    -969 @memberOf_ Karma 
    -970 **/
    -971 var KImage = Class(
    -972 	KGraphic,
    -973 	KMedia,
    -974 	{
    -975 		init: function ( options ) {
    -976 			if ( valid ( options, "string" ) ) {
    -977 				options = { file:options };
    -978 			}
    -979 			if ( valid( options ) ) {
    -980 				KGraphic.init.call(this, options);
    -981 				KMedia.init.call(this, options.file, "image", options );
    -982 			}
    -983 			var defaultOptions = {
    -984 				//w : undefined,
    -985 				//h : undefined,
    -986 			};
    -987 			$.extend( this, defaultOptions, options);
    -988 		},
    -989 		draw : function( ctx, x, y ) {
    -990 			if ( this.visible && this.isReady() ) {
    -991 				this.x = x || this.x;
    -992 				this.y = y || this.y;
    -993 				ctx.drawImage( this.media, this.x , this.y );
    -994 			}
    -995 		},
    -996 		/**
    -997 		Checks if the image has been loaded and fully decoded.
    -998 		@returns {boolean} 'true' or 'false' 
    -999 		**/
    -1000 		isReady : function () {
    -1001 			if ( !this.media.complete ) return false;
    -1002 			if ( !this.media.naturalWidth || this.media.naturalWidth === 0) 
    -1003 				return false;
    -1004 			return true;
    -1005 		}
    -1006 	}
    -1007 );
    -1008 
    -1009 /**
    -1010 Sound object
    -1011 @class General methods for any Sound object
    -1012 @param {Object} options Constructor arguments.
    -1013 @param {Object} options.file The image file that will be loaded.
    -1014 @augments KMedia
    -1015 @memberOf_ Karma 
    -1016 **/
    -1017 var KSound = Class(
    -1018 	/**@lends_ KMedia*/
    -1019 	KMedia,
    -1020 	{
    -1021 		init: function( options ) {
    -1022 			if ( valid ( options, "string" ) ) {
    -1023 				options = { file: options };
    -1024 			}
    -1025 			if ( valid( options ) ) {
    -1026 				KMedia.init.call(this, options.file, "sound", options );
    -1027 				//next line is important!
    -1028 				this.media.load();
    -1029 			}
    -1030 		},
    -1031 		/**
    -1032 		Checks if the image has been loaded and fully decoded.
    -1033 		@returns {boolean} 'true' or 'false' 
    -1034 		**/
    -1035 		isReady: function () {
    -1036 			return this.readyState === 4;
    -1037 		},
    -1038 		play: function (){
    -1039 			//hack to fix the audio "stuttering" problem
    -1040 			//more info: https://bugs.launchpad.net/karma/+bug/426108
    -1041 			this.media.currentTime = 0.1;
    -1042 			this.media.play();
    -1043 		}
    -1044 	}
    -1045 );
    -1046 
    -1047 /**
    -1048 Shape object
    -1049 @class General methods for any Shape object
    -1050 @param {object} options Constructor arguments.
    -1051 @param {boolean} [options.fill=true] 'true' if the Shape will be filled when 
    -1052 	drawing.
    -1053 @param {boolean} [options.stroke=true] 'true' if the stroke will be drawn.
    -1054 @param {color|string} [options.fillStyle="#000"] The fill style of the shape.
    -1055 @param {color|string} [options.strokeStyle="#000"] The stroke style of the shape.
    -1056 @augments KMedia
    -1057 @memberOf_ Karma 
    -1058 **/
    -1059 var KShape = Class(
    -1060 	/**@lends_ KGraphic*/
    -1061 	KGraphic,
    -1062 	{
    -1063 		init : function ( options ) {
    -1064 			if ( valid( options ) ) {
    -1065 				KGraphic.init.call(this, options );
    -1066 			}
    -1067 			var defaultOptions = {
    -1068 				fill:	true,
    -1069 				stroke: true,
    -1070 				fillStyle: '#000',
    -1071 				strokeStyle: '#000',
    -1072 				openPath : false
    -1073 			}
    -1074 			$.extend( this, defaultOptions, options);
    -1075 		},
    -1076 		draw : function ( ctx ) {
    -1077 			if ( this.visible ) {
    -1078 				ctx.fillStyle = this.fillStyle
    -1079 				ctx.strokeStyle= this.strokeStyle
    -1080 					if ( this.fill )
    -1081 						ctx.fill();
    -1082 					if ( this.stroke )
    -1083 						ctx.stroke();
    -1084 					if ( !this.openPath )
    -1085 						ctx.closePath();
    -1086 				ctx.restore();
    -1087 			}
    -1088 		}
    -1089 	}
    -1090 );
    -1091 /**
    -1092 Rectangle object
    -1093 @class General methods for a rectangle object
    -1094 @param {object} options Constructor arguments.
    -1095 @param {number} options.x The 'x' position.
    -1096 @param {number} options.y The 'y' position.
    -1097 @param {number} options.w The width of the rectangle. 
    -1098 @param {number} options.h The height of the rectangle.
    -1099 @augments KShape
    -1100 @memberOf_ Karma 
    -1101 **/
    -1102 var KRectangle = Class(
    -1103 	KShape,
    -1104 	{
    -1105 		init : function ( options ) {
    -1106 			//ADD multiple constructors support
    -1107 			//x,y,w,h
    -1108 			//w,y,w,h,options
    -1109 			if ( valid( options ) ) {
    -1110 				KShape.init.call(this, options );
    -1111 			}
    -1112 		},
    -1113 		draw : function ( ctx ) {
    -1114 			if ( this.visible ) {
    -1115 				ctx.save();
    -1116 				ctx.beginPath();
    -1117 				ctx.rect( this.x, this.y, this.width, this.height);
    -1118 				KShape.draw.call( this, ctx );
    -1119 			}
    -1120 		},
    -1121 	    clear : function ( ) {
    -1122 			if ( this.visible ) {
    -1123 				
    -1124 			}
    -1125 	    }	
    -1126 	}
    -1127 	
    -1128 );
    -1129 
    -1130 /**@class_ */
    -1131 var KButton = Class(
    -1132 	/**@lends_ KGraphic*/
    -1133 	KGraphic,
    -1134 	{
    -1135 		
    -1136 		init : function ( options ) {
    -1137 			//ADD multiple constructors support
    -1138 			//x,y,w,h
    -1139 			//w,y,w,h,options
    -1140 			if ( valid( options ) ) {
    -1141 				KGraphic.init.call(this, options );
    -1142 			}
    -1143 			this.name = options.name;
    -1144 			master.buttons.push(this);
    -1145 		},
    -1146 		draw : function ( ) {},
    -1147 		onClick : function() { } //callback
    -1148 	}
    -1149 );
    -1150 //
    -1151 /**
    -1152 Karma function. It's a shotcut for calling 'new Karma(..)'
    -1153 @param [options] Options passed to the Karma constructor
    -1154 @returns {Object} a new Karma object
    -1155 @see Karma
    -1156 **/
    -1157 $.karma = function (options) {
    -1158 	var k =new Karma( options );
    -1159 	return k;
    -1160 }
    -1161 })(jQuery);
    \ No newline at end of file +763
    isPointInPath : function() { +764 //TODO +765 } +766 +767 } +768 ); +769 +770 /** @memberOf Karma **/ +771 var KMedia = Class( +772 +773 KObject, +774 { +775 init: function (file, type, options ) { +776 if ( !file || !type ) { +777 throw new Error ("file and type needed"); +778 } +779 if ( valid ( options ) ) +780 KObject.init.call (this, options); +781 +782 this.file = file; +783 this.type = type; +784 +785 this.status = undefined; +786 this.path = undefined; +787 this.media = undefined; +788 switch ( this.type ) { +789 case "image": this.media = new Image(); break; +790 case "sound": this.media = new Audio(); break; +791 default: throw new Error ("Media type not supported"); +792 } +793 this.path = gk.paths[ this.type + "s" ][ +794 this.localized ? "localized": "generic" +795 ]; +796 this.media.src = this.src = this.path + this.file; +797 +798 var that = this; +799 this.media.addEventListener("load", +800 function (e) { that.status = "loaded";}, false); +801 this.media.addEventListener("error", +802 function (e) { that.status = "error";}, false); +803 this.media.addEventListener("abort", +804 function (e) { that.status = "aborted";}, false); +805 } +806 } +807 ); +808 +809 /** @memberOf Karma **/ +810 var KImage = Class( +811 KGraphic, +812 KMedia, +813 { +814 +815 init: function ( options ) { +816 if ( valid ( options, "string" ) ) { +817 options = { file:options }; +818 } +819 if ( valid( options ) ) { +820 KGraphic.init.call(this, options); +821 KMedia.init.call(this, options.file, "image", options ); +822 } +823 var defaultOptions = { +824 //w : undefined, +825 //h : undefined, +826 } +827 $.extend( this, defaultOptions, options); +828 }, +829 draw : function( ctx, x, y ) { +830 if ( this.visible && this.isReady() ) { +831 this.x = x || this.x; +832 this.y = y || this.y; +833 ctx.drawImage( this.media, this.x , this.y ); +834 } +835 }, +836 isReady : function () { +837 if ( !this.media.complete ) return false; +838 if ( !this.media.naturalWidth || this.media.naturalWidth === 0) +839 return false; +840 return true; +841 } +842 } +843 ); +844 /** +845 @class_ +846 @memberOf Karma +847 */ +848 var KSound = Class( +849 /**@lends_ KMedia*/ +850 KMedia, +851 { +852 init: function( options ) { +853 if ( valid ( options, "string" ) ) { +854 options = { file: options }; +855 } +856 if ( valid( options ) ) { +857 KMedia.init.call(this, options.file, "sound", options ); +858 //next line is important! +859 this.media.load(); +860 } +861 }, +862 isReady: function () { +863 return this.readyState === 4; +864 }, +865 play: function (){ +866 this.media.play(); +867 } +868 } +869 ); +870 /**@class_ +871 @memberOf Karma +872 */ +873 var KShape = Class( +874 /**@lends_ KGraphic*/ +875 KGraphic, +876 { +877 init : function ( options ) { +878 if ( valid( options ) ) { +879 KGraphic.init.call(this, options ); +880 } +881 var defaultOptions = { +882 fill: true, +883 stroke: true, +884 fillStyle: '#000', +885 strokeStyle: '#000', +886 openPath : false +887 } +888 $.extend( this, defaultOptions, options); +889 }, +890 draw : function ( ctx ) { +891 if ( this.visible ) { +892 ctx.fillStyle = this.fillStyle +893 ctx.strokeStyle= this.strokeStyle +894 if ( this.fill ) +895 ctx.fill(); +896 if ( this.stroke ) +897 ctx.stroke(); +898 if ( !this.openPath ) +899 ctx.closePath(); +900 ctx.restore(); +901 } +902 } +903 } +904 ); +905 /**@class_ */ +906 var KRectangle = Class( +907 KShape, +908 { +909 +910 init : function ( options ) { +911 //ADD multiple constructors support +912 //x,y,w,h +913 //w,y,w,h,options +914 if ( valid( options ) ) { +915 KShape.init.call(this, options ); +916 } +917 }, +918 draw : function ( ctx ) { +919 if ( this.visible ) { +920 ctx.save(); +921 ctx.beginPath(); +922 ctx.rect( this.x, this.y, this.width, this.height); +923 KShape.draw.call( this, ctx ); +924 } +925 }, +926 clear : function ( ) { +927 if ( this.visible ) { +928 +929 } +930 } +931 } +932 +933 ); +934 +935 /**@class_ */ +936 var KButton = Class( +937 /**@lends_ KGraphic*/ +938 KGraphic, +939 { +940 +941 init : function ( options ) { +942 //ADD multiple constructors support +943 //x,y,w,h +944 //w,y,w,h,options +945 if ( valid( options ) ) { +946 KGraphic.init.call(this, options ); +947 } +948 this.id = options.id; +949 master.buttons.push(this); +950 }, +951 draw : function ( ) {}, +952 onClick : function() { } //callback +953 } +954 ); +955 // +956 /** +957 Karma function. It's a shotcut for calling 'new Karma(..)' +958 @param [options] Options passed to the Karma constructor +959 @returns {Object} a new Karma object +960 **/ +961 $.karma = function (options) { +962 var k =new Karma( options ); +963 //var x = new KMedia( "file1", "image", {localized: true} ); +964 //var x = new KImage({file: "ball.png", localized: false, z: 0}); +965 +966 return k; +967 } +968 })(jQuery);
    \ No newline at end of file diff --git a/docs/symbols/src/test.js.html b/docs/symbols/src/test.js.html new file mode 100644 index 0000000..611d12b --- /dev/null +++ b/docs/symbols/src/test.js.html @@ -0,0 +1,73 @@ +
      1 
    +  2 /**
    +  3 * @fileOverview Contains karma library
    +  4 * @version 0.5
    +  5 * @author Felipe Lopez Toledo <zer.subzero@gmail.com>
    +  6 */
    +  7 
    +  8  
    +  9 /**
    + 10  * See (http://jquery.com/).
    + 11  * @class
    + 12  * @name jQuery
    + 13  * @exports $ as jQuery
    + 14 */
    + 15 
    + 16 
    + 17 
    + 18 (function ($) {
    + 19 
    + 20 var valid = function ( arg, type, toReturn ) {
    + 21 	if ( type ) {
    + 22 		if ( typeof arg === type ) {
    + 23 			if ( toReturn )
    + 24 				return toReturn;
    + 25 			return true;
    + 26 		}
    + 27 		return false
    + 28 	}
    + 29 	if ( typeof arg !== "undefined" ) return true;
    + 30 	return false;
    + 31 }
    + 32 
    + 33 /**
    + 34  * @class Represents a Karma (master) object.
    + 35  * @constructor
    + 36  * @memberOf jQuery
    + 37  * @returns {jQuery.Karma}
    + 38 */
    + 39 var Karma = function(options ) {
    + 40 
    + 41 };
    + 42 
    + 43 //
    + 44 /**
    + 45 @param {Object} [toLoad] The Object that has the arrays for preloading.
    + 46 @param {Array} [toLoad.images] The images 
    + 47 @param {Array} [toLoad.sounds] The sounds 
    + 48 @param {Array} [toLoad.videos] The videos 
    + 49 @memberOf jQuery.Karma
    + 50 @returns {Object} this
    + 51 **/
    + 52 Karma.prototype.init = function( toLoad ) {
    + 53 };
    + 54 
    + 55 /**
    + 56 Main function. Any Karma function call should be inside the callback function.
    + 57 The callback function will be executed when the preloading finishes.
    + 58 @param {Function} cb The callback funtion
    + 59 @memberOf jQuery.Karma
    + 60 @see Karma#init
    + 61 **/
    + 62 Karma.prototype.main = function ( cb ) {
    + 63 };
    + 64 
    + 65 
    + 66 })(jQuery);
    \ No newline at end of file -- cgit v0.9.1
    Class SummaryNamespace Summary
    Constructor Attributes<inner>  
    Graphics basic Object