nodebb-plugin-ezoic-infinite 1.4.42 → 1.4.43

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 +10 -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.43",
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,19 +335,7 @@
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);
353
341
  return true;
@@ -367,6 +355,15 @@
367
355
  attempts += 1;
368
356
  const el = document.getElementById(phId);
369
357
  if (el && el.isConnected) {
358
+ // CRITIQUE: Vérifier que le placeholder est VISIBLE
359
+ // Ezoic refuse les placeholders invisibles (offsetHeight = 0)
360
+ if (el.offsetHeight === 0 && attempts < 100) {
361
+ // Pas encore visible, réessayer
362
+ const timeoutId = setTimeout(waitForPh, 50);
363
+ state.activeTimeouts.add(timeoutId);
364
+ return;
365
+ }
366
+
370
367
  // Double-check pageKey juste avant doCall (au cas où cleanup appelé entre-temps)
371
368
  if (state.pageKey !== startPageKey) {
372
369
  // Note: les timeouts seront nettoyés par cleanup()