nodebb-plugin-ezoic-infinite 1.7.77 → 1.7.79
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 +15 -8
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -280,18 +280,25 @@
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
function watchFill(id, wrap) {
|
|
283
|
-
//
|
|
284
|
-
//
|
|
285
|
-
//
|
|
283
|
+
// Phase 1 : attend qu'une vraie pub apparaisse (iframe/ins).
|
|
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.
|
|
286
286
|
const ph = document.getElementById(`${PH_PREFIX}${id}`);
|
|
287
287
|
if (!ph) return;
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
let filled = false;
|
|
289
|
+
const obs = new MutationObserver(() => {
|
|
290
|
+
const hasPub = !!(ph.querySelector('iframe, ins'));
|
|
291
|
+
if (!filled && hasPub) {
|
|
292
|
+
filled = true;
|
|
290
293
|
wrap.setAttribute('data-ez-filled', '1');
|
|
291
|
-
|
|
294
|
+
wrap.classList.remove('is-empty');
|
|
295
|
+
} else if (filled && !hasPub) {
|
|
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 (_) {}
|
|
292
300
|
}
|
|
293
|
-
};
|
|
294
|
-
const obs = new MutationObserver(check);
|
|
301
|
+
});
|
|
295
302
|
obs.observe(ph, { childList: true, subtree: true });
|
|
296
303
|
}
|
|
297
304
|
|