nodebb-plugin-ezoic-infinite 1.6.42 → 1.6.43
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 +0 -83
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -1646,85 +1646,6 @@ function buildOrdinalMap(items) {
|
|
|
1646
1646
|
});
|
|
1647
1647
|
}
|
|
1648
1648
|
|
|
1649
|
-
// --- Empty ad "poke" helper ---
|
|
1650
|
-
// Some GPT safeframe creatives may remain visually blank until a small scroll/reflow happens.
|
|
1651
|
-
// We avoid calling showAds()/refresh() (which can hurt fill) and instead trigger a cheap reflow.
|
|
1652
|
-
var ezEmptySeen = Object.create(null);
|
|
1653
|
-
var ezEmptyPokeTimer = Object.create(null);
|
|
1654
|
-
|
|
1655
|
-
function inViewportLoose(el) {
|
|
1656
|
-
try {
|
|
1657
|
-
if (!el || !el.getBoundingClientRect) return false;
|
|
1658
|
-
var r = el.getBoundingClientRect();
|
|
1659
|
-
var vh = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
1660
|
-
// within 1.5 viewports from top/bottom
|
|
1661
|
-
return r.bottom > -vh * 0.5 && r.top < vh * 1.5;
|
|
1662
|
-
} catch (e) {
|
|
1663
|
-
return false;
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
function pokeReflowForDivId(divId) {
|
|
1668
|
-
try {
|
|
1669
|
-
var el = document.getElementById(divId);
|
|
1670
|
-
if (!el) return;
|
|
1671
|
-
if (!inViewportLoose(el)) return;
|
|
1672
|
-
|
|
1673
|
-
// Force a tiny reflow/paint on the closest wrapper
|
|
1674
|
-
var wrap = el.closest ? (el.closest('.ez-fixed-wrap') || el.parentElement) : el.parentElement;
|
|
1675
|
-
if (!wrap) wrap = el;
|
|
1676
|
-
|
|
1677
|
-
// Toggle visibility for one frame
|
|
1678
|
-
var prevVis = wrap.style.visibility;
|
|
1679
|
-
wrap.style.visibility = 'hidden';
|
|
1680
|
-
requestAnimationFrame(function(){
|
|
1681
|
-
wrap.style.visibility = prevVis || '';
|
|
1682
|
-
// Dispatch scroll/resize events without moving the page
|
|
1683
|
-
try { window.dispatchEvent(new Event('scroll')); } catch (e) {}
|
|
1684
|
-
try { window.dispatchEvent(new Event('resize')); } catch (e) {}
|
|
1685
|
-
});
|
|
1686
|
-
} catch (e) {}
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
function schedulePoke(divId) {
|
|
1690
|
-
try {
|
|
1691
|
-
if (!divId) return;
|
|
1692
|
-
var now = Date.now();
|
|
1693
|
-
// Cooldown per slot to avoid loops
|
|
1694
|
-
if (ezEmptySeen[divId] && now - ezEmptySeen[divId] < 15000) return;
|
|
1695
|
-
ezEmptySeen[divId] = now;
|
|
1696
|
-
|
|
1697
|
-
if (ezEmptyPokeTimer[divId]) return;
|
|
1698
|
-
ezEmptyPokeTimer[divId] = setTimeout(function(){
|
|
1699
|
-
ezEmptyPokeTimer[divId] = null;
|
|
1700
|
-
pokeReflowForDivId(divId);
|
|
1701
|
-
}, 350);
|
|
1702
|
-
} catch (e) {}
|
|
1703
|
-
}
|
|
1704
|
-
|
|
1705
|
-
function initGptEmptyPoke() {
|
|
1706
|
-
try {
|
|
1707
|
-
if (!window.googletag || !googletag.cmd || !googletag.pubads) return;
|
|
1708
|
-
googletag.cmd.push(function(){
|
|
1709
|
-
try {
|
|
1710
|
-
var pub = googletag.pubads();
|
|
1711
|
-
if (!pub || !pub.addEventListener) return;
|
|
1712
|
-
pub.addEventListener('slotRenderEnded', function(e){
|
|
1713
|
-
try {
|
|
1714
|
-
if (!e) return;
|
|
1715
|
-
// divId is the GPT container id for the slot (e.g. div-gpt-ad-...)
|
|
1716
|
-
var divId = e.slot && e.slot.getSlotElementId ? e.slot.getSlotElementId() : (e.slotElementId || '');
|
|
1717
|
-
if (e.isEmpty) {
|
|
1718
|
-
if (divId) console.log('[EZ EMPTY]', divId);
|
|
1719
|
-
schedulePoke(divId);
|
|
1720
|
-
}
|
|
1721
|
-
} catch (err) {}
|
|
1722
|
-
});
|
|
1723
|
-
} catch (err2) {}
|
|
1724
|
-
});
|
|
1725
|
-
} catch (e) {}
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
1649
|
function init() {
|
|
1729
1650
|
schedule('init');
|
|
1730
1651
|
|
|
@@ -1764,10 +1685,6 @@ function buildOrdinalMap(items) {
|
|
|
1764
1685
|
});
|
|
1765
1686
|
} catch (e) {}
|
|
1766
1687
|
}
|
|
1767
|
-
|
|
1768
|
-
// Listen for GPT empty renders and apply a cheap reflow "poke".
|
|
1769
|
-
// This is intentionally non-invasive (no showAds/refresh) to preserve fill.
|
|
1770
|
-
initGptEmptyPoke();
|
|
1771
1688
|
}
|
|
1772
1689
|
|
|
1773
1690
|
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
|