nodebb-plugin-ezoic-infinite 1.5.69 → 1.5.71
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 +33 -13
- package/public/style.css +6 -0
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -391,33 +391,53 @@
|
|
|
391
391
|
const wraps = document.querySelectorAll(`.${WRAP_CLASS}.${kindClass}`);
|
|
392
392
|
let removed = 0;
|
|
393
393
|
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
const isFilled = (wrap) => {
|
|
395
|
+
return !!(wrap.querySelector('iframe, ins, img, video, [data-google-container-id]'));
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
const hasNearbyItem = (wrap) => {
|
|
399
|
+
// NodeBB/skins can inject separators/spacers; be tolerant.
|
|
396
400
|
let prev = wrap.previousElementSibling;
|
|
397
|
-
for (let i = 0; i <
|
|
398
|
-
if (itemSet.has(prev))
|
|
401
|
+
for (let i = 0; i < 8 && prev; i++) {
|
|
402
|
+
if (itemSet.has(prev)) return true;
|
|
399
403
|
prev = prev.previousElementSibling;
|
|
400
404
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
+
let next = wrap.nextElementSibling;
|
|
406
|
+
for (let i = 0; i < 8 && next; i++) {
|
|
407
|
+
if (itemSet.has(next)) return true;
|
|
408
|
+
next = next.nextElementSibling;
|
|
405
409
|
}
|
|
410
|
+
return false;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
wraps.forEach((wrap) => {
|
|
414
|
+
if (isFilled(wrap)) return; // never prune filled ads
|
|
415
|
+
if (hasNearbyItem(wrap)) return;
|
|
416
|
+
|
|
417
|
+
withInternalDomChange(() => releaseWrapNode(wrap));
|
|
418
|
+
removed++;
|
|
406
419
|
});
|
|
407
420
|
|
|
408
421
|
return removed;
|
|
409
422
|
}
|
|
410
423
|
|
|
411
424
|
function decluster(kindClass) {
|
|
412
|
-
// Remove consecutive wraps (keep the first)
|
|
425
|
+
// Remove "near-consecutive" wraps (keep the first). Be tolerant of spacer nodes.
|
|
413
426
|
const wraps = Array.from(document.querySelectorAll(`.${WRAP_CLASS}.${kindClass}`));
|
|
414
427
|
if (wraps.length < 2) return 0;
|
|
428
|
+
|
|
429
|
+
const isWrap = (el) => !!(el && el.classList && el.classList.contains(WRAP_CLASS));
|
|
430
|
+
|
|
415
431
|
let removed = 0;
|
|
416
432
|
for (const w of wraps) {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
433
|
+
let prev = w.previousElementSibling;
|
|
434
|
+
for (let i = 0; i < 3 && prev; i++) {
|
|
435
|
+
if (isWrap(prev)) {
|
|
436
|
+
withInternalDomChange(() => releaseWrapNode(w));
|
|
437
|
+
removed++;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
prev = prev.previousElementSibling;
|
|
421
441
|
}
|
|
422
442
|
}
|
|
423
443
|
return removed;
|
package/public/style.css
CHANGED
|
@@ -62,3 +62,9 @@
|
|
|
62
62
|
margin: 0 !important;
|
|
63
63
|
padding: 0 !important;
|
|
64
64
|
}
|
|
65
|
+
/* Remove Ezoic's large reserved min-height inside our wrappers (topics/messages) */
|
|
66
|
+
.nodebb-ezoic-wrap .ezoic-ad,
|
|
67
|
+
.nodebb-ezoic-wrap span.ezoic-ad {
|
|
68
|
+
min-height: 1px !important; /* kill 400px gaps */
|
|
69
|
+
height: auto !important;
|
|
70
|
+
}
|