nodebb-plugin-ezoic-infinite 1.4.71 → 1.4.72

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.71",
3
+ "version": "1.4.72",
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
@@ -238,25 +238,17 @@
238
238
  return false;
239
239
  }
240
240
 
241
- function buildWrap(target, id, kindClass, afterPos) {
242
- // Use <li> when inserting inside a <ul>/<ol> list (NodeBB topic/category lists),
243
- // otherwise fall back to <div>. This prevents DOM "repair" that can drop/move placeholders.
244
- const parentTag = (target && target.parentElement && target.parentElement.tagName) ? target.parentElement.tagName.toUpperCase() : '';
245
- const useLi = target && target.tagName && target.tagName.toUpperCase() === 'LI' && (parentTag === 'UL' || parentTag === 'OL');
246
-
247
- const wrap = document.createElement(useLi ? 'li' : 'div');
241
+ function buildWrap(id, kindClass, afterPos) {
242
+ const wrap = document.createElement('div');
248
243
  wrap.className = `${WRAP_CLASS} ${kindClass}`;
249
244
  wrap.setAttribute('data-ezoic-after', String(afterPos));
250
-
251
- // Ensure it behaves like a full-width block inside list layouts
252
245
  wrap.style.width = '100%';
253
- if (useLi) wrap.style.listStyle = 'none';
254
246
 
255
247
  const ph = document.createElement('div');
256
248
  ph.id = `${PLACEHOLDER_PREFIX}${id}`;
257
249
  wrap.appendChild(ph);
258
250
  return wrap;
259
- }
251
+ }
260
252
 
