From ecb795f655b7c0deae1f453fdabb93dfea7109d7 Mon Sep 17 00:00:00 2001 From: Svein-Tore Griff With Date: Thu, 17 Jan 2013 22:20:41 +0100 Subject: [PATCH] Make it possible to have multiple content on one page, and also make it possible to get path to content folder --- js/h5p.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index 4eb8c80..b65fbaf 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -4,13 +4,18 @@ window.H5P = window.H5P || {}; // Initialize H5P content // Scans for ".h5p-content" H5P.init = function () { - $(".h5p-content").each(function (idx, el) { + H5P.jQuery(".h5p-content").each(function (idx, el) { var $el = H5P.jQuery(el); - var obj = new (H5P.classFromName($el.data('class')))(H5P.jQuery.parseJSON(Drupal.settings.h5p.jsonContent)); + var contentId = $el.data('content-id'); + var obj = new (H5P.classFromName($el.data('class')))(H5P.jQuery.parseJSON(H5PIntegration.getJsonContent(contentId)), contentId); obj.attach($el); }); }; +H5P.getContentPath = function(contentId) { + H5PIntegration.getContentPath(contentId); +} + // // Used from libraries to construct instances of other libraries' objects by // name.