bloom-player 2.9.5 → 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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<head>
|
|
8
8
|
<meta charset="UTF-8" />
|
|
9
9
|
<!-- At build time, we replace this with the actual css file -->
|
|
10
|
-
<link rel="stylesheet" href="bloomPlayer-
|
|
10
|
+
<link rel="stylesheet" href="bloomPlayer-fhe-RLAT.css">
|
|
11
11
|
</head>
|
|
12
12
|
|
|
13
13
|
<!-- About the background-color here... the bloomPlayer.js will set the background color
|
|
@@ -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.
|
|
@@ -114,6 +111,11 @@ export function prepareActivity(
|
|
|
114
111
|
);
|
|
115
112
|
|
|
116
113
|
// Hide image titles, which might give too much away, or distract.
|
|
114
|
+
Array.from(document.getElementsByClassName("bloom-canvas")).forEach(
|
|
115
|
+
(container) => {
|
|
116
|
+
(container as HTMLElement).title = "";
|
|
117
|
+
},
|
|
118
|
+
);
|
|
117
119
|
Array.from(document.getElementsByClassName("bloom-imageContainer")).forEach(
|
|
118
120
|
(container) => {
|
|
119
121
|
(container as HTMLElement).title = "";
|
|
@@ -262,11 +264,15 @@ const playVideo = (e: MouseEvent) => {
|
|
|
262
264
|
video.play();
|
|
263
265
|
};
|
|
264
266
|
|
|
265
|
-
// Cleans up whatever
|
|
267
|
+
// Cleans up whatever prepareActivity() did, especially when switching to another tab.
|
|
266
268
|
// May also be useful to do when switching pages in player. If not, we may want to move
|
|
267
269
|
// this out of this runtime file; but it's nice to keep it with prepareActivity.
|
|
268
270
|
export function undoPrepareActivity(page: HTMLElement) {
|
|
269
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
|
+
|
|
270
276
|
const changePageButtons = Array.from(
|
|
271
277
|
page.getElementsByClassName("bloom-change-page-button"),
|
|
272
278
|
);
|
|
@@ -314,8 +320,8 @@ export function undoPrepareActivity(page: HTMLElement) {
|
|
|
314
320
|
});
|
|
315
321
|
|
|
316
322
|
// In Bloom Player, this will have been done by other play code, since data-sound is not
|
|
317
|
-
//
|
|
318
|
-
// 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.
|
|
319
325
|
const soundItems = Array.from(page.querySelectorAll("[data-sound]"));
|
|
320
326
|
soundItems.forEach((elt: HTMLElement) => {
|
|
321
327
|
elt.removeEventListener("click", playSoundOf);
|
|
@@ -475,7 +481,7 @@ function getVisibleEditables(container: HTMLElement) {
|
|
|
475
481
|
}
|
|
476
482
|
|
|
477
483
|
export function shuffle<T>(array: T[]): T[] {
|
|
478
|
-
// review: something
|
|
484
|
+
// review: something Copilot came up with. Is it guaranteed to be sufficiently different
|
|
479
485
|
// from the correct answer?
|
|
480
486
|
let currentIndex = array.length,
|
|
481
487
|
randomIndex;
|
|
@@ -670,6 +676,8 @@ export const performTryAgain = (e: MouseEvent) => {
|
|
|
670
676
|
classSetter(page, "drag-activity-wrong", false);
|
|
671
677
|
//currently I don't think it could be set here, but make sure.
|
|
672
678
|
classSetter(page, "drag-activity-solution", false);
|
|
679
|
+
// Restore everything to the starting positions. BL-14482.
|
|
680
|
+
restorePositions();
|
|
673
681
|
};
|
|
674
682
|
|
|
675
683
|
export const classSetter = (
|
|
@@ -1078,9 +1086,13 @@ export function copyContentToTarget(draggable: HTMLElement) {
|
|
|
1078
1086
|
Array.from(throwAway.querySelectorAll("[tabindex]")).forEach((e) => {
|
|
1079
1087
|
e.removeAttribute("tabindex");
|
|
1080
1088
|
});
|
|
1081
|
-
|
|
1082
|
-
"bloom-
|
|
1089
|
+
let imageContainer = throwAway.getElementsByClassName(
|
|
1090
|
+
"bloom-canvas",
|
|
1083
1091
|
)[0] as HTMLElement;
|
|
1092
|
+
if (!imageContainer)
|
|
1093
|
+
imageContainer = throwAway.getElementsByClassName(
|
|
1094
|
+
"bloom-imageContainer",
|
|
1095
|
+
)[0] as HTMLElement;
|
|
1084
1096
|
if (imageContainer) {
|
|
1085
1097
|
// We need another layer to manage clipping and centering. The one we were going to
|
|
1086
1098
|
// throw away becomes the wrapper, and we add a new throwAway outside it
|
|
@@ -1182,6 +1194,7 @@ export function setupWordChooserSlider(page: HTMLElement) {
|
|
|
1182
1194
|
// // I'm not finding anything that works that way, and the code below finds a full URL
|
|
1183
1195
|
// sliderImgSrc = img.getAttribute("src")!;
|
|
1184
1196
|
// } else {
|
|
1197
|
+
// WOULD THIS NEED ADJUSTING FOR .bloom-canvas IF THIS CODE WERE RESURRECTED?
|
|
1185
1198
|
// // In bloom-player, for a forgotten and possibly obsolete reason, we use a background image
|
|
1186
1199
|
// // on the container. (I vaguely recall it may be important when animating the main image.)
|
|
1187
1200
|
// const imgContainer = imgTop.getElementsByClassName(
|