nodebb-plugin-ezoic-infinite 1.5.29 → 1.5.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.5.29",
3
+ "version": "1.5.30",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -286,8 +286,15 @@ function withInternalDomChange(fn) {
286
286
  let removed = 0;
287
287
 
288
288
  wraps.forEach((wrap) => {
289
- const prev = wrap.previousElementSibling;
290
- if (!prev || !itemSet.has(prev)) {
289
+ // NodeBB can insert separators/spacers; accept an anchor within a few previous siblings
290
+ let ok = false;
291
+ let prev = wrap.previousElementSibling;
292
+ for (let i = 0; i < 3 && prev; i++) {
293
+ if (itemSet.has(prev)) { ok = true; break; }
294
+ prev = prev.previousElementSibling;
295
+ }
296
+
297
+ if (!ok) {
291
298
  const id = getWrapIdFromWrap(wrap);
292
299
  withInternalDomChange(() => {
293
300
  try {
@@ -315,12 +322,12 @@ function withInternalDomChange(fn) {
315
322
  if (hasContent) wrap.classList.remove('is-empty');
316
323
  else wrap.classList.add('is-empty');
317
324
  } catch (e) {}
318
- }, 1800);
325
+ }, 3500);
319
326
  }
320
327
 
321
328
  function buildWrap(id, kindClass, afterPos) {
322
329
  const wrap = document.createElement('div');
323
- wrap.className = `${WRAP_CLASS} ${kindClass} is-empty`;
330
+ wrap.className = `${WRAP_CLASS} ${kindClass}`;
324
331
  wrap.setAttribute('data-ezoic-after', String(afterPos));
325
332
  wrap.setAttribute('data-ezoic-wrapid', String(id));
326
333
  wrap.style.width = '100%';
package/public/style.css CHANGED
@@ -23,11 +23,12 @@
23
23
 
24
24
  /* Collapse empty ad blocks (prevents "holes" when an ad doesn't fill or gets destroyed) */
25
25
  .ezoic-ad.is-empty {
26
- display: none !important;
26
+ display: block !important;
27
27
  margin: 0 !important;
28
28
  padding: 0 !important;
29
29
  height: 0 !important;
30
30
  min-height: 0 !important;
31
+ overflow: hidden !important;
31
32
  }
32
33
 
33
34
  .ezoic-ad {