nodebb-plugin-ezoic-infinite 1.6.10 → 1.6.11

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.6.10",
3
+ "version": "1.6.11",
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
@@ -1,21 +1,34 @@
1
1
  (function () {
2
2
  'use strict';
3
3
 
4
- function createWrapElement(kindClass, targetEl) {
4
+ function createWrapHostAndWrap(kindClass, targetEl) {
5
+ // For <ul>/<ol> we MUST insert a <li> to keep valid DOM.
6
+ // But for compatibility with existing selectors (often 'div.nodebb-ezoic-wrap'),
7
+ // we keep the actual wrap as a DIV inside the LI.
8
+ var host = null;
5
9
  try {
6
10
  if (kindClass === 'ezoic-ad-between') {
7
11
  var p = targetEl && targetEl.parentElement;
8
12
  if (p && (p.tagName === 'UL' || p.tagName === 'OL')) {
9
- var li = document.createElement('li');
10
- li.className = 'nodebb-ezoic-wrap ' + kindClass;
11
- li.setAttribute('role', 'listitem');
12
- return li;
13
+ host = document.createElement('li');
14
+ host.className = 'nodebb-ezoic-host';
15
+ host.setAttribute('role', 'listitem');
16
+ host.style.listStyle = 'none';
17
+ host.style.width = '100%';
13
18
  }
14
19
  }
15
20
  } catch (e) {}
16
- var div = document.createElement('div');
17
- div.className = 'nodebb-ezoic-wrap ' + kindClass;
18
- return div;
21
+
22
+ var pair = createWrapHostAndWrap(kindClass, el);
23
+ var host = pair.hostEl;
24
+ var wrap = pair.wrapEl;
25
+ wrap.className = 'nodebb-ezoic-wrap ' + kindClass;
26
+
27
+ if (host) {
28
+ host.appendChild(wrap);
29
+ return { hostEl: host, wrapEl: wrap };
30
+ }
31
+ return { hostEl: wrap, wrapEl: wrap };
19
32
  }
20
33
 
21
34
 
@@ -655,7 +668,9 @@ function globalGapFixInit() {
655
668
  // ---------------- insertion primitives ----------------
656
669
 
657
670
  function buildWrap(id, kindClass, afterPos, createPlaceholder) {
658
- const wrap = createWrapElement(kindClass, el);
671
+ const pair = createWrapHostAndWrap(kindClass, el);
672
+ const host = pair.hostEl;
673
+ const wrap = pair.wrapEl;
659
674
  wrap.className = `${WRAP_CLASS} ${kindClass}`;
660
675
  wrap.setAttribute('data-ezoic-after', String(afterPos));
661
676
  wrap.setAttribute('data-ezoic-wrapid', String(id));
@@ -665,7 +680,6 @@ function globalGapFixInit() {
665
680
  wrap.setAttribute('data-ezoic-pin', '1');
666
681
  }
667
682
  wrap.style.width = '100%';
668
- try { if (wrap.tagName === 'LI') { wrap.style.listStyle = 'none'; wrap.setAttribute('data-ezoic-li','1'); } } catch(e) {}
669
683
 
670
684
  if (createPlaceholder) {
671
685
  const ph = document.createElement('div');
package/public/style.css CHANGED
@@ -81,7 +81,9 @@
81
81
  }
82
82
 
83
83
 
84
- /* ===== V12 between-as-li ===== */
85
- li.nodebb-ezoic-wrap.ezoic-ad-between { list-style: none; width: 100%; }
86
- /* ===== /V12 ===== */
84
+ /* ===== V12.1 li host wrapper ===== */
85
+ li.nodebb-ezoic-host { list-style: none; width: 100%; }
86
+ /* keep inner wrap full width */
87
+ li.nodebb-ezoic-host > .nodebb-ezoic-wrap { width: 100%; }
88
+ /* ===== /V12.1 ===== */
87
89