nodebb-plugin-ezoic-infinite 1.8.27 → 1.8.28
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 +59 -2
- package/public/style.css +11 -0
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -144,13 +144,51 @@
|
|
|
144
144
|
const isBlocked = () => ts() < blockedUntil;
|
|
145
145
|
const isMobile = () => { try { return window.innerWidth < 768; } catch (_) { return false; } };
|
|
146
146
|
const normBool = v => v === true || v === 'true' || v === 1 || v === '1' || v === 'on';
|
|
147
|
-
const
|
|
147
|
+
const FILL_SEL = 'iframe, ins, img, video, [data-google-container-id], div[id$="__container__"]';
|
|
148
|
+
const isFilled = n => !!(n?.querySelector?.(FILL_SEL));
|
|
148
149
|
|
|
149
150
|
function mutate(fn) {
|
|
150
151
|
S.mutGuard++;
|
|
151
152
|
try { fn(); } finally { S.mutGuard--; }
|
|
152
153
|
}
|
|
153
154
|
|
|
155
|
+
function clearEmptyIfFilled(wrap) {
|
|
156
|
+
try {
|
|
157
|
+
if (!wrap?.isConnected) return false;
|
|
158
|
+
const ph = wrap.querySelector(`[id^="${PH_PREFIX}"]`);
|
|
159
|
+
if (!ph) return false;
|
|
160
|
+
if (!isFilled(ph)) return false;
|
|
161
|
+
wrap.classList.remove('is-empty');
|
|
162
|
+
return true;
|
|
163
|
+
} catch (_) { return false; }
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function scheduleUncollapseChecksForWrap(wrap) {
|
|
167
|
+
if (!wrap) return;
|
|
168
|
+
for (const ms of [500, 1500, 3000, 7000, 15000]) {
|
|
169
|
+
setTimeout(() => { try { clearEmptyIfFilled(wrap); } catch (_) {} }, ms);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
function clearEmptyIfFilled(wrap) {
|
|
175
|
+
try {
|
|
176
|
+
if (!wrap?.isConnected) return false;
|
|
177
|
+
const ph = wrap.querySelector(`[id^="${PH_PREFIX}"]`);
|
|
178
|
+
if (!ph) return false;
|
|
179
|
+
if (!isFilled(ph)) return false;
|
|
180
|
+
wrap.classList.remove('is-empty');
|
|
181
|
+
return true;
|
|
182
|
+
} catch (_) { return false; }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function scheduleUncollapseChecksForWrap(wrap) {
|
|
186
|
+
if (!wrap) return;
|
|
187
|
+
for (const ms of [500, 1500, 3000, 7000, 15000]) {
|
|
188
|
+
setTimeout(() => { try { clearEmptyIfFilled(wrap); } catch (_) {} }, ms);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
154
192
|
// ── Config ─────────────────────────────────────────────────────────────────
|
|
155
193
|
|
|
156
194
|
async function fetchConfig() {
|
|
@@ -598,7 +636,10 @@
|
|
|
598
636
|
window.ezstandalone = window.ezstandalone || {};
|
|
599
637
|
const ez = window.ezstandalone;
|
|
600
638
|
const doShow = () => {
|
|
639
|
+
let wrap = null;
|
|
640
|
+
try { wrap = ph.closest?.(`.${WRAP_CLASS}`) || null; } catch (_) {}
|
|
601
641
|
try { ez.showAds(id); } catch (_) {}
|
|
642
|
+
if (wrap) scheduleUncollapseChecksForWrap(wrap);
|
|
602
643
|
scheduleEmptyCheck(id, t);
|
|
603
644
|
setTimeout(() => { clearTimeout(timer); release(); }, 700);
|
|
604
645
|
};
|
|
@@ -614,7 +655,8 @@
|
|
|
614
655
|
const wrap = ph?.closest?.(`.${WRAP_CLASS}`);
|
|
615
656
|
if (!wrap || !ph?.isConnected) return;
|
|
616
657
|
if (parseInt(wrap.getAttribute(A_SHOWN) || '0', 10) > showTs) return;
|
|
617
|
-
|
|
658
|
+
if (clearEmptyIfFilled(wrap)) return;
|
|
659
|
+
wrap.classList.add('is-empty');
|
|
618
660
|
} catch (_) {}
|
|
619
661
|
}, EMPTY_CHECK_MS);
|
|
620
662
|
}
|
|
@@ -776,6 +818,21 @@
|
|
|
776
818
|
if (S.domObs) return;
|
|
777
819
|
S.domObs = new MutationObserver(muts => {
|
|
778
820
|
if (S.mutGuard > 0 || isBlocked()) return;
|
|
821
|
+
for (const m of muts) {
|
|
822
|
+
if (m.type !== 'childList') continue;
|
|
823
|
+
for (const node of m.addedNodes) {
|
|
824
|
+
if (!(node instanceof Element)) continue;
|
|
825
|
+
let hasAd = false;
|
|
826
|
+
try {
|
|
827
|
+
hasAd = !!(node.matches?.(FILL_SEL) || node.querySelector?.(FILL_SEL));
|
|
828
|
+
} catch (_) {}
|
|
829
|
+
if (!hasAd) continue;
|
|
830
|
+
try {
|
|
831
|
+
const wrap = node.closest?.(`.${WRAP_CLASS}.is-empty`) || m.target?.closest?.(`.${WRAP_CLASS}.is-empty`);
|
|
832
|
+
if (wrap) clearEmptyIfFilled(wrap);
|
|
833
|
+
} catch (_) {}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
779
836
|
const relevant = (() => {
|
|
780
837
|
const k = getKind();
|
|
781
838
|
if (k === 'topic') return [SEL.post];
|
package/public/style.css
CHANGED
|
@@ -78,3 +78,14 @@
|
|
|
78
78
|
margin: 0 !important;
|
|
79
79
|
padding: 0 !important;
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/* Anti-faux-empty : si une pub est présente, annule le collapse */
|
|
84
|
+
.nodebb-ezoic-wrap.is-empty:has(iframe),
|
|
85
|
+
.nodebb-ezoic-wrap.is-empty:has([data-google-container-id]),
|
|
86
|
+
.nodebb-ezoic-wrap.is-empty:has(div[id$="__container__"]) {
|
|
87
|
+
height: auto !important;
|
|
88
|
+
min-height: 0 !important;
|
|
89
|
+
max-height: none !important;
|
|
90
|
+
overflow: visible !important;
|
|
91
|
+
}
|