nodebb-plugin-ezoic-infinite 1.8.4 → 1.8.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/client.js +2 -53
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -89,10 +89,6 @@
89
89
  const MAX_DESTROY_BATCH = 4; // ids max par destroyPlaceholders(...ids)
90
90
  const DESTROY_FLUSH_MS = 30; // micro-buffer destroy pour lisser les rafales
91
91
  const BURST_COOLDOWN_MS = 120; // délai min entre deux déclenchements de burst
92
- const PAGE_WARMUP_MS = 700; // laisse NodeBB rendre le contenu avant les premiers showAds
93
- const CONTENT_SETTLE_WINDOW_MS = 350;
94
- const CONTENT_SETTLE_MAX_DELAY_MS = 1500;
95
- const CONTENT_GROWTH_THRESHOLD_PX = 120;
96
92
 
97
93
  // Marges IO larges et fixes — observer créé une seule fois au boot
98
94
  const IO_MARGIN_DESKTOP = '2500px 0px 2500px 0px';
@@ -153,10 +149,6 @@
153
149
  burstDeadline: 0,
154
150
  burstCount: 0,
155
151
  lastBurstTs: 0,
156
- pageWarmUntil: 0,
157
- settleDelaySince: 0,
158
- contentSampleH: 0,
159
- contentSampleTs: 0,
160
152
  };
161
153
 
162
154
  let blockedUntil = 0;
@@ -268,36 +260,6 @@ function destroyBeforeReuse(ids) {
268
260
  }
269
261
 
270
262
 
271
- function getContentHeight() {
272
- try {
273
- const c = document.getElementById('content') || document.querySelector('main#panel') || document.body;
274
- if (!c) return 0;
275
- return Math.max(c.scrollHeight || 0, c.offsetHeight || 0);
276
- } catch (_) { return 0; }
277
- }
278
-
279
- function getShowSettleDelayMs(now = ts()) {
280
- try {
281
- if (S.pageWarmUntil && now < S.pageWarmUntil) return Math.max(0, Math.min(120, S.pageWarmUntil - now));
282
- const h = getContentHeight();
283
- const prevH = S.contentSampleH || 0;
284
- const prevTs = S.contentSampleTs || 0;
285
- S.contentSampleH = h;
286
- S.contentSampleTs = now;
287
- if (!prevTs || h <= 0) { S.settleDelaySince = 0; return 0; }
288
- const grew = h - prevH;
289
- const recent = (now - prevTs) <= CONTENT_SETTLE_WINDOW_MS;
290
- if (recent && grew >= CONTENT_GROWTH_THRESHOLD_PX) {
291
- if (!S.settleDelaySince) S.settleDelaySince = now;
292
- if ((now - S.settleDelaySince) < CONTENT_SETTLE_MAX_DELAY_MS) return CONTENT_SETTLE_WINDOW_MS;
293
- } else {
294
- S.settleDelaySince = 0;
295
- }
296
- } catch (_) {}
297
- return 0;
298
- }
299
-
300
-
301
263
  // ── Config ─────────────────────────────────────────────────────────────────
302
264
 
303
265
  async function fetchConfig() {
@@ -718,19 +680,17 @@ function enqueueShow(id) {
718
680
  scheduleDrainQueue();
719
681
  }
720
682
 
721
- function scheduleDrainQueue(delayMs = BATCH_FLUSH_MS) {
683
+ function scheduleDrainQueue() {
722
684
  if (isBlocked()) return;
723
685
  if (S.showBatchTimer) return;
724
686
  S.showBatchTimer = setTimeout(() => {
725
687
  S.showBatchTimer = 0;
726
688
  drainQueue();
727
- }, Math.max(0, delayMs|0));
689
+ }, BATCH_FLUSH_MS);
728
690
  }
729
691
 
730
692
  function drainQueue() {
731
693
  if (isBlocked()) return;
732
- const settleDelay = getShowSettleDelayMs();
733
- if (settleDelay > 0) { scheduleDrainQueue(Math.max(BATCH_FLUSH_MS, settleDelay)); return; }
734
694
  const free = Math.max(0, MAX_INFLIGHT - S.inflight);
735
695
  if (!free || !S.pending.length) return;
736
696
 
@@ -948,10 +908,6 @@ function startShowBatch(ids) {
948
908
  S.scrollSpeed = 0;
949
909
  S.lastScrollY = 0;
950
910
  S.lastScrollTs = 0;
951
- S.pageWarmUntil = 0;
952
- S.settleDelaySince = 0;
953
- S.contentSampleH = 0;
954
- S.contentSampleTs = 0;
955
911
  }
956
912
 
957
913
  // ── MutationObserver ───────────────────────────────────────────────────────
@@ -1057,10 +1013,6 @@ function startShowBatch(ids) {
1057
1013
  S.pageKey = pageKey();
1058
1014
  blockedUntil = 0;
1059
1015
  muteConsole(); ensureTcfLocator(); warmNetwork();
1060
- S.pageWarmUntil = ts() + PAGE_WARMUP_MS;
1061
- S.settleDelaySince = 0;
1062
- S.contentSampleH = getContentHeight();
1063
- S.contentSampleTs = ts();
1064
1016
  patchShowAds(); getIO(); ensureDomObserver(); sweepDeadWraps(); requestBurst();
1065
1017
  });
1066
1018
 
@@ -1116,9 +1068,6 @@ function startShowBatch(ids) {
1116
1068
  ensureDomObserver();
1117
1069
  bindNodeBB();
1118
1070
  bindScroll();
1119
- S.pageWarmUntil = ts() + PAGE_WARMUP_MS;
1120
- S.contentSampleH = getContentHeight();
1121
- S.contentSampleTs = ts();
1122
1071
  blockedUntil = 0;
1123
1072
  requestBurst();
1124
1073