nodebb-plugin-ezoic-infinite 1.6.66 → 1.6.67
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 -8
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -463,10 +463,8 @@
|
|
|
463
463
|
// ─── Orphan / cluster management ────────────────────────────────────────────
|
|
464
464
|
function pruneOrphanWraps(kindClass, items) {
|
|
465
465
|
if (!items || !items.length) return 0;
|
|
466
|
-
const itemSet
|
|
467
|
-
const isMessage
|
|
468
|
-
// Between/category ads are NEVER fully released — only hidden/shown.
|
|
469
|
-
// Releasing frees IDs into the pool → re-injection at wrong positions.
|
|
466
|
+
const itemSet = new Set(items);
|
|
467
|
+
const isMessage = kindClass === 'ezoic-ad-message';
|
|
470
468
|
const allowRelease = isMessage;
|
|
471
469
|
let removed = 0;
|
|
472
470
|
|
|
@@ -490,19 +488,26 @@
|
|
|
490
488
|
|
|
491
489
|
document.querySelectorAll('.' + WRAP_CLASS + '.' + kindClass).forEach((wrap) => {
|
|
492
490
|
if (wrap.getAttribute('data-ezoic-pin') === '1') return;
|
|
493
|
-
const created = parseInt(wrap.getAttribute('data-created') || '0', 10);
|
|
494
|
-
if (created && (now() - created) < keepEmptyWrapMs()) return;
|
|
495
491
|
|
|
496
492
|
if (hasNearbyItem(wrap)) {
|
|
493
|
+
// Anchor is in the DOM → always restore visibility, regardless of age.
|
|
497
494
|
try { wrap.classList.remove('ez-orphan-hidden'); wrap.style.display = ''; } catch (e) {}
|
|
498
495
|
return;
|
|
499
496
|
}
|
|
500
497
|
|
|
501
|
-
// Anchor
|
|
498
|
+
// Anchor is NOT in the DOM → always hide immediately, regardless of age.
|
|
499
|
+
// KEY FIX: the previous code skipped this for fresh wraps (< keepEmptyWrapMs).
|
|
500
|
+
// That meant a wrap whose anchor topic was virtualized away within the first
|
|
501
|
+
// 60-120s would stay visible and float to the top of the list.
|
|
502
502
|
try { wrap.classList.add('ez-orphan-hidden'); wrap.style.display = 'none'; } catch (e) {}
|
|
503
|
+
|
|
504
|
+
// Release (message-ads only): only after the freshness window, and only
|
|
505
|
+
// when far off-screen — we still want late-filling ads to have a chance.
|
|
503
506
|
if (!allowRelease) return;
|
|
504
507
|
|
|
505
|
-
|
|
508
|
+
const created = parseInt(wrap.getAttribute('data-created') || '0', 10);
|
|
509
|
+
if (created && (now() - created) < keepEmptyWrapMs()) return;
|
|
510
|
+
|
|
506
511
|
try {
|
|
507
512
|
const r = wrap.getBoundingClientRect();
|
|
508
513
|
const vh = Math.max(1, window.innerHeight || 1);
|