Skip to content

Commit 475e6f3

Browse files
committed
Fix typo, add control on completion enable
1 parent ace7bbb commit 475e6f3

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

amd/build/embed.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/embed.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/src/embed.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ define(['jquery', 'mod_hvp/communicator'], function($, H5PEmbedCommunicator) {
2222
var resizeDelay;
2323
var instance = H5P.instances[0];
2424
var parentIsFriendly = false;
25-
var completionactivity = document.getElementsByClassName('activity-header')[0];
26-
var comnpletionmargin = document.defaultView.getComputedStyle(completionactivity, '')
27-
.getPropertyValue('margin-bottom');
28-
var completionheight = completionactivity.scrollHeight + parseInt(comnpletionmargin, 10); // We want the first element.
25+
var completionheight = 0;
26+
if (globalThis.completion) {
27+
var completionactivity = document.getElementsByClassName('activity-header')[0];
28+
var completionmargin = document.defaultView.getComputedStyle(completionactivity, '')
29+
.getPropertyValue('margin-bottom');
30+
completionheight = completionactivity.scrollHeight + parseInt(completionmargin, 10); // We want the first element.
31+
}
32+
2933
// Handle that the resizer is loaded after the iframe.
3034
H5PEmbedCommunicator.on('ready', function() {
3135
H5PEmbedCommunicator.send('hello');

0 commit comments

Comments
 (0)