nodebb-plugin-ezoic-infinite 1.7.78 → 1.7.80
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 +12 -6
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -281,21 +281,22 @@
|
|
|
281
281
|
|
|
282
282
|
function watchFill(id, wrap) {
|
|
283
283
|
// Phase 1 : attend qu'une vraie pub apparaisse (iframe/ins).
|
|
284
|
-
// Phase 2 : si la pub disparaît
|
|
284
|
+
// Phase 2 : si la pub disparaît (AMP lazy unload) → réobserve le placeholder
|
|
285
|
+
// pour relancer showAds quand il repasse dans le viewport.
|
|
285
286
|
const ph = document.getElementById(`${PH_PREFIX}${id}`);
|
|
286
287
|
if (!ph) return;
|
|
287
288
|
let filled = false;
|
|
288
289
|
const obs = new MutationObserver(() => {
|
|
289
290
|
const hasPub = !!(ph.querySelector('iframe, ins'));
|
|
290
291
|
if (!filled && hasPub) {
|
|
291
|
-
// Pub vient de charger
|
|
292
292
|
filled = true;
|
|
293
293
|
wrap.setAttribute('data-ez-filled', '1');
|
|
294
294
|
wrap.classList.remove('is-empty');
|
|
295
295
|
} else if (filled && !hasPub) {
|
|
296
|
-
// Pub
|
|
297
|
-
wrap.
|
|
298
|
-
|
|
296
|
+
// Pub disparue → retirer data-ez-filled et réobserver pour reload
|
|
297
|
+
wrap.removeAttribute('data-ez-filled');
|
|
298
|
+
filled = false;
|
|
299
|
+
try { getIO()?.observe(ph); } catch (_) {}
|
|
299
300
|
}
|
|
300
301
|
});
|
|
301
302
|
obs.observe(ph, { childList: true, subtree: true });
|
|
@@ -445,7 +446,12 @@
|
|
|
445
446
|
S.lastShow.set(id, t);
|
|
446
447
|
try { ph.closest?.(`.${WRAP_CLASS}`)?.classList.remove('is-empty'); } catch (_) {}
|
|
447
448
|
ezCmd(ez => {
|
|
448
|
-
|
|
449
|
+
// displayMore = API Ezoic documentée pour l'infinite scroll
|
|
450
|
+
// Évite le passage en 'unused' que showAds cause sur les slots dynamiques
|
|
451
|
+
try {
|
|
452
|
+
if (typeof ez.displayMore === 'function') ez.displayMore([id]);
|
|
453
|
+
else ez.showAds(id);
|
|
454
|
+
} catch (_) { try { ez.showAds(id); } catch (_) {} }
|
|
449
455
|
scheduleEmptyCheck(id);
|
|
450
456
|
setTimeout(() => { clearTimeout(timer); release(); }, 700);
|
|
451
457
|
});
|