nodebb-plugin-ezoic-infinite 1.4.16 → 1.4.17
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 +11 -0
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -221,6 +221,13 @@
|
|
|
221
221
|
function insertAfter(target, id, kindClass, afterPos) {
|
|
222
222
|
if (!target || !target.insertAdjacentElement) return null;
|
|
223
223
|
if (findWrap(kindClass, afterPos)) return null;
|
|
224
|
+
// CRITICAL: Vérifier qu'aucun placeholder avec cet ID n'existe déjà dans le DOM
|
|
225
|
+
// (peut arriver si deux scheduleRun concurrents recyclent le même ID)
|
|
226
|
+
const existingPh = document.getElementById(`${PLACEHOLDER_PREFIX}${id}`);
|
|
227
|
+
if (existingPh && existingPh.isConnected) {
|
|
228
|
+
// Un placeholder avec cet ID existe déjà - ne pas créer de doublon
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
224
231
|
const wrap = buildWrap(id, kindClass, afterPos);
|
|
225
232
|
target.insertAdjacentElement('afterend', wrap);
|
|
226
233
|
attachFillObserver(wrap, id);
|
|
@@ -339,6 +346,10 @@
|
|
|
339
346
|
if (!id) return;
|
|
340
347
|
if (state.badIds && state.badIds.has(id)) return;
|
|
341
348
|
if (state.retryQueueSet.has(id)) return;
|
|
349
|
+
// Ne pas enqueue si showAds a été appelé récemment (< 2s) pour éviter "already been defined"
|
|
350
|
+
const now = Date.now();
|
|
351
|
+
const last = state.lastShowById.get(id) || 0;
|
|
352
|
+
if (now - last < 2000) return;
|
|
342
353
|
state.retryQueueSet.add(id);
|
|
343
354
|
state.retryQueue.push(id);
|
|
344
355
|
processRetryQueue();
|