nodebb-plugin-ezoic-infinite 1.4.42 → 1.4.44

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 +20 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.42",
3
+ "version": "1.4.44",
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
@@ -335,21 +335,10 @@
335
335
  try {
336
336
  window.ezstandalone = window.ezstandalone || {};
337
337
  if (typeof window.ezstandalone.showAds === 'function') {
338
- // DEBUG: Logger infos du placeholder avant showAds
339
- const ph = document.getElementById(phId);
340
- if (ph) {
341
- const wrapper = ph.closest('.ezoic-ad');
342
- const wordCount = (document.body.innerText || '').split(/\s+/).length;
343
- console.log('[UNUSED?] ID', id, {
344
- inDOM: !!ph,
345
- visible: ph.offsetHeight > 0,
346
- wordCount: wordCount,
347
- wrapperClass: wrapper ? wrapper.className : 'no-wrapper',
348
- viewport: window.innerHeight
349
- });
350
- }
338
+
351
339
  state.lastShowById.set(id, Date.now());
352
340
  window.ezstandalone.showAds(id);
341
+ sessionDefinedIds.add(id);
353
342
  return true;
354
343
  }
355
344
  } catch (e) {}
@@ -367,6 +356,23 @@
367
356
  attempts += 1;
368
357
  const el = document.getElementById(phId);
369
358
  if (el && el.isConnected) {
359
+ // CRITIQUE: Vérifier que le placeholder est VISIBLE
360
+ // Ezoic refuse les placeholders invisibles (offsetHeight = 0)
361
+ if (el.offsetHeight === 0 && attempts < 100) {
362
+ // Pas encore visible, réessayer
363
+ if (attempts % 10 === 0) {
364
+ console.log('[OFFSET] ID', id, 'invisible après', attempts, 'tentatives, height:', el.offsetHeight, 'display:', window.getComputedStyle(el).display);
365
+ }
366
+ const timeoutId = setTimeout(waitForPh, 50);
367
+ state.activeTimeouts.add(timeoutId);
368
+ return;
369
+ }
370
+
371
+ // Si on arrive ici, soit visible, soit timeout
372
+ if (el.offsetHeight === 0) {
373
+ console.log('[OFFSET] ID', id, 'TIMEOUT après', attempts, 'tentatives - height:', el.offsetHeight, 'display:', window.getComputedStyle(el).display, 'parent:', el.parentElement?.tagName);
374
+ }
375
+
370
376
  // Double-check pageKey juste avant doCall (au cas où cleanup appelé entre-temps)
371
377
  if (state.pageKey !== startPageKey) {
372
378
  // Note: les timeouts seront nettoyés par cleanup()
@@ -390,6 +396,7 @@
390
396
  state.pendingById.delete(id);
391
397
  state.lastShowById.set(id, Date.now());
392
398
  window.ezstandalone.showAds(id);
399
+ sessionDefinedIds.add(id);
393
400
  }
394
401
  } catch (e) {}
395
402
  });