nodebb-plugin-ezoic-infinite 1.6.76 → 1.6.77
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 +27 -68
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -133,29 +133,7 @@ function tightenEzoicMinHeight(wrap) {
|
|
|
133
133
|
if (!wrap || !wrap.querySelector) return;
|
|
134
134
|
|
|
135
135
|
const iframes = wrap.querySelectorAll('iframe');
|
|
136
|
-
|
|
137
|
-
// If the wrap is still empty, Ezoic often leaves inline `min-height:400px !important` on
|
|
138
|
-
// nested `.ezoic-ad` containers, which creates large blank gaps. We can't remove it with CSS.
|
|
139
|
-
// We collapse those gaps after a short grace period, while still allowing late fill.
|
|
140
|
-
if (!iframes || !iframes.length) {
|
|
141
|
-
try {
|
|
142
|
-
const created = parseInt(wrap.getAttribute('data-created') || '0', 10);
|
|
143
|
-
const age = created ? (now() - created) : 0;
|
|
144
|
-
// Give auctions/CMP a bit of time; then collapse the notorious 400px gap.
|
|
145
|
-
if (age >= 12000) {
|
|
146
|
-
const nodes = wrap.querySelectorAll('.ezoic-ad, .ezoic-ad-adaptive');
|
|
147
|
-
nodes.forEach((n) => {
|
|
148
|
-
const st = (n.getAttribute('style') || '').toLowerCase();
|
|
149
|
-
if (st.includes('min-height:400') || st.includes('min-height: 400') || st.includes('min-height:400px')) {
|
|
150
|
-
try { n.style.setProperty('min-height', '1px', 'important'); } catch (e) { n.style.minHeight = '1px'; }
|
|
151
|
-
try { n.style.setProperty('height', 'auto', 'important'); } catch (e) {}
|
|
152
|
-
try { n.style.setProperty('line-height', '0', 'important'); } catch (e) {}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
} catch (e) {}
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
136
|
+
if (!iframes || !iframes.length) return;
|
|
159
137
|
|
|
160
138
|
// Find the closest "big" ezoic container that carries the 400px min-height.
|
|
161
139
|
const firstIframe = iframes[0];
|
|
@@ -763,49 +741,38 @@ function globalGapFixInit() {
|
|
|
763
741
|
// For message/topic pages we may prune filled or empty orphans if they are far away,
|
|
764
742
|
// otherwise consecutive "stacks" can appear when posts are virtualized.
|
|
765
743
|
const isMessage = (kindClass === 'ezoic-ad-message');
|
|
766
|
-
//
|
|
767
|
-
// On category/topic lists, NodeBB can virtualize/recycle list items while scrolling.
|
|
768
|
-
// If we keep *filled* wraps when their anchor items are gone, they can visually
|
|
769
|
-
// "stack" together on upward scroll. We therefore allow filled wraps to be hidden
|
|
770
|
-
// when orphaned, but we still avoid fully releasing them (so they can come back
|
|
771
|
-
// when anchors reappear).
|
|
772
|
-
|
|
773
|
-
// If the wrap is anchored to current items, ensure it is visible.
|
|
774
|
-
if (hasNearbyItem(wrap)) {
|
|
775
|
-
try { wrap.classList && wrap.classList.remove('ez-orphan-hidden'); wrap.style && (wrap.style.display = ''); } catch (e) {}
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
744
|
+
if (!isMessage && isFilled(wrap)) return; // never prune filled ads for non-message lists
|
|
778
745
|
|
|
779
|
-
//
|
|
780
|
-
// back-to-back while scrolling. We'll restore it when its anchor comes back.
|
|
781
|
-
try { wrap.classList && wrap.classList.add('ez-orphan-hidden'); wrap.style && (wrap.style.display = 'none'); } catch (e) {}
|
|
782
|
-
|
|
783
|
-
// On topic/category lists, never release orphan wraps. Releasing moves placeholders around and makes
|
|
784
|
-
// ads appear to 'travel' from top to bottom as you scroll. Parking (hiding) keeps DOM order stable.
|
|
785
|
-
const isList = (kindClass === 'ezoic-ad-between' || kindClass === 'ezoic-ad-categories');
|
|
786
|
-
if (isList) return;
|
|
787
|
-
|
|
788
|
-
// Never release a fresh wrap: it may fill late (auction/CMP). Keep it hidden for a while.
|
|
746
|
+
// Never prune a fresh wrap: it may fill late.
|
|
789
747
|
try {
|
|
790
748
|
const created = parseInt(wrap.getAttribute('data-created') || '0', 10);
|
|
791
749
|
if (created && (now() - created) < keepEmptyWrapMs()) return;
|
|
792
750
|
} catch (e) {}
|
|
793
751
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
752
|
+
if (hasNearbyItem(wrap)) {
|
|
753
|
+
try { wrap.classList && wrap.classList.remove('ez-orphan-hidden'); wrap.style && (wrap.style.display = ''); } catch (e) {}
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// If the anchor item is no longer in the DOM (virtualized), hide the wrap so ads never "stack"
|
|
758
|
+
// back-to-back while scrolling. We'll recycle it when its anchor comes back.
|
|
759
|
+
try { wrap.classList && wrap.classList.add('ez-orphan-hidden'); wrap.style && (wrap.style.display = 'none'); } catch (e) {}
|
|
760
|
+
|
|
761
|
+
// For message ads: only release if far offscreen to avoid perceived "vanishing" during fast scroll.
|
|
762
|
+
if (isMessage) {
|
|
763
|
+
try {
|
|
764
|
+
const r = wrap.getBoundingClientRect();
|
|
765
|
+
const vh = Math.max(1, window.innerHeight || 1);
|
|
766
|
+
const farAbove = r.bottom < -vh * 2;
|
|
767
|
+
const farBelow = r.top > vh * 4;
|
|
768
|
+
if (!farAbove && !farBelow) return;
|
|
769
|
+
} catch (e) {
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
806
773
|
|
|
807
|
-
|
|
808
|
-
|
|
774
|
+
withInternalDomChange(() => releaseWrapNode(wrap));
|
|
775
|
+
removed++;
|
|
809
776
|
});
|
|
810
777
|
|
|
811
778
|
return removed;
|
|
@@ -851,12 +818,6 @@ function globalGapFixInit() {
|
|
|
851
818
|
const prevFilled = isFilled(prev);
|
|
852
819
|
const curFilled = isFilled(w);
|
|
853
820
|
|
|
854
|
-
// On topic/category lists, prevent visible stacking by hiding the later wrap immediately.
|
|
855
|
-
if ((kindClass === 'ezoic-ad-between' || kindClass === 'ezoic-ad-categories') && prevFilled && curFilled) {
|
|
856
|
-
try { w.classList && w.classList.add('ez-stack-hidden'); w.style && (w.style.display = 'none'); } catch (e) {}
|
|
857
|
-
break;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
821
|
if (curFilled) {
|
|
861
822
|
// If the previous one is empty (and not fresh), drop the previous instead.
|
|
862
823
|
if (!prevFilled && !isFresh(prev)) {
|
|
@@ -1058,8 +1019,6 @@ function globalGapFixInit() {
|
|
|
1058
1019
|
watchWrapForFill(ww);
|
|
1059
1020
|
setTimeout(() => { try { tightenEzoicMinHeight(ww); } catch (e) {} }, 900);
|
|
1060
1021
|
setTimeout(() => { try { tightenEzoicMinHeight(ww); } catch (e) {} }, 2200);
|
|
1061
|
-
// Collapse the notorious 400px inline min-height if the slot stays empty.
|
|
1062
|
-
setTimeout(() => { try { tightenEzoicMinHeight(ww); } catch (e) {} }, 12500);
|
|
1063
1022
|
}
|
|
1064
1023
|
} catch (e) {}
|
|
1065
1024
|
setTimeout(() => { clearTimeout(hardTimer); release(); }, 650);
|
|
@@ -1145,7 +1104,7 @@ function buildOrdinalMap(items) {
|
|
|
1145
1104
|
if (!id) {
|
|
1146
1105
|
// Safe mode: disable recycling for topic message ads to prevent visual "jumping"
|
|
1147
1106
|
// (ads seemingly moving back under the first post during virtualized scroll).
|
|
1148
|
-
const allowRecycle = kindClass !== 'ezoic-ad-message'
|
|
1107
|
+
const allowRecycle = kindClass !== 'ezoic-ad-message';
|
|
1149
1108
|
recycledWrap = (allowRecycle && scrollDir > 0) ? pickRecyclableWrap(kindClass) : null;
|
|
1150
1109
|
if (recycledWrap) {
|
|
1151
1110
|
id = recycledWrap.getAttribute('data-ezoic-wrapid') || '';
|