Added adding of slides.

Added cloning of slides.
Added deleting of slides.
Added clone function to h5p.js
Renamed editor library.
namespaces
Frode Petterson 2013-04-04 14:58:17 +02:00
parent 64eda45a14
commit 63de4a6982
1 changed files with 24 additions and 0 deletions

View File

@ -182,6 +182,30 @@ H5P.playVideo = function ($target, params, skipButtonText, cp, onEnded) {
$target.append($container); $target.append($container);
}; };
/**
* Recursivly clone the given object.
*
* @param {object} object Object to clone.
* @param {type} recursive
* @returns {object} A clone of object.
*/
H5P.cloneObject = function (object, recursive) {
var clone = {};
for (var i in object) {
if (object.hasOwnProperty(i)) {
if (recursive !== undefined && recursive && typeof object[i] === 'object') {
clone[i] = object[i] instanceof Array ? object[i].slice() : H5P.cloneObject(object[i]);
}
else {
clone[i] = object[i];
}
}
}
return clone;
};
// We have several situations where we want to shuffle an array, extend array // We have several situations where we want to shuffle an array, extend array
// to do so. // to do so.
Array.prototype.shuffle = function() { Array.prototype.shuffle = function() {