diff --git a/documentation-tool.js b/documentation-tool.js index f92b29f..7886aea 100644 --- a/documentation-tool.js +++ b/documentation-tool.js @@ -343,6 +343,10 @@ H5P.DocumentationTool = (function ($, NavigationMenu, JoubelUI, EventDispatcher) DocumentationTool.prototype.movePage = function (toPageIndex, skipFocus) { var self = this; + if (!toPageIndex) { + return; + } + // Invalid value if ((toPageIndex + 1 > this.$pagesArray.length) || (toPageIndex < 0)) { return; @@ -383,6 +387,9 @@ H5P.DocumentationTool = (function ($, NavigationMenu, JoubelUI, EventDispatcher) // Trigger xAPI event var progressedEvent = self.createXAPIEventTemplate('progressed'); + if (progressedEvent.data.statement.object.definition.extensions === undefined) { + return; + } progressedEvent.data.statement.object.definition.extensions['http://id.tincanapi.com/extension/ending-point'] = toPageIndex; self.trigger(progressedEvent); diff --git a/navigation-menu.js b/navigation-menu.js index ee2d076..32b6ee9 100644 --- a/navigation-menu.js +++ b/navigation-menu.js @@ -92,6 +92,9 @@ H5P.DocumentationTool.NavigationMenu = (function ($, EventDispatcher) { self.$documentationToolContaner.removeClass('expanded'); self.docTool.movePage(pageIndex, event); var progressedEvent = self.docTool.createXAPIEventTemplate('progressed'); // Using the parent documentation tool to create xapi template + if (progressedEvent.data.statement.object.definition.extensions === undefined) { + return; + } progressedEvent.data.statement.object.definition.extensions['http://id.tincanapi.com/extension/ending-point'] = pageIndex; self.trigger(progressedEvent); });