nodebb-plugin-ezoic-infinite 1.8.5 → 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 -92
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.5",
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,11 +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; // délai minimal avant premiers showAds
93
- const PAGE_SETTLE_GATE_MS = 5000; // fenêtre où l'on surveille la croissance réelle du contenu
94
- const CONTENT_SETTLE_WINDOW_MS = 500;
95
- const CONTENT_SETTLE_MAX_DELAY_MS = 2500;
96
- const CONTENT_GROWTH_THRESHOLD_PX = 40;
97
92
 
98
93
  // Marges IO larges et fixes — observer créé une seule fois au boot
99
94
  const IO_MARGIN_DESKTOP = '2500px 0px 2500px 0px';
@@ -154,12 +149,6 @@
154
149
  burstDeadline: 0,
155
150
  burstCount: 0,
156
151
  lastBurstTs: 0,
157
- pageWarmUntil: 0,
158
- pageSettleUntil: 0,
159
- settleDelaySince: 0,
160
- contentStableStreak: 0,
161
- contentSampleH: 0,
162
- contentSampleTs: 0,
163
152
  };
164
153
 
165
154
  let blockedUntil = 0;
@@ -271,66 +260,6 @@ function destroyBeforeReuse(ids) {
271
260
  }
272
261
 
273
262
 
274
- function getContentHeight() {
275
- try {
276
- const c = document.getElementById('content') || document.querySelector('main#panel') || document.body;
277
- if (!c) return 0;
278
- return Math.max(c.scrollHeight || 0, c.offsetHeight || 0);
279
- } catch (_) { return 0; }
280
- }
281
-
282
- function getShowSettleDelayMs(now = ts()) {
283
- try {
284
- // Warmup minimal fixe (évite de tirer des pubs avant le 1er rendu NodeBB)
285
- if (S.pageWarmUntil && now < S.pageWarmUntil) {
286
- return Math.max(0, Math.min(250, S.pageWarmUntil - now));
287
- }
288
-
289
- // En dehors de la fenêtre "page en train de se construire", pas de gate.
290
- if (!(S.pageSettleUntil && now < S.pageSettleUntil)) return 0;
291
-
292
- const h = getContentHeight();
293
- const prevH = S.contentSampleH || 0;
294
- const prevTs = S.contentSampleTs || 0;
295
- const dt = prevTs ? (now - prevTs) : 0;
296
- const grew = h - prevH;
297
-
298
- S.contentSampleH = h;
299
- S.contentSampleTs = now;
300
-
301
- if (!prevTs || h <= 0) {
302
- S.contentStableStreak = 0;
303
- return CONTENT_SETTLE_WINDOW_MS;
304
- }
305
-
306
- // Si les samples sont trop rapprochés, on attend une vraie fenêtre d'observation.
307
- if (dt < Math.max(120, CONTENT_SETTLE_WINDOW_MS * 0.6)) {
308
- return Math.max(80, CONTENT_SETTLE_WINDOW_MS - dt);
309
- }
310
-
311
- const significantGrowth = grew >= CONTENT_GROWTH_THRESHOLD_PX;
312
- if (significantGrowth) {
313
- if (!S.settleDelaySince) S.settleDelaySince = now;
314
- S.contentStableStreak = 0;
315
- if ((now - S.settleDelaySince) < CONTENT_SETTLE_MAX_DELAY_MS) {
316
- return CONTENT_SETTLE_WINDOW_MS;
317
- }
318
- // plafond atteint : on laisse passer pour ne pas bloquer indéfiniment
319
- S.settleDelaySince = 0;
320
- return 0;
321
- }
322
-
323
- // Nécessite 2 fenêtres stables de suite avant de laisser partir le batch (début de page)
324
- S.contentStableStreak = (S.contentStableStreak || 0) + 1;
325
- if (S.contentStableStreak < 2) return Math.min(200, CONTENT_SETTLE_WINDOW_MS);
326
-
327
- S.settleDelaySince = 0;
328
- return 0;
329
- } catch (_) {}
330
- return 0;
331
- }
332
-
333
-
334
263
  // ── Config ─────────────────────────────────────────────────────────────────
335
264
 
336
265
  async function fetchConfig() {
@@ -751,19 +680,17 @@ function enqueueShow(id) {
751
680
  scheduleDrainQueue();
752
681
  }
753
682
 
754
- function scheduleDrainQueue(delayMs = BATCH_FLUSH_MS) {
683
+ function scheduleDrainQueue() {
755
684
  if (isBlocked()) return;
756
685
  if (S.showBatchTimer) return;
757
686
  S.showBatchTimer = setTimeout(() => {
758
687
  S.showBatchTimer = 0;
759
688
  drainQueue();
760
- }, Math.max(0, delayMs|0));
689
+ }, BATCH_FLUSH_MS);
761
690
  }
762
691
 
763
692
  function drainQueue() {
764
693
  if (isBlocked()) return;
765
- const settleDelay = getShowSettleDelayMs();
766
- if (settleDelay > 0) { scheduleDrainQueue(Math.max(BATCH_FLUSH_MS, settleDelay)); return; }
767
694
  const free = Math.max(0, MAX_INFLIGHT - S.inflight);
768
695
  if (!free || !S.pending.length) return;
769
696
 
@@ -981,12 +908,6 @@ function startShowBatch(ids) {
981
908
  S.scrollSpeed = 0;
982
909
  S.lastScrollY = 0;
983
910
  S.lastScrollTs = 0;
984
- S.pageWarmUntil = 0;
985
- S.pageSettleUntil = 0;
986
- S.contentStableStreak = 0;
987
- S.settleDelaySince = 0;
988
- S.contentSampleH = 0;
989
- S.contentSampleTs = 0;
990
911
  }
991
912
 
992
913
  // ── MutationObserver ───────────────────────────────────────────────────────
@@ -1092,12 +1013,6 @@ function startShowBatch(ids) {
1092
1013
  S.pageKey = pageKey();
1093
1014
  blockedUntil = 0;
1094
1015
  muteConsole(); ensureTcfLocator(); warmNetwork();
1095
- S.pageWarmUntil = ts() + PAGE_WARMUP_MS;
1096
- S.pageSettleUntil = ts() + PAGE_SETTLE_GATE_MS;
1097
- S.settleDelaySince = 0;
1098
- S.contentStableStreak = 0;
1099
- S.contentSampleH = getContentHeight();
1100
- S.contentSampleTs = ts();
1101
1016
  patchShowAds(); getIO(); ensureDomObserver(); sweepDeadWraps(); requestBurst();
1102
1017
  });
1103
1018
 
@@ -1153,11 +1068,6 @@ function startShowBatch(ids) {
1153
1068
  ensureDomObserver();
1154
1069
  bindNodeBB();
1155
1070
  bindScroll();
1156
- S.pageWarmUntil = ts() + PAGE_WARMUP_MS;
1157
- S.pageSettleUntil = ts() + PAGE_SETTLE_GATE_MS;
1158
- S.contentStableStreak = 0;
1159
- S.contentSampleH = getContentHeight();
1160
- S.contentSampleTs = ts();
1161
1071
  blockedUntil = 0;
1162
1072
  requestBurst();
1163
1073