bloom-player 2.10.3 → 2.11.1

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.
@@ -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.zkS_Zk6G.js"></script>
21
+ <script src="bloomPlayer.BxAHMdC0.js"></script>
22
22
  </body>
23
23
 
24
24
 
@@ -4,6 +4,7 @@ export declare function IsRunningOnBloomDesktop(bloomPage?: Element): boolean;
4
4
  export declare function prepareActivity(page: HTMLElement, changePageAction: (next: boolean) => void): void;
5
5
  export declare function undoPrepareActivity(page: HTMLElement): void;
6
6
  export declare const playSoundOf: (e: MouseEvent) => void;
7
+ export declare function getAudioSentencesOfVisibleEditables(element: HTMLElement): HTMLElement[];
7
8
  export declare function playInitialElements(page: HTMLElement, playVideos: boolean): void;
8
9
  export declare function shuffle<T>(array: T[], areItemsTheSame?: (a: T, b: T) => boolean): T[];
9
10
  export declare function isTheTextInDraggablesTheSame(a: HTMLElement, b: HTMLElement): boolean;
package/lib/shared.es.js CHANGED
@@ -18,16 +18,16 @@ function Qt(l) {
18
18
  tr = l;
19
19
  }
20
20
  let yi;
21
- function js(l) {
21
+ function Rs(l) {
22
22
  yi = l;
23
23
  }
24
24
  let Ir;
25
- function Rs(l) {
25
+ function _s(l) {
26
26
  Ir = l;
27
27
  }
28
28
  let wn = () => {
29
29
  };
30
- function _s(l) {
30
+ function Ws(l) {
31
31
  wn = l ?? (() => {
32
32
  });
33
33
  }
@@ -35,7 +35,7 @@ let bi = "";
35
35
  function Ko(l) {
36
36
  bi = l;
37
37
  }
38
- function Ws(l) {
38
+ function Fs(l) {
39
39
  Ko(xn(l));
40
40
  }
41
41
  function xn(l) {
@@ -57,7 +57,7 @@ function Qo(l) {
57
57
  }
58
58
  const es = "bloom-highlightSegment", Sn = "ui-enableHighlight", Ci = "ui-disableHighlight", gn = "ui-suppressHighlight";
59
59
  let qr = 3;
60
- function Fs(l) {
60
+ function Xs(l) {
61
61
  qr = l;
62
62
  }
63
63
  const Br = "audio-sentence", En = "bloom-imageDescription";
@@ -73,7 +73,7 @@ function rs() {
73
73
  let ki, jr, pr = "", yt = [], Mt = [];
74
74
  const bt = new Xr(), Vt = new Xr(), zr = new Xr(), zt = new Xr();
75
75
  let mr = 0, Cn = !0;
76
- function Xs(l) {
76
+ function Ys(l) {
77
77
  Cn = l;
78
78
  }
79
79
  let Rr = null;
@@ -393,7 +393,7 @@ function Ht() {
393
393
  function ps() {
394
394
  Yr();
395
395
  }
396
- function Ys() {
396
+ function $s() {
397
397
  tr === 4 && Yr(!1);
398
398
  }
399
399
  function Yr(l = !0) {
@@ -456,10 +456,10 @@ function Pi(l) {
456
456
  )
457
457
  );
458
458
  }
459
- function $s(l) {
459
+ function Vs(l) {
460
460
  return !!Pi(l).length;
461
461
  }
462
- function Vs() {
462
+ function Us() {
463
463
  if (tr !== 4) {
464
464
  if (Qt(
465
465
  4
@@ -475,7 +475,7 @@ function Vs() {
475
475
  bt == null || bt.raise(It);
476
476
  }
477
477
  }
478
- function Us() {
478
+ function Gs() {
479
479
  tr !== 5 && (xs(), Qt(
480
480
  5
481
481
  /* AudioPaused */
@@ -485,14 +485,14 @@ function xs() {
485
485
  const l = Ht();
486
486
  clearTimeout(ki), jr && jr.length && l && (l.currentTime > 0 && !l.paused && !l.ended && Ni(), l.pause());
487
487
  }
488
- function Gs(l) {
488
+ function Zs(l) {
489
489
  let f = 0;
490
490
  return Pi(l).forEach((y) => {
491
491
  const b = y.getAttribute("data-duration");
492
492
  b && (f += parseFloat(b));
493
493
  }), f < qr && (f = qr), f;
494
494
  }
495
- function Zs() {
495
+ function Ks() {
496
496
  clearTimeout(ki);
497
497
  }
498
498
  function gr(l, f) {
@@ -563,7 +563,7 @@ function Cs(l) {
563
563
  function On(l) {
564
564
  return l ? l.closest("#page-scaling-container") !== null : document.body.querySelector("div#page-scaling-container") !== null;
565
565
  }
566
- function Ks(l, f) {
566
+ function Js(l, f) {
567
567
  vt = l, Cs(l), Hr = f, to(
568
568
  l.getAttribute("data-show-answers-in-targets") === "true" || l.getAttribute("data-show-target-as-shadow") === "true",
569
569
  l
@@ -635,14 +635,14 @@ const ks = (l) => {
635
635
  "bloom-content1"
636
636
  )[0], b = (B = y == null ? void 0 : y.textContent) == null ? void 0 : B.trim();
637
637
  if (!b) return;
638
- const N = b.split(" "), j = As(N), F = l.ownerDocument.createElement("div");
638
+ const N = b.split(" "), j = Ls(N), F = l.ownerDocument.createElement("div");
639
639
  F.classList.add("drag-item-random-sentence"), F.setAttribute("data-answer", b), _n(l, j, F, y, !0), F.style.left = f.style.left, F.style.top = f.style.top, F.style.width = f.parentElement.offsetWidth - f.offsetLeft - 10 + "px", (A = f.parentElement) == null || A.insertBefore(F, f);
640
640
  }
641
641
  );
642
642
  }, qn = (l) => {
643
643
  l.currentTarget.play();
644
644
  };
645
- function Js(l) {
645
+ function Qs(l) {
646
646
  Hn(), Fr = [], Array.from(
647
647
  l.getElementsByClassName("bloom-change-page-button")
648
648
  ).forEach(
@@ -689,15 +689,19 @@ const Bn = (l) => {
689
689
  const f = l.currentTarget;
690
690
  Rn(f);
691
691
  }, Rn = (l) => {
692
- const f = $r(l), y = zi(f);
693
- vr(y, l.closest(".bloom-page"));
692
+ const f = As(l);
693
+ vr(f, l.closest(".bloom-page"));
694
694
  };
695
+ function As(l) {
696
+ const f = $r(l);
697
+ return zi(f);
698
+ }
695
699
  function _n(l, f, y, b, N) {
696
700
  var F;
697
701
  const j = ((F = Array.from(b == null ? void 0 : b.classList)) == null ? void 0 : F.find((B) => B.endsWith("-style"))) ?? "Normal-style";
698
702
  f.forEach((B) => {
699
703
  const A = l.ownerDocument.createElement("div");
700
- A.classList.add("drag-item-order-word"), A.textContent = B, y.appendChild(A), A.classList.add(j), N && A.addEventListener("pointerdown", Ds);
704
+ A.classList.add("drag-item-order-word"), A.textContent = B, y.appendChild(A), A.classList.add(j), N && A.addEventListener("pointerdown", Ps);
701
705
  });
702
706
  }
703
707
  function Wn(l) {
@@ -706,7 +710,7 @@ function Wn(l) {
706
710
  );
707
711
  Hr == null || Hr(f);
708
712
  }
709
- function Qs(l, f) {
713
+ function ea(l, f) {
710
714
  const y = (j) => {
711
715
  const F = j.closest(_r);
712
716
  return !(!F || F.classList.contains("draggable-text") || F.hasAttribute("data-draggable-id") || F.classList.contains("drag-item-order-sentence") || F.classList.contains("bloom-wordChoice") || F.classList.contains("drag-item-correct") || F.classList.contains("drag-item-wrong"));
@@ -737,7 +741,7 @@ function $r(l) {
737
741
  );
738
742
  return l.classList.contains("bloom-editable") && window.getComputedStyle(l).display !== "none" && f.push(l), f;
739
743
  }
740
- function As(l, f) {
744
+ function Ls(l, f) {
741
745
  f || (f = (B, A) => B === A);
742
746
  let y = !0;
743
747
  for (let B = 1; B < l.length; ++B)
@@ -764,7 +768,7 @@ function As(l, f) {
764
768
  for (let B = 0; B < l.length; ++B) l[B] = j[B];
765
769
  return l;
766
770
  }
767
- function ea(l, f) {
771
+ function ta(l, f) {
768
772
  return l.innerText.trim() === f.innerText.trim();
769
773
  }
770
774
  const Fn = (l) => {
@@ -844,8 +848,8 @@ const Gr = (l) => l.getBoundingClientRect().width / l.offsetWidth, Xn = (l) => {
844
848
  Math.abs(N - y) < 0.6 && Math.abs(j - b) < 0.6
845
849
  );
846
850
  }, Vn = (l) => {
847
- const y = l.currentTarget.closest(".bloom-page"), b = Ns(y) && Ps(y);
848
- return Ls(y, b), b;
851
+ const y = l.currentTarget.closest(".bloom-page"), b = Ds(y) && zs(y);
852
+ return Ns(y, b), b;
849
853
  }, Un = (l) => {
850
854
  const y = l.currentTarget.closest(".bloom-page");
851
855
  Ut(y, "drag-activity-correct", !1), Ut(y, "drag-activity-wrong", !1), Ut(y, "drag-activity-solution", !1), Hn();
@@ -854,7 +858,7 @@ const Gr = (l) => l.getBoundingClientRect().width / l.offsetWidth, Xn = (l) => {
854
858
  y ? (b = l.parentElement) == null || b.classList.add(f) : (N = l.parentElement) == null || N.classList.remove(f);
855
859
  };
856
860
  let tt, de;
857
- function Ls(l, f) {
861
+ function Ns(l, f) {
858
862
  Ut(l, "drag-activity-correct", f), Ut(l, "drag-activity-wrong", !f);
859
863
  const y = l.getAttribute(
860
864
  f ? "data-correct-sound" : "data-wrong-sound"
@@ -882,7 +886,7 @@ function Gn(l, f) {
882
886
  { once: !0 }
883
887
  );
884
888
  }
885
- function Ns(l) {
889
+ function Ds(l) {
886
890
  let f = !0;
887
891
  const y = Array.from(l.querySelectorAll("[data-draggable-id]"));
888
892
  return y.forEach((b) => {
@@ -903,7 +907,7 @@ function Ns(l) {
903
907
  }
904
908
  let Xe, Ei = 0;
905
909
  const Zn = 5;
906
- function Ds(l) {
910
+ function Ps(l) {
907
911
  var b, N;
908
912
  if (l.button !== 0 || l.ctrlKey) return;
909
913
  de = l.currentTarget, Ei = de.offsetWidth;
@@ -988,7 +992,7 @@ function vi(l) {
988
992
  };
989
993
  requestAnimationFrame(j);
990
994
  }
991
- function Ps(l) {
995
+ function zs(l) {
992
996
  const f = l.getElementsByClassName("drag-item-random-sentence");
993
997
  for (let y = 0; y < f.length; y++) {
994
998
  const b = f[y], N = b.getAttribute("data-answer").split(" "), j = Array.from(b.children);
@@ -1001,12 +1005,12 @@ function Ps(l) {
1001
1005
  const to = (l, f) => {
1002
1006
  const y = f.querySelectorAll(":scope [data-draggable-id]");
1003
1007
  l ? y.forEach((b) => {
1004
- zs(b);
1005
- }) : y.forEach((b) => {
1006
1008
  Ms(b);
1009
+ }) : y.forEach((b) => {
1010
+ Is(b);
1007
1011
  });
1008
1012
  };
1009
- function zs(l) {
1013
+ function Ms(l) {
1010
1014
  const f = Mi(l);
1011
1015
  if (!f)
1012
1016
  return;
@@ -1025,7 +1029,11 @@ function zs(l) {
1025
1029
  N.classList.remove("hoverUp");
1026
1030
  }), Array.from(y.querySelectorAll("[contenteditable]")).forEach((N) => {
1027
1031
  N.removeAttribute("contenteditable");
1028
- }), Array.from(y.querySelectorAll("[tabindex]")).forEach((N) => {
1032
+ }), Array.from(y.getElementsByClassName("ui-audioCurrent")).forEach(
1033
+ (N) => {
1034
+ N.classList.remove("ui-audioCurrent");
1035
+ }
1036
+ ), Array.from(y.querySelectorAll("[tabindex]")).forEach((N) => {
1029
1037
  N.removeAttribute("tabindex");
1030
1038
  });
1031
1039
  let b = y.getElementsByClassName(
@@ -1046,15 +1054,15 @@ const Mi = (l) => {
1046
1054
  if (f)
1047
1055
  return l.closest(".bloom-page").querySelector(`[data-target-of="${f}"]`);
1048
1056
  };
1049
- function Ms(l) {
1057
+ function Is(l) {
1050
1058
  const f = Mi(l);
1051
1059
  f && (f.innerHTML = "");
1052
1060
  }
1053
- let ta = !1;
1054
- function ra(l) {
1061
+ let ra = !1;
1062
+ function ia(l) {
1055
1063
  }
1056
- var Is = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1057
- function Hs(l) {
1064
+ var Hs = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1065
+ function Os(l) {
1058
1066
  return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
1059
1067
  }
1060
1068
  var ro = { exports: {} };
@@ -1078,7 +1086,7 @@ var ro = { exports: {} };
1078
1086
  throw new Error("jQuery requires a window with a document");
1079
1087
  return y(b);
1080
1088
  };
1081
- })(typeof window < "u" ? window : Is, function(f, y) {
1089
+ })(typeof window < "u" ? window : Hs, function(f, y) {
1082
1090
  var b = [], N = Object.getPrototypeOf, j = b.slice, F = b.flat ? function(t) {
1083
1091
  return b.flat.call(t);
1084
1092
  } : function(t) {
@@ -4758,8 +4766,8 @@ var ro = { exports: {} };
4758
4766
  });
4759
4767
  })(ro);
4760
4768
  var io = ro.exports;
4761
- const er = /* @__PURE__ */ Hs(io);
4762
- var Os = { exports: {} };
4769
+ const er = /* @__PURE__ */ Os(io);
4770
+ var qs = { exports: {} };
4763
4771
  (function(l, f) {
4764
4772
  (function(y) {
4765
4773
  l.exports = y(io);
@@ -6263,9 +6271,9 @@ var Os = { exports: {} };
6263
6271
  }
6264
6272
  }, A.nicescroll || (A.nicescroll = new Bt(), A.nicescroll.options = Ct);
6265
6273
  });
6266
- })(Os);
6274
+ })(qs);
6267
6275
  const Ii = ".bloom-translationGroup:not(.bloom-imageDescription) .bloom-editable.bloom-visibility-code-on, .scrollable";
6268
- function ia(l, f) {
6276
+ function na(l, f) {
6269
6277
  if (l.classList.contains("cover"))
6270
6278
  return;
6271
6279
  const y = On(l);
@@ -6350,7 +6358,7 @@ function ia(l, f) {
6350
6358
  cursoropacitymax: 0.1,
6351
6359
  cursorborderradius: ne
6352
6360
  // Make the corner more rounded than the 5px default.
6353
- }), Bs(
6361
+ }), js(
6354
6362
  l,
6355
6363
  f
6356
6364
  ), b = []);
@@ -6362,7 +6370,7 @@ function ia(l, f) {
6362
6370
  });
6363
6371
  }
6364
6372
  }
6365
- function qs(l) {
6373
+ function Bs(l) {
6366
6374
  for (var f = l && l.parentNode ? l.parentNode : null; f && f.nodeType === Node.ELEMENT_NODE && !/^BODY|HTML/.test(f.nodeName); ) {
6367
6375
  const y = window.getComputedStyle(f), b = y.getPropertyValue("position");
6368
6376
  if (/fixed|absolute/.test(b)) return f;
@@ -6378,7 +6386,7 @@ function no(l, f) {
6378
6386
  const j = f.parentElement;
6379
6387
  if (!j || !j.classList.contains("bloom-translationGroup"))
6380
6388
  return { topAdjust: y, leftAdjust: b, thumbWidth: N };
6381
- if (qs(f)) {
6389
+ if (Bs(f)) {
6382
6390
  const B = window.getComputedStyle(j), A = B.getPropertyValue("padding-top") || "0", H = B.getPropertyValue("padding-left") || "0";
6383
6391
  y = parseFloat(A) * (l - 1), b = parseFloat(H) * (l - 1);
6384
6392
  } else {
@@ -6392,7 +6400,7 @@ function no(l, f) {
6392
6400
  }
6393
6401
  return { topAdjust: y, leftAdjust: b, thumbWidth: N };
6394
6402
  }
6395
- function Bs(l, f) {
6403
+ function js(l, f) {
6396
6404
  if (l.removeEventListener("pointerdown", bn), l.addEventListener("pointerdown", bn), !!f)
6397
6405
  for (const y of ["pointermove", "pointerup"])
6398
6406
  l.ownerDocument.body.addEventListener(
@@ -6403,7 +6411,7 @@ function Bs(l, f) {
6403
6411
  }
6404
6412
  );
6405
6413
  }
6406
- function na(l, f) {
6414
+ function oa(l, f) {
6407
6415
  l.querySelectorAll(Ii).forEach(
6408
6416
  (y) => {
6409
6417
  const b = er(y).getNiceScroll();
@@ -6417,7 +6425,7 @@ function na(l, f) {
6417
6425
  function bn(l) {
6418
6426
  l.target instanceof HTMLDivElement && l.target.classList.contains("nicescroll-cursors") && (l.target.setPointerCapture(l.pointerId), l.pointerType === "mouse" && l.stopPropagation());
6419
6427
  }
6420
- function oa() {
6428
+ function sa() {
6421
6429
  var l;
6422
6430
  (l = er("div.bloom-page")[0]) == null || l.querySelectorAll(Ii).forEach((f) => {
6423
6431
  const y = er(
@@ -6444,56 +6452,57 @@ export {
6444
6452
  zr as PlayFailed,
6445
6453
  Zo as PlaybackMode,
6446
6454
  zt as ToggleImageDescription,
6447
- Ys as abortNarrationPlayback,
6448
- ia as addScrollbarsToPage,
6455
+ $s as abortNarrationPlayback,
6456
+ na as addScrollbarsToPage,
6449
6457
  Cs as adjustDraggablesForLanguage,
6450
6458
  Ut as classSetter,
6451
- oa as cleanupNiceScroll,
6452
- Gs as computeDuration,
6453
- zs as copyContentToTarget,
6459
+ sa as cleanupNiceScroll,
6460
+ Zs as computeDuration,
6461
+ Ms as copyContentToTarget,
6454
6462
  tr as currentPlaybackMode,
6455
6463
  to as doShowAnswersInTargets,
6456
- ta as draggingSlider,
6464
+ ra as draggingSlider,
6457
6465
  yi as durationReporter,
6458
- na as fixNiceScrollOffsets,
6466
+ oa as fixNiceScrollOffsets,
6467
+ As as getAudioSentencesOfVisibleEditables,
6459
6468
  rs as getCurrentNarrationPage,
6460
6469
  Mi as getTarget,
6461
6470
  xn as getUrlPrefixFromWindowHref,
6462
6471
  Ss as hideVideoError,
6463
- Zs as hidingPage,
6472
+ Ks as hidingPage,
6464
6473
  Ir as isSwipeInProgress,
6465
- ea as isTheTextInDraggablesTheSame,
6474
+ ta as isTheTextInDraggablesTheSame,
6466
6475
  Br as kAudioSentence,
6467
6476
  es as kHighlightSegmentClass,
6468
6477
  _r as kLegacyCanvasElementSelector,
6469
6478
  Ii as kSelectorForPotentialNiceScrollElements,
6470
- js as listenForPlayDuration,
6479
+ Rs as listenForPlayDuration,
6471
6480
  wn as logNarration,
6472
- $s as pageHasAudio,
6473
- Us as pauseNarration,
6481
+ Vs as pageHasAudio,
6482
+ Gs as pauseNarration,
6474
6483
  Vn as performCheck,
6475
6484
  Un as performTryAgain,
6476
6485
  vr as playAllAudio,
6477
6486
  is as playAllSentences,
6478
6487
  gr as playAllVideo,
6479
- Qs as playInitialElements,
6480
- Vs as playNarration,
6488
+ ea as playInitialElements,
6489
+ Us as playNarration,
6481
6490
  Bn as playSoundOf,
6482
- Ks as prepareActivity,
6491
+ Js as prepareActivity,
6483
6492
  ts as setCurrentPage,
6484
6493
  Qt as setCurrentPlaybackMode,
6485
- Fs as setDurationOfPagesWithoutNarration,
6486
- Xs as setIncludeImageDescriptions,
6487
- _s as setLogNarration,
6494
+ Xs as setDurationOfPagesWithoutNarration,
6495
+ Ys as setIncludeImageDescriptions,
6496
+ Ws as setLogNarration,
6488
6497
  Ko as setPlayerUrlPrefix,
6489
- Ws as setPlayerUrlPrefixFromWindowLocationHref,
6490
- Rs as setTestIsSwipeInProgress,
6491
- Bs as setupSpecialMouseTrackingForNiceScroll,
6492
- ra as setupWordChooserSlider,
6498
+ Fs as setPlayerUrlPrefixFromWindowLocationHref,
6499
+ _s as setTestIsSwipeInProgress,
6500
+ js as setupSpecialMouseTrackingForNiceScroll,
6501
+ ia as setupWordChooserSlider,
6493
6502
  mn as showVideoError,
6494
- As as shuffle,
6503
+ Ls as shuffle,
6495
6504
  Jo as sortAudioElements,
6496
- Js as undoPrepareActivity,
6505
+ Qs as undoPrepareActivity,
6497
6506
  Tn as urlPrefix
6498
6507
  };
6499
6508
  //# sourceMappingURL=shared.es.js.map