nodebb-plugin-ezoic-infinite 1.4.74 → 1.4.75

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.4.74",
3
+ "version": "1.4.75",
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
@@ -23,10 +23,6 @@
23
23
  usedPosts: new Set(),
24
24
  usedCategories: new Set(),
25
25
 
26
- liveTopics: [],
27
- livePosts: [],
28
- liveCategories: [],
29
-
30
26
  lastShowById: new Map(),
31
27
  pendingById: new Set(),
32
28
  definedIds: new Set(),
@@ -146,32 +142,17 @@
146
142
  const ph = wrapper.querySelector('[id^="ezoic-pub-ad-placeholder-"]');
147
143
  if (!ph) return;
148
144
 
149
- // Supprimer TOUS les éléments après le placeholder rempli
150
- // qui créent de l'espace vertical
151
- let found = false;
145
+ // ULTRA-AGRESSIF: Supprimer TOUT sauf le placeholder
152
146
  Array.from(wrapper.children).forEach(child => {
153
- if (child === ph || child.contains(ph)) {
154
- found = true;
155
- return;
156
- }
157
-
158
- // Si élément APRÈS le placeholder
159
- if (found) {
160
- const rect = child.getBoundingClientRect();
161
- const computed = window.getComputedStyle(child);
162
-
163
- // Supprimer si:
164
- // 1. Height > 0 mais pas de texte/image visible
165
- // 2. Ou opacity: 0
166
- // 3. Ou visibility: hidden
167
- const hasContent = child.textContent.trim().length > 0 ||
168
- child.querySelector('img, iframe, video');
169
-
170
- if (!hasContent || computed.opacity === '0' || computed.visibility === 'hidden') {
147
+ if (child === ph || child.contains(ph)) return;
148
+ // Supprimer TOUT le reste
171
149
  child.remove();
172
- }
173
- }
174
150
  });
151
+
152
+ // Forcer wrapper sans espace
153
+ wrapper.style.height = 'auto';
154
+ wrapper.style.overflow = 'hidden';
155
+ wrapper.style.lineHeight = '0';
175
156
  });
176
157
  } catch (e) {}
177
158
  }
@@ -247,7 +228,6 @@
247
228
  wrap.className = `${WRAP_CLASS} ${kindClass}`;
248
229
  wrap.setAttribute('data-ezoic-after', String(afterPos));
249
230
  wrap.style.width = '100%';
250
- wrap.style.display = 'none';
251
231
 
252
232
  const ph = document.createElement('div');
253
233
  ph.id = `${PLACEHOLDER_PREFIX}${id}`;
@@ -323,31 +303,11 @@
323
303
  }
324
304
  }
325
305
 
