From e548b3575f0396440f42453abb11dd6f0a95f1cc Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Tue, 31 Jan 2017 13:35:23 +0100 Subject: [PATCH] Add custom xAPI events for action toolbar buttons --- js/h5p-x-api-event.js | 7 ++++++- js/h5p.js | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/js/h5p-x-api-event.js b/js/h5p-x-api-event.js index cc7fd66..e5d6368 100644 --- a/js/h5p-x-api-event.js +++ b/js/h5p-x-api-event.js @@ -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' ]; diff --git a/js/h5p.js b/js/h5p.js index e4d0138..88a9666 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -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()) {