nodebb-plugin-ezoic-infinite 1.7.28 → 1.7.29
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 +30 -12
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* NodeBB Ezoic Infinite Ads — client.js
|
|
2
|
+
* NodeBB Ezoic Infinite Ads — client.js v34
|
|
3
3
|
*
|
|
4
4
|
* Historique des corrections majeures
|
|
5
5
|
* ────────────────────────────────────
|
|
@@ -262,11 +262,13 @@
|
|
|
262
262
|
return null;
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
function
|
|
266
|
-
// Quand le pool est épuisé :
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
|
-
//
|
|
265
|
+
function moveDistantWrap(klass, targetEl, newKey) {
|
|
266
|
+
// Quand le pool est épuisé : déplace un wrap loin au-dessus du viewport
|
|
267
|
+
// vers la nouvelle position cible. On NE supprime PAS le div placeholder —
|
|
268
|
+
// Ezoic garde sa registry interne et "already been defined" bloque showAds()
|
|
269
|
+
// si on recrée le même ID. En déplaçant le wrap, le placeholder DOM reste
|
|
270
|
+
// le même nœud → Ezoic ne se plaint pas.
|
|
271
|
+
// Priorité : wraps vides d'abord (non remplis = pas de pub perdue).
|
|
270
272
|
const vh = window.innerHeight || 800;
|
|
271
273
|
const threshold = -vh * 4;
|
|
272
274
|
|
|
@@ -287,10 +289,20 @@
|
|
|
287
289
|
|
|
288
290
|
const best = bestEmpty ?? bestFilled;
|
|
289
291
|
if (!best) return null;
|
|
292
|
+
|
|
290
293
|
const id = parseInt(best.getAttribute(A_WRAPID), 10);
|
|
291
294
|
if (!Number.isFinite(id)) return null;
|
|
292
|
-
|
|
293
|
-
|
|
295
|
+
|
|
296
|
+
// Déplacer le wrap après targetEl (même nœud DOM, pas de recréation)
|
|
297
|
+
mutate(() => {
|
|
298
|
+
best.setAttribute(A_ANCHOR, newKey);
|
|
299
|
+
best.setAttribute(A_CREATED, String(ts()));
|
|
300
|
+
best.setAttribute(A_SHOWN, '');
|
|
301
|
+
best.classList.remove('is-empty');
|
|
302
|
+
targetEl.insertAdjacentElement('afterend', best);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
return { id, wrap: best };
|
|
294
306
|
}
|
|
295
307
|
|
|
296
308
|
// ── Wraps DOM ──────────────────────────────────────────────────────────────
|
|
@@ -409,10 +421,16 @@
|
|
|
409
421
|
if (findWrap(key)) continue;
|
|
410
422
|
|
|
411
423
|
let id = pickId(poolKey);
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
424
|
+
if (id) {
|
|
425
|
+
const w = insertAfter(el, id, klass, key);
|
|
426
|
+
if (w) { observePh(id); inserted++; }
|
|
427
|
+
} else {
|
|
428
|
+
// Pool épuisé : déplacer un wrap distant (ne recrée PAS le placeholder)
|
|
429
|
+
const moved = moveDistantWrap(klass, el, key);
|
|
430
|
+
if (!moved) continue;
|
|
431
|
+
observePh(moved.id);
|
|
432
|
+
inserted++;
|
|
433
|
+
}
|
|
416
434
|
}
|
|
417
435
|
return inserted;
|
|
418
436
|
}
|