nodebb-plugin-ezoic-infinite 1.7.77 → 1.7.78
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 +13 -7
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -280,18 +280,24 @@
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
function watchFill(id, wrap) {
|
|
283
|
-
//
|
|
284
|
-
//
|
|
285
|
-
// Les no-fills (containers height:0) sont gérés par scheduleEmptyCheck.
|
|
283
|
+
// Phase 1 : attend qu'une vraie pub apparaisse (iframe/ins).
|
|
284
|
+
// Phase 2 : si la pub disparaît ensuite (AMP lazy unload), collapse le wrap.
|
|
286
285
|
const ph = document.getElementById(`${PH_PREFIX}${id}`);
|
|
287
286
|
if (!ph) return;
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
let filled = false;
|
|
288
|
+
const obs = new MutationObserver(() => {
|
|
289
|
+
const hasPub = !!(ph.querySelector('iframe, ins'));
|
|
290
|
+
if (!filled && hasPub) {
|
|
291
|
+
// Pub vient de charger
|
|
292
|
+
filled = true;
|
|
290
293
|
wrap.setAttribute('data-ez-filled', '1');
|
|
294
|
+
wrap.classList.remove('is-empty');
|
|
295
|
+
} else if (filled && !hasPub) {
|
|
296
|
+
// Pub a disparu (AMP unload) → collapse
|
|
297
|
+
wrap.classList.add('is-empty');
|
|
291
298
|
obs.disconnect();
|
|
292
299
|
}
|
|
293
|
-
};
|
|
294
|
-
const obs = new MutationObserver(check);
|
|
300
|
+
});
|
|
295
301
|
obs.observe(ph, { childList: true, subtree: true });
|
|
296
302
|
}
|
|
297
303
|
|