326
-
327
- function forcePlaceholderAutoHeight(wrap, id) {
328
- try {
329
- if (!wrap) return;
330
- const ph = id ? wrap.querySelector && wrap.querySelector(`#${PLACEHOLDER_PREFIX}${id}`) : (wrap.querySelector && wrap.querySelector(`[id^="${PLACEHOLDER_PREFIX}"]`));
331
- if (!ph) return;
332
- ph.style.setProperty('height', 'auto', 'important');
333
- ph.style.setProperty('min-height', '0px', 'important');
334
- requestAnimationFrame(() => {
335
- try {
336
- ph.style.setProperty('height', 'auto', 'important');
337
- ph.style.setProperty('min-height', '0px', 'important');
338
- } catch (e) {}
339
- });
340
- } catch (e) {}
341
- }
342
-
343
- function markFilled(wrap, id) {
306
+ function markFilled(wrap) {
344
307
  try {
345
308
  if (!wrap) return;
346
309
  if (wrap.__ezoicFillObs) { wrap.__ezoicFillObs.disconnect(); wrap.__ezoicFillObs = null; }
347
310
  wrap.setAttribute('data-ezoic-filled', '1');
348
- // show wrapper only when filled (avoid blank gaps if consent/CMP blocks)
349
- wrap.style.display = 'block';
350
- forcePlaceholderAutoHeight(wrap, id);
351
311
  } catch (e) {}
352
312
  }
353
313
 
@@ -361,13 +321,13 @@
361
321
  if (!ph) return;
362
322
  // Already filled?
363
323
  if (ph.childNodes && ph.childNodes.length > 0) {
364
- markFilled(wrap, id); // Afficher wrapper
324
+ markFilled(wrap); // Afficher wrapper
365
325
  sessionDefinedIds.add(id);
366
326
  return;
367
327
  }
368
328
  const obs = new MutationObserver(() => {
369
329
  if (ph.childNodes && ph.childNodes.length > 0) {
370
- markFilled(wrap, id); // CRITIQUE: Afficher wrapper maintenant
330
+ markFilled(wrap); // CRITIQUE: Afficher wrapper maintenant
371
331
  try { sessionDefinedIds.add(id); } catch (e) {}
372
332
  try { obs.disconnect(); } catch (e) {}
373
333
  }
@@ -387,7 +347,7 @@
387
347
  const filled = !!(ph.childNodes && ph.childNodes.length > 0);
388
348
  if (filled) {
389
349
  try { state.definedIds && state.definedIds.add(id); sessionDefinedIds.add(id); } catch (e) {}
390
- try { markFilled(wrap, id); } catch (e) {}
350
+ try { markFilled(wrap); } catch (e) {}
391
351
  }
392
352
  return filled;
393
353
  }
@@ -454,8 +414,6 @@
454
414
  window.ezstandalone = window.ezstandalone || {};
455
415
  if (typeof window.ezstandalone.showAds === 'function') {
456
416
 
457
- const elNow = document.getElementById(phId);
458
- if (!elNow || !elNow.isConnected) return false;
459
417
  state.lastShowById.set(id, Date.now());
460
418
  window.ezstandalone.showAds(id);
461
419
  sessionDefinedIds.add(id);
@@ -531,7 +489,7 @@
531
489
  return Array.from(new Set(out)).sort((a, b) => a - b);
532
490
  }
533
491
 
534
- function injectBetween(kindClass, items, interval, showFirst, kindPool, usedSet, liveArr) {
492
+ function injectBetween(kindClass, items, interval, showFirst, kindPool, usedSet) {
535
493
  if (!items.length) return 0;
536
494
  const targets = computeTargets(items.length, interval, showFirst);
537
495
 
@@ -552,7 +510,7 @@
552
510
 
553
511
  if (findWrap(kindClass, afterPos)) continue;
554
512
 
555
- const pick = pickId(kindPool, liveArr || []);
513
+ const pick = pickId(kindPool, []);
556
514
  const id = pick.id;
557
515
  if (!id) break;
558
516
 
@@ -578,7 +536,7 @@
578
536
  callShowAdsWhenReady(id);
579
537
  }
580
538
 
581
- if (liveArr) liveArr.push({ id, wrap });
539
+ liveArr.push({ id, wrap });
582
540
  if (wrap && (
583
541
  (wrap.previousElementSibling && wrap.previousElementSibling.classList && wrap.previousElementSibling.classList.contains(WRAP_CLASS)) || (wrap.nextElementSibling && wrap.nextElementSibling.classList && wrap.nextElementSibling.classList.contains(WRAP_CLASS))
584
542
  )) {
@@ -678,7 +636,7 @@
678
636
  Math.max(1, parseInt(cfg.messageIntervalPosts, 10) || 3),
679
637
  normalizeBool(cfg.showFirstMessageAd),
680
638
  state.poolPosts,
681
- state.usedPosts, state.livePosts);
639
+ state.usedPosts);
682
640
  }
683
641
  } else if (kind === 'categoryTopics') {
684
642
  if (normalizeBool(cfg.enableBetweenAds)) {
@@ -686,7 +644,7 @@
686
644
  Math.max(1, parseInt(cfg.intervalPosts, 10) || 6),
687
645
  normalizeBool(cfg.showFirstTopicAd),
688
646
  state.poolTopics,
689
- state.usedTopics, state.liveTopics);
647
+ state.usedTopics);
690
648
  }
691
649
  } else if (kind === 'categories') {
692
650
  if (normalizeBool(cfg.enableCategoryAds)) {
@@ -694,7 +652,7 @@
694
652
  Math.max(1, parseInt(cfg.intervalCategories, 10) || 4),
695
653
  normalizeBool(cfg.showFirstCategoryAd),
696
654
  state.poolCategories,
697
- state.usedCategories, state.liveCategories);
655
+ state.usedCategories);
698
656
  }
699
657
  }
700
658
 
package/public/style.css CHANGED
@@ -1,40 +1,21 @@
1
- /* Ezoic Infinite Ads (NodeBB) - production safe */
2
- /* Hide wrappers until ad actually fills to avoid blank gaps (e.g., CMP/consent issues) */
3
- .ezoic-ad{
4
- display:none;
5
- height:auto !important;
6
- min-height:0 !important;
7
- padding:0 !important;
8
- margin:0 !important;
9
- width:100%;
1
+ .ezoic-ad {
2
+ height: auto !important;
3
+ padding: 0 !important;
4
+ margin: 0 !important;
5
+ border: 0 !important;
6
+ overflow: hidden !important;
7
+ line-height: 0 !important;
10
8
  }
11
9
 
12
- /* Marked filled => show */
13
- .ezoic-ad[data-ezoic-filled="1"]{
14
- display:block;
10
+ .ezoic-ad * {
11
+ margin: 0 !important;
12
+ padding: 0 !important;
13
+ border: 0 !important;
15
14
  }
16
15
 
17
- /* Placeholder must not reserve fixed height */
18
- .ezoic-ad > [id^="ezoic-pub-ad-placeholder-"]{
19
- height:auto !important;
20
- min-height:0 !important;
21
- margin:0 !important;
22
- padding:0 !important;
23
- }
24
-
25
- /* Prevent baseline gaps under iframes/ins */
26
- .ezoic-ad iframe,
27
- .ezoic-ad ins{
28
- display:block !important;
29
- }
30
-
31
- /* Remove empty spacer divs if any */
32
- .ezoic-ad > div:empty{
33
- display:none !important;
34
- }
35
-
36
- /* Defensive: wipe margins/paddings inside wrapper */
37
- .ezoic-ad *{
38
- margin:0 !important;
39
- padding:0 !important;
40
- }
16
+ .ezoic-ad::after {
17
+ content: '';
18
+ display: block;
19
+ height: 0 !important;
20
+ margin: 0 !important;
21
+ }