bloom-player 2.9.6 → 2.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bloomplayer.htm
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<!-- At build time, we replace the target of this script tag to point at the
|
|
20
20
|
the bloom player bundle with the cache-busting hash in its name. -->
|
|
21
|
-
<script src="bloomPlayer.
|
|
21
|
+
<script src="bloomPlayer.DmuGfSWN.js"></script>
|
|
22
22
|
</body>
|
|
23
23
|
|
|
24
24
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A library for displaying Bloom books in iframes or WebViews",
|
|
4
4
|
"author": "SIL Global",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.9.
|
|
6
|
+
"version": "2.9.7",
|
|
7
7
|
"private": false,
|
|
8
8
|
"// sideeffects might need to be ['*.css'] to avoid 'shaking' our CSS, if we ever get tree shaking working": "",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -49,15 +49,12 @@ const savePositions = (page: HTMLElement) => {
|
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
// Restore the positions saved by savePositions (when leaving the Play tab, or leaving this page altogether
|
|
52
|
-
// after being in that tab).
|
|
52
|
+
// after being in that tab or when clicking the retry button during play).
|
|
53
53
|
const restorePositions = () => {
|
|
54
54
|
positionsToRestore.forEach((p) => {
|
|
55
55
|
p.elt.style.left = p.x;
|
|
56
56
|
p.elt.style.top = p.y;
|
|
57
57
|
});
|
|
58
|
-
// In case we do more editing after leaving the Play tab, we don't want to restore the same positions again
|
|
59
|
-
// if we leave the page completely.
|
|
60
|
-
positionsToRestore = [];
|
|
61
58
|
};
|
|
62
59
|
|
|
63
60
|
// This method may be specific to BloomDesktop.
|
|
@@ -267,11 +264,15 @@ const playVideo = (e: MouseEvent) => {
|
|
|
267
264
|
video.play();
|
|
268
265
|
};
|
|
269
266
|
|
|
270
|
-
// Cleans up whatever
|
|
267
|
+
// Cleans up whatever prepareActivity() did, especially when switching to another tab.
|
|
271
268
|
// May also be useful to do when switching pages in player. If not, we may want to move
|
|
272
269
|
// this out of this runtime file; but it's nice to keep it with prepareActivity.
|
|
273
270
|
export function undoPrepareActivity(page: HTMLElement) {
|
|
274
271
|
restorePositions();
|
|
272
|
+
// In case we do more editing after leaving the Play tab, we don't want to restore the same positions again
|
|
273
|
+
// if we leave the page completely.
|
|
274
|
+
positionsToRestore = [];
|
|
275
|
+
|
|
275
276
|
const changePageButtons = Array.from(
|
|
276
277
|
page.getElementsByClassName("bloom-change-page-button"),
|
|
277
278
|
);
|
|
@@ -319,8 +320,8 @@ export function undoPrepareActivity(page: HTMLElement) {
|
|
|
319
320
|
});
|
|
320
321
|
|
|
321
322
|
// In Bloom Player, this will have been done by other play code, since data-sound is not
|
|
322
|
-
//
|
|
323
|
-
// In Bloom desktop, we need this to make
|
|
323
|
+
// specific to games. But we're adding a listener for the same function, so it doesn't matter.
|
|
324
|
+
// In Bloom desktop, we need this to make clicking data-sound elements work in Play mode.
|
|
324
325
|
const soundItems = Array.from(page.querySelectorAll("[data-sound]"));
|
|
325
326
|
soundItems.forEach((elt: HTMLElement) => {
|
|
326
327
|
elt.removeEventListener("click", playSoundOf);
|
|
@@ -480,7 +481,7 @@ function getVisibleEditables(container: HTMLElement) {
|
|
|
480
481
|
}
|
|
481
482
|
|
|
482
483
|
export function shuffle<T>(array: T[]): T[] {
|
|
483
|
-
// review: something
|
|
484
|
+
// review: something Copilot came up with. Is it guaranteed to be sufficiently different
|
|
484
485
|
// from the correct answer?
|
|
485
486
|
let currentIndex = array.length,
|
|
486
487
|
randomIndex;
|
|
@@ -675,6 +676,8 @@ export const performTryAgain = (e: MouseEvent) => {
|
|
|
675
676
|
classSetter(page, "drag-activity-wrong", false);
|
|
676
677
|
//currently I don't think it could be set here, but make sure.
|
|
677
678
|
classSetter(page, "drag-activity-solution", false);
|
|
679
|
+
// Restore everything to the starting positions. BL-14482.
|
|
680
|
+
restorePositions();
|
|
678
681
|
};
|
|
679
682
|
|
|
680
683
|
export const classSetter = (
|