261
253
  function findWrap(kindClass, afterPos) {
262
254
  return document.querySelector(`.${WRAP_CLASS}.${kindClass}[data-ezoic-after="${afterPos}"]`);
@@ -276,7 +268,7 @@
276
268
  insertingIds.add(id);
277
269
 
278
270
  try {
279
- const wrap = buildWrap(target, id, kindClass, afterPos);
271
+ const wrap = buildWrap(id, kindClass, afterPos);
280
272
  target.insertAdjacentElement('afterend', wrap);
281
273
  attachFillObserver(wrap, id);
282
274
  return wrap;
@@ -290,24 +282,7 @@
290
282
  if (ids.length) destroyPlaceholderIds(ids);
291
283
  }
292
284
 
293
-
294
- function forcePlaceholderAutoHeight(wrap, id) {
295
- try {
296
- if (!wrap) return;
297
- const ph = wrap.querySelector && wrap.querySelector(`#${PLACEHOLDER_PREFIX}${id}`);
298
- if (!ph) return;
299
- ph.style.setProperty('height', 'auto', 'important');
300
- ph.style.setProperty('min-height', '0px', 'important');
301
- requestAnimationFrame(() => {
302
- try {
303
- ph.style.setProperty('height', 'auto', 'important');
304
- ph.style.setProperty('min-height', '0px', 'important');
305
- } catch (e) {}
306
- });
307
- } catch (e) {}
308
- }
309
-
310
- function patchShowAds() {
285
+ function patchShowAds() {
311
286
  const applyPatch = () => {
312
287
  try {
313
288
  window.ezstandalone = window.ezstandalone || {}, ez = window.ezstandalone;
@@ -343,12 +318,34 @@ function patchShowAds() {
343
318
  }
344
319
  }
345
320
 
346
- function markFilled(wrap, id) {
321
+
322
+ function forcePlaceholderAutoHeight(wrap, id) {
323
+ try {
324
+ if (!wrap || !id) return;
325
+ const ph = wrap.querySelector && wrap.querySelector(`#${PLACEHOLDER_PREFIX}${id}`);
326
+ if (!ph) return;
327
+ // Neutraliser les hauteurs réservées (inline ou CSS) qui créent un espace après la pub
328
+ ph.style.setProperty('height', 'auto', 'important');
329
+ ph.style.setProperty('min-height', '0px', 'important');
330
+ // Eviter le gap baseline sous les iframes/ins
331
+ wrap.querySelectorAll && wrap.querySelectorAll('iframe, ins').forEach(n => {
332
+ try { n.style.setProperty('display', 'block', 'important'); } catch (e) {}
333
+ });
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) {
347
344
  try {
348
345
  if (!wrap) return;
349
346
  if (wrap.__ezoicFillObs) { wrap.__ezoicFillObs.disconnect(); wrap.__ezoicFillObs = null; }
350
347
  wrap.setAttribute('data-ezoic-filled', '1');
351
- if (id) forcePlaceholderAutoHeight(wrap, id);
348
+ try { forcePlaceholderAutoHeight(wrap, id); } catch (e) {}
352
349
  } catch (e) {}
353
350
  }
354
351
 
@@ -427,7 +424,8 @@ function patchShowAds() {
427
424
  window.ezstandalone.cmd.push(function() {
428
425
  if (typeof window.ezstandalone.showAds === 'function') {
429
426
  // Appel batch: showAds(id1, id2, id3...)
430
- window.ezstandalone.showAds(...idsArray);
427
+ const okIds = idsArray.filter(id => { const el = document.getElementById(`${PLACEHOLDER_PREFIX}${id}`); return el && el.isConnected; });
428
+ if (okIds.length) { window.ezstandalone.showAds(...okIds); }
431
429
  // Tracker tous les IDs
432
430
  idsArray.forEach(id => {
433
431
  state.lastShowById.set(id, Date.now());
@@ -576,18 +574,6 @@ function patchShowAds() {
576
574
  // Appel immédiat au lieu de 10ms delay
577
575
  callShowAdsWhenReady(id);
578
576
  }
579
-
580
- liveArr.push({ id, wrap });
581
- if (wrap && (
582
- (wrap.previousElementSibling && wrap.previousElementSibling.classList && wrap.previousElementSibling.classList.contains(WRAP_CLASS)) || (wrap.nextElementSibling && wrap.nextElementSibling.classList && wrap.nextElementSibling.classList.contains(WRAP_CLASS))
583
- )) {
584
- try { wrap.remove(); } catch (e) {}
585
- if (!(pick.recycled && pick.recycled.wrap)) {
586
- try { kindPool.unshift(id); } catch (e) {}
587
- usedSet.delete(id);
588
- }
589
- continue;
590
- }
591
577
  inserted += 1;
592
578
  }
593
579
  return inserted;
package/public/style.css CHANGED
@@ -1,43 +1,31 @@
1
- .ezoic-ad {
2
- height: auto !important;
3
- padding: 0 !important;
4
- margin: 0 !important;
5
- }
6
-
7
- .ezoic-ad * {
8
- margin: 0 !important;
9
- padding: 0 !important;
10
- }
11
1
 
12
- /* --- Ezoic anti-blank-space fixes (NodeBB + Ajaxify) --- */
13
- .ezoic-ad {
14
- display: none; /* shown only when filled */
15
- width: 100% !important;
16
- height: auto !important;
17
- min-height: 0 !important;
18
- padding: 0 !important;
19
- margin: 0 !important;
2
+ /* Wrapper: invisible tant que la pub n'est pas réellement insérée */
3
+ .ezoic-ad{
4
+ display:none;
5
+ width:100%;
6
+ height:auto !important;
7
+ padding:0 !important;
8
+ margin:0 !important;
20
9
  }
21
-
22
10
  .ezoic-ad[data-ezoic-filled="1"]{
23
- display: block;
11
+ display:block;
24
12
  }
25
13
 
26
- /* Ezoic placeholder should not reserve fixed height */
14
+ /* Le placeholder ne doit jamais réserver une hauteur fixe */
27
15
  .ezoic-ad > [id^="ezoic-pub-ad-placeholder-"]{
28
- height: auto !important;
29
- min-height: 0 !important;
30
- margin: 0 !important;
31
- padding: 0 !important;
16
+ height:auto !important;
17
+ min-height:0 !important;
18
+ margin:0 !important;
19
+ padding:0 !important;
32
20
  }
33
21
 
34
- /* prevent baseline gaps under iframes/ins */
22
+ /* Évite le gap baseline sous iframes/ins */
35
23
  .ezoic-ad iframe,
36
24
  .ezoic-ad ins{
37
- display: block !important;
25
+ display:block !important;
38
26
  }
39
27
 
40
- /* neutralize empty spacer divs if any */
28
+ /* Supprimer les spacers vides */
41
29
  .ezoic-ad > div:empty{
42
30
  display:none !important;
43
31
  }