-
-
jQuery instance of current window.
Type:
-
<static> canHasFullScreen :boolean
-
Type:
- Deprecated:
-
-
<static> communicator :Communicator
-
When embedded the communicator helps talk to the parent page.
Type:
-
<static> copyrightLicenses :Object
-
Maps copyright license codes to their human readable counterpart.
Type:
-
-
The external event dispatcher. Others, outside of H5P may register and
listen for H5P Events here.
Type:
-
<static> externalEmbed :boolean
-
Indicates if H5P is embedded on an external page using iframe.
Type:
-
<static> fullScreenBrowserPrefix :string
-
Browser prefix to use when entering fullscreen mode.
undefined means no fullscreen support.
Type:
-
<static> fullscreenSupported :boolean
-
Use this variable to check if fullscreen is supported. Fullscreen can be
restricted when embedding since not all browsers support the native
fullscreen, and the semi-fullscreen solution doesn't work when embedded.
Type:
-
<static> instances :Array
-
List over H5P instances on the current page.
Type:
-
<static> isFramed :boolean
-
Tells us if we're inside of an iframe.
Type:
-
<static> jQuery
-
jQuery v1.9.1
-
<static> opened :Array.<Object>
-
Keep track of when the H5Ps where started.
Type:
-
<static> preventInit :boolean
-
Prevent H5P Core from initializing. Must be overriden before document ready.
Type:
-
<static> classFromName(name) → {Object}
-
Get library class constructor from H5P by classname.
Note that this class will only work for resolve "H5P.NameWithoutDot".
Also check out
H5P.newRunnable
Used from libraries to construct instances of other libraries' objects by name.
Parameters:
Name |
Type |
Description |
name |
string
|
Name of library |
Returns:
Class constructor
-
Type
-
Object
-
<static> cloneObject(object, recursive) → {Object|Array}
-
Recursivly clone the given object.
Parameters:
Name |
Type |
Argument |
Description |
object |
Object
|
Array
|
|
Object to clone. |
recursive |
boolean
|
<optional>
|
|
Returns:
A clone of object.
-
Type
-
Object
|
Array
-
<static> createTitle(rawTitle, maxLength) → {string}
-
Create title
Parameters:
Name |
Type |
Description |
rawTitle |
string
|
|
maxLength |
number
|
|
Returns:
-
Type
-
string
-
<static> createUUID() → {string}
-
Generate random UUID
Returns:
UUID
-
Type
-
string
-
<static> cssLoaded(path) → {boolean}
-
Check if styles path/key is loaded.
Parameters:
Name |
Type |
Description |
path |
string
|
|
Returns:
-
Type
-
boolean
-
<static> deleteUserData(contentId, dataId, subContentId)
-
Delete user data for given content.
Parameters:
Name |
Type |
Argument |
Description |
contentId |
number
|
|
What content to remove data for. |
dataId |
string
|
|
Identifies the set of data for this content. |
subContentId |
string
|
<optional>
|
Identifies which data belongs to sub content. |
-
<static> error(err)
-
Used to print useful error messages. (to JavaScript error console)
Parameters:
Name |
Type |
Description |
err |
*
|
Error to print. |
-
<static> findCopyrights(info, parameters, contentId)
-
Gather a flat list of copyright information from the given parameters.
Parameters:
Name |
Type |
Description |
info |
H5P.ContentCopyrights
|
Used to collect all information in. |
parameters |
Object
|
Array
|
To search for file objects in. |
contentId |
number
|
Used to insert thumbnails for images. |
-
<static> fullScreen($element, instance, exitCallback, $body, forceSemiFullScreen)
-
Enter fullscreen for the given H5P instance.
Parameters:
Name |
Type |
Description |
$element |
H5P.jQuery
|
Content container. |
instance |
Object
|
|
exitCallback |
function
|
Callback function called when user exits fullscreen. |
$body |
H5P.jQuery
|
For internal use. Gives the body of the iframe. |
forceSemiFullScreen |
Boolean
|
|
-
<static> getContentPath(contentId) → {string}
-
THIS FUNCTION IS DEPRECATED, USE getPath INSTEAD
Will be remove march 2016.
Find the path to the content files folder based on the id of the content
Parameters:
Name |
Type |
Description |
contentId |
|
Id of the content requesting the path |
- Deprecated:
-
- Will be removed march 2016.
Returns:
URL
-
Type
-
string
-
<static> getCopyrights(instance, parameters, contentId) → {string}
-
Gather copyright information for the given content.
Parameters:
Name |
Type |
Description |
instance |
Object
|
H5P instance to get copyright information for. |
parameters |
Object
|
Parameters of the content instance. |
contentId |
number
|
Identifies the H5P content |
Returns:
Copyright information.
-
Type
-
string
-
<static> getLibraryPath(library) → {string}
-
Get the path to the library
Parameters:
Name |
Type |
Description |
library |
string
|
The library identifier in the format "machineName-majorVersion.minorVersion". |
Returns:
The full path to the library.
-
Type
-
string
-
<static> getPath(path, contentId) → {string}
-
Find the path to the content files based on the id of the content.
Also identifies and returns absolute paths.
Parameters:
Name |
Type |
Description |
path |
string
|
Relative to content folder or absolute. |
contentId |
number
|
ID of the content requesting the path. |
Returns:
Complete URL to path.
-
Type
-
string
-
<static> getUserData(contentId, dataId, done, subContentId)
-
Get user data for given content.
Parameters:
Name |
Type |
Argument |
Description |
contentId |
number
|
|
What content to get data for. |
dataId |
string
|
|
Identifies the set of data for this content. |
done |
function
|
|
Callback with error and data parameters. |
subContentId |
string
|
<optional>
|
Identifies which data belongs to sub content. |
-
<static> init(target)
-
Initialize H5P content.
Scans for ".h5p-content" in the document and initializes H5P instances where found.
Parameters:
Name |
Type |
Description |
target |
Object
|
DOM Element |
-
<static> jsLoaded(path) → {boolean}
-
Check if JavaScript path/key is loaded.
Parameters:
Name |
Type |
Description |
path |
string
|
|
Returns:
-
Type
-
boolean
-
<static> libraryFromString(library) → {Object}
-
Parse library string into values.
Parameters:
Name |
Type |
Description |
library |
string
|
library in the format "machineName majorVersion.minorVersion" |
Returns:
library as an object with machineName, majorVersion and minorVersion properties
return false if the library parameter is invalid
-
Type
-
Object
-
<static> newRunnable(library, contentId, $attachTo, skipResize, extras) → {Object}
-
A safe way of creating a new instance of a runnable H5P.
Parameters:
Name |
Type |
Argument |
Description |
library |
Object
|
|
Library/action object form params. |
contentId |
number
|
|
Identifies the content. |
$attachTo |
H5P.jQuery
|
<optional>
|
Element to attach the instance to. |
skipResize |
boolean
|
<optional>
|
Skip triggering of the resize event after attaching. |
extras |
Object
|
<optional>
|
Extra parameters for the H5P content constructor |
Returns:
Instance.
-
Type
-
Object
-
<static> on(instance, eventType, handler)
-
Register an event handler
Helper function that registers an event handler for an event type if
the instance supports event handling
Parameters:
Name |
Type |
Description |
instance |
Object
|
Instance of H5P content |
eventType |
string
|
Type of event to listen for |
handler |
H5P.EventCallback
|
Callback that gets triggered for events of the specified type |
-
<static> openEmbedDialog($element, embedCode, resizeCode, size)
-
Display a dialog containing the embed code.
Parameters:
Name |
Type |
Description |
$element |
H5P.jQuery
|
Element to insert dialog after. |
embedCode |
string
|
The embed code. |
resizeCode |
string
|
The advanced resize code |
size |
Object
|
The content's size.
Properties
Name |
Type |
Description |
width |
number
|
|
height |
number
|
|
|
-
<static> semiFullScreen($element, instance, exitCallback, $body)
-
Enter semi fullscreen for the given H5P instance
Parameters:
Name |
Type |
Description |
$element |
H5P.jQuery
|
Content container. |
instance |
Object
|
|
exitCallback |
function
|
Callback function called when user exits fullscreen. |
$body |
H5P.jQuery
|
For internal use. Gives the body of the iframe. |
-
<static> setFinished(contentId, score, maxScore, time)
-
Post finished results for user.
Parameters:
Name |
Type |
Argument |
Description |
contentId |
number
|
|
Identifies the content |
score |
number
|
|
Achieved score/points |
maxScore |
number
|
|
The maximum score/points that can be achieved |
time |
number
|
<optional>
|
Reported time consumption/usage |
- Deprecated:
-
- Do not use this function directly, trigger the finish event instead.
Will be removed march 2016
-
<static> setUserData(contentId, dataId, data, extras)
-
Set user data for given content.
Parameters:
Name |
Type |
Argument |
Description |
contentId |
number
|
|
What content to get data for. |
dataId |
string
|
|
Identifies the set of data for this content. |
data |
Object
|
|
The data that is to be stored. |
extras |
Object
|
<optional>
|
Extra properties
Properties
Name |
Type |
Argument |
Default |
Description |
subContentId |
string
|
<optional>
|
|
Identifies which data belongs to sub content. |
preloaded |
boolean
|
<optional>
|
true
|
If the data should be loaded when content is loaded. |
deleteOnChange |
boolean
|
<optional>
|
false
|
If the data should be invalidated when the content changes. |
errorCallback |
H5P.ErrorCallback
|
<optional>
|
|
Callback with error as parameters. |
async |
boolean
|
<optional>
|
true
|
|
|
-
<static> shuffleArray(array) → {Array}
-
Shuffle an array in place.
Parameters:
Name |
Type |
Description |
array |
Array
|
Array to shuffle |
Returns:
The passed array is returned for chaining.
-
Type
-
Array
-
<static> t(key, vars, ns) → {string}
-
Translate text strings.
Parameters:
Name |
Type |
Argument |
Description |
key |
string
|
|
Translation identifier, may only contain a-zA-Z0-9. No spaces or special chars. |
vars |
Object
|
<optional>
|
Data for placeholders. |
ns |
string
|
<optional>
|
Translation namespace. Defaults to H5P. |
Returns:
Translated text
-
Type
-
string
-
<static> trigger(instance, eventType, data, extras)
-
Trigger an event on an instance
Helper function that triggers an event if the instance supports event handling
Parameters:
Name |
Type |
Description |
instance |
Object
|
Instance of H5P content |
eventType |
string
|
Type of event to trigger |
data |
*
|
|
extras |
Object
|
|
-
<static> trim(value) → {string}
-
Remove all empty spaces before and after the value.
Parameters:
Name |
Type |
Description |
value |
string
|
|
Returns:
-
Type
-
string
-
<static> xAPICompletedListener(event)
-
Internal H5P function listening for xAPI completed events and stores scores
Parameters: