nodebb-plugin-ezoic-infinite 1.5.78 → 1.5.79
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/package.json +1 -1
- package/public/client.js +29 -8
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
|
|
23
23
|
// Preload margins
|
|
24
24
|
const PRELOAD_MARGIN_DESKTOP = '2600px 0px 2600px 0px';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
25
|
+
// Mobile: larger preload window so ad fill requests start earlier and
|
|
26
|
+
// users don't scroll past empty placeholders.
|
|
27
|
+
const PRELOAD_MARGIN_MOBILE = '3200px 0px 3200px 0px';
|
|
28
|
+
const PRELOAD_MARGIN_DESKTOP_BOOST = '5200px 0px 5200px 0px';
|
|
29
|
+
const PRELOAD_MARGIN_MOBILE_BOOST = '5200px 0px 5200px 0px';
|
|
28
30
|
|
|
29
31
|
const BOOST_DURATION_MS = 2500;
|
|
30
32
|
const BOOST_SPEED_PX_PER_MS = 2.2; // ~2200px/s
|
|
@@ -751,11 +753,24 @@ function globalGapFixInit() {
|
|
|
751
753
|
if (prev.getAttribute && prev.getAttribute('data-ezoic-pin') === '1') break;
|
|
752
754
|
} catch (e) {}
|
|
753
755
|
|
|
754
|
-
//
|
|
755
|
-
//
|
|
756
|
+
// Never remove a wrap that is already filled; otherwise it looks like
|
|
757
|
+
// ads "disappear" while scrolling. Only remove the empty neighbour.
|
|
756
758
|
const prevFilled = isFilled(prev);
|
|
757
759
|
const curFilled = isFilled(w);
|
|
758
|
-
|
|
760
|
+
|
|
761
|
+
if (curFilled) {
|
|
762
|
+
// If the previous one is empty (and not fresh), drop the previous instead.
|
|
763
|
+
if (!prevFilled && !isFresh(prev)) {
|
|
764
|
+
withInternalDomChange(() => releaseWrapNode(prev));
|
|
765
|
+
removed++;
|
|
766
|
+
}
|
|
767
|
+
break;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// Current is empty.
|
|
771
|
+
// Don't decluster two "fresh" empty wraps — it can reduce fill on slow auctions.
|
|
772
|
+
// Only decluster when previous is filled, or when current is stale.
|
|
773
|
+
if (prevFilled || !isFresh(w)) {
|
|
759
774
|
withInternalDomChange(() => releaseWrapNode(w));
|
|
760
775
|
removed++;
|
|
761
776
|
}
|
|
@@ -817,10 +832,16 @@ function globalGapFixInit() {
|
|
|
817
832
|
try { io && io.observe(ph); } catch (e) {}
|
|
818
833
|
|
|
819
834
|
// If already near viewport, fire immediately.
|
|
835
|
+
// Mobile tends to scroll faster + has slower auctions, so we fire earlier.
|
|
820
836
|
try {
|
|
821
837
|
const r = ph.getBoundingClientRect();
|
|
822
|
-
const
|
|
823
|
-
const
|
|
838
|
+
const mobile = isMobile();
|
|
839
|
+
const screens = isBoosted()
|
|
840
|
+
? (mobile ? 9.0 : 5.0)
|
|
841
|
+
: (mobile ? 6.0 : 3.0);
|
|
842
|
+
const minBottom = isBoosted()
|
|
843
|
+
? (mobile ? -2600 : -1500)
|
|
844
|
+
: (mobile ? -1400 : -800);
|
|
824
845
|
if (r.top < window.innerHeight * screens && r.bottom > minBottom) enqueueShow(id);
|
|
825
846
|
} catch (e) {}
|
|
826
847
|
}
|