Make UUID creator available for everyone
parent
b04756a520
commit
76b0fc04f8
|
@ -111,10 +111,7 @@ H5P.XAPIEvent.prototype.setActor = function() {
|
|||
uuid = localStorage.H5PUserUUID;
|
||||
}
|
||||
else {
|
||||
uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(char) {
|
||||
var random = Math.random()*16|0, newChar = char === 'x' ? random : (random&0x3|0x8);
|
||||
return newChar.toString(16);
|
||||
});
|
||||
uuid = H5P.createUUID();
|
||||
localStorage.H5PUserUUID = uuid;
|
||||
}
|
||||
this.data.statement.actor = {
|
||||
|
|
12
js/h5p.js
12
js/h5p.js
|
@ -1391,6 +1391,18 @@ H5P.on = function(instance, eventType, handler) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create UUID
|
||||
*
|
||||
* @returns {String} UUID
|
||||
*/
|
||||
H5P.createUUID = function() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(char) {
|
||||
var random = Math.random()*16|0, newChar = char === 'x' ? random : (random&0x3|0x8);
|
||||
return newChar.toString(16);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
H5P.jQuery(document).ready(function () {
|
||||
if (!H5P.preventInit) {
|
||||
|
|
Loading…
Reference in New Issue