easter-egg-quest 1.0.9 → 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");
@@ -4170,7 +4194,7 @@ class MotionStage {
4170
4194
  this._narrativeIndex = 0;
4171
4195
  this._lastFadeNarrativeTime = 0;
4172
4196
  this._introPlayed = false;
4173
- this.FADE_THRESHOLD_MS = 2500;
4197
+ this.FADE_THRESHOLD_MS = 500;
4174
4198
  this.config = config;
4175
4199
  this.script = script;
4176
4200
  this.input = input;
@@ -4220,9 +4244,9 @@ class MotionStage {
4220
4244
  }
4221
4245
  } else {
4222
4246
  const stillDuration = this.input.stillDuration;
4223
- if (stillDuration > this.FADE_THRESHOLD_MS && this._movingAccum > 500) {
4247
+ if (stillDuration > this.FADE_THRESHOLD_MS && this._movingAccum > 0) {
4224
4248
  this._fades++;
4225
- this._movingAccum = Math.max(0, this._movingAccum - stillDuration * 0.6);
4249
+ this._movingAccum = 0;
4226
4250
  this._handleFade();
4227
4251
  }
4228
4252
  }