Add custom xAPI events for action toolbar buttons

JI-92-path-fix
Frode Petterson 2017-01-31 13:35:23 +01:00
parent 9abe7ef321
commit e548b3575f
2 changed files with 9 additions and 1 deletions

View File

@ -308,5 +308,10 @@ H5P.XAPIEvent.allowedXAPIVerbs = [
'shared',
'suspended',
'terminated',
'voided'
'voided',
// Custom verbs used for action toolbar below content
'downloaded',
'accessed-embed',
'accessed-copyright'
];

View File

@ -158,16 +158,19 @@ H5P.init = function (target) {
actionBar.on('download', function () {
window.location.href = contentData.exportUrl;
instance.triggerXAPI('downloaded');
});
actionBar.on('copyrights', function () {
var dialog = new H5P.Dialog('copyrights', H5P.t('copyrightInformation'), copyrights, $container);
dialog.open();
instance.triggerXAPI('accessed-copyright');
});
actionBar.on('embed', function () {
H5P.openEmbedDialog($actions, contentData.embedCode, contentData.resizeCode, {
width: $element.width(),
height: $element.height()
});
instance.triggerXAPI('accessed-embed');
});
if (actionBar.hasActions()) {