Skip to content

Commit ccb12c1

Browse files
committed
Add support for content types using divs as wrapper
1 parent 383f2d5 commit ccb12c1

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

h5pxapikachu.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Text Domain: H5PXAPIKATCHU
77
* Domain Path: /languages
88
* Description: Catch and store xAPI statements sent by H5P
9-
* Version: 0.2.4
9+
* Version: 0.2.5
1010
* Author: Oliver Tacke
1111
* Author URI: https://www.olivertacke.de
1212
* License: MIT
@@ -18,7 +18,7 @@
1818
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
1919

2020
if ( !defined( 'H5PXAPIKATCHU_VERSION' ) ) {
21-
define( 'H5PXAPIKATCHU_VERSION', '0.2.4' );
21+
define( 'H5PXAPIKATCHU_VERSION', '0.2.5' );
2222
}
2323

2424
// settings.php contains all functions for the settings

js/h5pxapikatchu.js

+13
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ var H5P = H5P || {};
5656
console.log( error );
5757
}
5858
}
59+
60+
// Add listener if DIVs are used.
61+
const h5pDiv = document.getElementsByClassName( 'h5p-frame' );
62+
if (h5pDiv.length !== 0) {
63+
try {
64+
if ( H5P && H5P.externalDispatcher ) {
65+
H5P.externalDispatcher.on( 'xAPI', handleXAPI );
66+
}
67+
}
68+
catch ( error ) {
69+
console.log( error );
70+
}
71+
}
5972
}
6073
};
6174
} ) ();

readme.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Contributors: otacke
33
Tags: h5p, xapi
44
Donate link: https://www.patreon.com/otacke
55
Requires at least: 4.0
6-
Tested up to: 4.9.6
7-
Stable tag: 0.2.4
6+
Tested up to: 5.0.2
7+
Stable tag: 0.2.5
88
License: MIT
99
License URI: https://github.com/otacke/h5pxapikatchu/blob/master/LICENSE
1010

@@ -52,6 +52,9 @@ None yet.
5252

5353
== Changelog ==
5454

55+
= 0.2.5 =
56+
- Add support for H5P content types that use divs instead of iframes, e.g Memory Game.
57+
5558
= 0.2.4 =
5659
- Fix bug introduced in 0.2.0 that could prevent plugin from initializing the
5760
database properly. Thanks to "thedeviousdev" finding it!
@@ -89,6 +92,9 @@ Initial release.
8992

9093
== Upgrade Notice ==
9194

95+
= 0.2.5 =
96+
Update if you use content types that use divs instead of iframes, e.g. Memory Game.
97+
9298
= 0.2.4 =
9399
Update if you want to be future proof.
94100

0 commit comments

Comments
 (0)