nodebb-plugin-ezoic-infinite 1.5.35 → 1.5.36
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 +11 -7
- package/public/style.css +18 -1
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -11,18 +11,20 @@
|
|
|
11
11
|
const MAX_INSERTS_PER_RUN = 3;
|
|
12
12
|
|
|
13
13
|
// Preload before viewport (earlier load for smoother scroll)
|
|
14
|
-
|
|
15
|
-
const
|
|
14
|
+
// Preload far enough ahead that fast scroll doesn't outrun ad loading.
|
|
15
|
+
const PRELOAD_MARGIN_DESKTOP = '3200px 0px 3200px 0px';
|
|
16
|
+
const PRELOAD_MARGIN_MOBILE = '1800px 0px 1800px 0px';
|
|
16
17
|
|
|
17
18
|
// When the user scrolls very fast, temporarily preload more aggressively.
|
|
18
19
|
// This helps ensure ads are already in-flight before the user reaches them.
|
|
19
|
-
const PRELOAD_MARGIN_DESKTOP_BOOST = '
|
|
20
|
-
const PRELOAD_MARGIN_MOBILE_BOOST = '
|
|
20
|
+
const PRELOAD_MARGIN_DESKTOP_BOOST = '5200px 0px 5200px 0px';
|
|
21
|
+
const PRELOAD_MARGIN_MOBILE_BOOST = '3200px 0px 3200px 0px';
|
|
21
22
|
const BOOST_DURATION_MS = 2500;
|
|
22
23
|
const BOOST_SPEED_PX_PER_MS = 2.2; // ~2200px/s
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
const
|
|
25
|
+
// Allow a bit more parallelism; the perf profile can still dial this down on low-end devices.
|
|
26
|
+
const MAX_INFLIGHT_DESKTOP = 5;
|
|
27
|
+
const MAX_INFLIGHT_MOBILE = 4;
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
// Adaptive performance profile (device/network aware)
|
|
@@ -665,7 +667,9 @@ function startShow(id) {
|
|
|
665
667
|
// If already near the fold, arm & fire immediately
|
|
666
668
|
try {
|
|
667
669
|
const r = wrap.getBoundingClientRect();
|
|
668
|
-
|
|
670
|
+
// Fire early enough that the ad is likely ready when the user reaches it.
|
|
671
|
+
// During boost (fast scroll), preload even farther.
|
|
672
|
+
const screens = isBoosted() ? 6.0 : 4.0;
|
|
669
673
|
const h = (window.innerHeight || 800);
|
|
670
674
|
if (r.top < screens * h && r.bottom > -screens * h) {
|
|
671
675
|
armPlaceholder(wrap, id);
|
package/public/style.css
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
/* Minimal styling for injected Ezoic wrappers.
|
|
2
2
|
Spacing (margins/padding) is intentionally NOT forced here, because it can be
|
|
3
3
|
configured inside Ezoic and may vary by placement/device.
|
|
4
|
+
|
|
5
|
+
Goals:
|
|
6
|
+
- prevent flex/centering styles from parent lists from affecting ad internals
|
|
7
|
+
- reduce layout jank when iframes resize during scroll
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
10
|
.ezoic-ad {
|
|
7
|
-
display: block;
|
|
11
|
+
display: block !important;
|
|
12
|
+
position: relative;
|
|
8
13
|
width: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
|
|
16
|
+
/* limit how far layout/paint changes propagate */
|
|
17
|
+
contain: layout paint style;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* Keep ad content aligned to the top (avoids the "slides to bottom" look) */
|
|
21
|
+
.ezoic-ad iframe,
|
|
22
|
+
.ezoic-ad ins,
|
|
23
|
+
.ezoic-ad > div {
|
|
24
|
+
display: block !important;
|
|
25
|
+
vertical-align: top !important;
|
|
9
26
|
}
|