easter-egg-quest 1.0.10 → 1.0.11

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.
@@ -728,23 +728,47 @@ class HiddenEntry {
728
728
  this._injectShimmerStyles();
729
729
  this._createHintContainer();
730
730
  const hints = this.script.hiddenEntryHints;
731
- const FIRST_HINT_DELAY = 3e5;
731
+ const FIRST_HINT_DELAY = 12e4;
732
732
  const HINT_INTERVAL = 6e4;
733
733
  for (let i = 0; i < hints.length; i++) {
734
734
  const delay = FIRST_HINT_DELAY + i * HINT_INTERVAL;
735
735
  const timer = setTimeout(() => {
736
736
  if (this._destroyed) return;
737
- this._showHint(hints[i]);
737
+ this._showHintWhenVisible(hints[i]);
738
738
  }, delay);
739
739
  this.hintTimers.push(timer);
740
740
  }
741
- const shimmerDelay = 42e4;
741
+ const shimmerDelay = 24e4;
742
742
  const shimmerTimer = setTimeout(() => {
743
743
  if (this._destroyed || !this.targetElement) return;
744
744
  this.targetElement.classList.add("eeq-entry-target");
745
745
  }, shimmerDelay);
746
746
  this.hintTimers.push(shimmerTimer);
747
747
  }
748
+ /** Show hint only when the page is visible. If hidden, wait for visibility change. */
749
+ _showHintWhenVisible(text) {
750
+ if (this._destroyed) return;
751
+ if (document.visibilityState === "visible" && document.hasFocus()) {
752
+ this._showHint(text);
753
+ } else {
754
+ const handler = () => {
755
+ if (this._destroyed) {
756
+ document.removeEventListener("visibilitychange", handler);
757
+ window.removeEventListener("focus", handler);
758
+ return;
759
+ }
760
+ if (document.visibilityState === "visible" && document.hasFocus()) {
761
+ document.removeEventListener("visibilitychange", handler);
762
+ window.removeEventListener("focus", handler);
763
+ setTimeout(() => {
764
+ if (!this._destroyed) this._showHint(text);
765
+ }, 800);
766
+ }
767
+ };
768
+ document.addEventListener("visibilitychange", handler);
769
+ window.addEventListener("focus", handler);
770
+ }
771
+ }
748
772
  _showHint(text) {
749
773
  if (!this.hintContainer) return;
750
774
  const snack = document.createElement("div");