From 9fc5f82b2f95cd94550ab86e8725bbe36f3ef169 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Thu, 12 Feb 2015 11:52:55 +0100 Subject: [PATCH] Fixed empty frame. --- js/h5p.js | 62 +++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index df93a0c..9381c3e 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -88,40 +88,38 @@ H5P.init = function () { }); } - if (contentData.disable & H5P.DISABLE_FRAME) { - $element.addClass('h5p-no-frame'); + // Create action bar + var $actions = H5P.jQuery(''); + + if (!(contentData.disable & H5P.DISABLE_DOWNLOAD)) { + // Add export button + H5P.jQuery('
  • ' + H5P.t('download') + '
  • ').appendTo($actions).click(function () { + window.location.href = contentData.exportUrl; + }); + } + if (!(contentData.disable & H5P.DISABLE_COPYRIGHT) && instance.getCopyrights !== undefined) { + // Add copyrights button + H5P.jQuery('
  • ' + H5P.t('copyrights') + '
  • ').appendTo($actions).click(function () { + H5P.openCopyrightsDialog($actions, instance, library.params, contentId); + }); + } + if (!(contentData.disable & H5P.DISABLE_EMBED)) { + // Add embed button + H5P.jQuery('
  • ' + H5P.t('embed') + '
  • ').appendTo($actions).click(function () { + H5P.openEmbedDialog($actions, contentData.embedCode); + }); + } + if (!(contentData.disable & H5P.DISABLE_ABOUT)) { + // Add about H5P button icon + H5P.jQuery('
  • ').appendTo($actions); + } + + // Insert action bar if it has any content + if ($actions.children().length) { + $actions.insertAfter($container); } else { - // Create action bar - var $actions = H5P.jQuery(''); - - if (!(contentData.disable & H5P.DISABLE_DOWNLOAD)) { - // Add export button - H5P.jQuery('
  • ' + H5P.t('download') + '
  • ').appendTo($actions).click(function () { - window.location.href = contentData.exportUrl; - }); - } - if (!(contentData.disable & H5P.DISABLE_COPYRIGHT) && instance.getCopyrights !== undefined) { - // Add copyrights button - H5P.jQuery('
  • ' + H5P.t('copyrights') + '
  • ').appendTo($actions).click(function () { - H5P.openCopyrightsDialog($actions, instance, library.params, contentId); - }); - } - if (!(contentData.disable & H5P.DISABLE_EMBED)) { - // Add embed button - H5P.jQuery('
  • ' + H5P.t('embed') + '
  • ').appendTo($actions).click(function () { - H5P.openEmbedDialog($actions, contentData.embedCode); - }); - } - if (!(contentData.disable & H5P.DISABLE_ABOUT)) { - // Add about H5P button icon - H5P.jQuery('
  • ').appendTo($actions); - } - - // Insert action bar if it has any content - if ($actions.children().length) { - $actions.insertAfter($container); - } + $element.addClass('h5p-no-frame'); } // Keep track of when we started