Adding full versioning support

namespaces
Svein-Tore Griff With 2013-03-06 15:59:02 +01:00
parent 517f7e6e9d
commit 45386f7825
1 changed files with 21 additions and 0 deletions

View File

@ -58,6 +58,27 @@ H5P.Coords = function(x, y, w, h) {
return this;
};
/**
*@param {string} library
* 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
*/
H5P.libraryFromString = function (library) {
var regExp = /(.+)\s(\d)+\.(\d)$/g;
var res = regExp.exec(library);
if (res !== null) {
return {
'machineName': res[1],
'majorVersion': res[2],
'minorVersion': res[3]
};
}
else {
return false;
}
};
// Play a video. $target is jQuery object to attach video to. (Appended).
// Params are video-params from content. cp is content path. onEnded is
// function to call when finished.