From ec4678bf0ba6c5cf70f5b27ffbc6bb2b8c0c89c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20J=C3=B8rgensen?= Date: Tue, 30 Dec 2014 10:54:26 +0100 Subject: [PATCH] Fixed issue #2397891 (drupal.org), and made jshint a little happier --- js/h5p-embed.js | 2 +- js/h5p.js | 44 ++++++++++++++++++++++---------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/js/h5p-embed.js b/js/h5p-embed.js index b1b58c3..deeab96 100644 --- a/js/h5p-embed.js +++ b/js/h5p-embed.js @@ -90,7 +90,7 @@ var H5P = H5P || (function () { loadContent(contentId, h5ps[i]); contentId++; } - }; + } /** * Return integration object diff --git a/js/h5p.js b/js/h5p.js index 7a054b3..3afb4c4 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -164,21 +164,21 @@ H5P.xAPIListener = function(event) { H5P.setFinished(contentId, score, maxScore); } } -} +}; H5P.xAPIEmitter = function (event) { if (event.statement !== undefined) { for (var i = 0; i < H5P.xAPIListeners.length; i++) { - H5P.xAPIListeners[i](event.statement) + H5P.xAPIListeners[i](event.statement); } } -} +}; H5P.xAPIListeners = []; H5P.onXAPI = function(listener) { H5P.xAPIListeners.push(listener); -} +}; H5P.onXAPI(function(statement) { console.log(statement); @@ -449,7 +449,7 @@ H5P.EventEnabled.prototype.on = function(type, listener) { } this.listeners[type].push(listener); } -} +}; H5P.EventEnabled.prototype.off = function (type, listener) { if (this.listeners[type] !== undefined) { @@ -458,7 +458,7 @@ H5P.EventEnabled.prototype.off = function (type, listener) { listeners[type].splice(removeIndex, 1); } } -} +}; H5P.EventEnabled.prototype.trigger = function (type, event) { if (event === null) { @@ -469,16 +469,16 @@ H5P.EventEnabled.prototype.trigger = function (type, event) { this.listeners[type][i](event); } } -} +}; H5P.Event = function() { // We're going to add bubbling, propagation and other features here later -} +}; H5P.XAPIEvent = function() { H5P.Event.call(this); this.statement = {}; -} +}; H5P.XAPIEvent.prototype = Object.create(H5P.Event.prototype); H5P.XAPIEvent.prototype.constructor = H5P.XAPIEvent; @@ -490,8 +490,8 @@ H5P.XAPIEvent.prototype.setScoredResult = function(score, maxScore) { 'max': maxScore, 'raw': score } - } -} + }; +}; H5P.XAPIEvent.prototype.setVerb = function(verb) { if (H5P.jQuery.inArray(verb, H5P.XAPIEvent.allowedXAPIVerbs) !== -1) { @@ -500,13 +500,13 @@ H5P.XAPIEvent.prototype.setVerb = function(verb) { 'display': { 'en-US': verb } - } + }; } else { console.log('illegal verb'); } // Else: Fail silently... -} +}; H5P.XAPIEvent.prototype.setObject = function(instance) { this.statement.object = { @@ -514,17 +514,17 @@ H5P.XAPIEvent.prototype.setObject = function(instance) { 'id': window.location.origin + Drupal.settings.basePath + 'node/' + instance.contentId, //'contentId': instance.contentId, 'objectType': 'Activity' - } -} + }; +}; H5P.XAPIEvent.prototype.setActor = function() { this.statement.actor = H5P.getActor(); -} +}; H5P.EventEnabled.prototype.triggerXAPI = function(verb, extra) { var event = this.createXAPIEventTemplate(verb, extra); this.trigger('xAPI', event); -} +}; H5P.EventEnabled.prototype.createXAPIEventTemplate = function(verb, extra) { var event = new H5P.XAPIEvent(); @@ -540,17 +540,17 @@ H5P.EventEnabled.prototype.createXAPIEventTemplate = function(verb, extra) { event.setObject(this); } return event; -} +}; H5P.getActor = function() { var user = H5PIntegration.getUser(); return { 'name': user.name, - 'mbox': 'mailto:' . user.mail, + 'mbox': 'mailto:' + user.mail, 'objectType': 'Agent' - } -} + }; +}; H5P.XAPIEvent.allowedXAPIVerbs = [ 'answered', @@ -578,7 +578,7 @@ H5P.XAPIEvent.allowedXAPIVerbs = [ 'suspended', 'terminated', 'voided' -] +]; /** * Used to print useful error messages.