This is the main method of JClic

Executes on document.ready().

The method iterates over all div objects with JClic class and creates a JClicPlayer
within them. Each player loads the JClic project file specified in the data-project attribute of
the div tag.

The div elements must preferabily be empty. Inner content may become overlapped by objects
created by the JClic player.

This method exports the global variable window.JClicObject, useful when other scripts
need to make direct calls to the main components of JClic.

The main members of the global variable JClicObject are:

  • JClicObject.JClicPlayer (the module:JClicPlayer object)
  • JClicObject.JClicProject (the module:JClicProject object)
  • JClicObject.AWT (the module:AWT object)
  • JClicObject.Utils (the module:Utils object)
  • JClicObject.$ (the JQuery object)
  • JClicObject.options (the main options loaded at startup, usually the content of the global variable JClicDataOptions)
  • JClicObject.projectFiles (used by JSONP to store the content of some files when inaccessible to the browser because CORS or other restrictions)
  • JClicObject.currentPlayers (array with references to the players currently running)
  • JClicObject.loadProject (a function that starts a JClicPlayer on a specific div)

Examples

<caption>
Creates a JClic div and loads "myproject.jclic" on it:
</caption><div class ="JClic" data-project="myproject.jclic"></div>
<caption>
Creates a JClic div that loads "myproject.jclic" with additional parameters, passed as a JSON string.
Note that `data-options` should be delimited by apostrophes `'` because quotation marks `"` are used
for JSON keys and values:
</caption><div class ="JClic" data-project="myproject.jclic" data-options='{"fade":"400","lang":"es","reporter":"TCPReporter","user":"test01","path":"localhost:9090"}'></div>

Methods

(static) loadProject(div, projectName, optionsopt) → {module:JClicPlayer.JClicPlayer}

Creates a new JClicPlayer hosted on the specified div, and loads an specific project on it.

Parameters:
NameTypeAttributesDescription
divexternal:HTMLElement

The HTML element (usually a <div/>) that will be used as a main container of the player.

projectNamestring

The file name or URL of the JClic project to be loaded

optionsobject<optional>

An optional set of preferences