nodebb-plugin-ezoic-infinite 1.6.41 → 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 -162
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -1692,165 +1692,3 @@ function buildOrdinalMap(items) {
|
|
|
1692
1692
|
})();
|
|
1693
1693
|
// ===== /V17 =====
|
|
1694
1694
|
|
|
1695
|
-
// ===== V17.13: empty GPT "poke" (keeps V17 pile-fix intact) =====
|
|
1696
|
-
// Goal: some GPT containers render empty until a tiny scroll triggers a refresh.
|
|
1697
|
-
// This watcher detects visible empty GPT slots and triggers a lightweight refresh.
|
|
1698
|
-
(function () {
|
|
1699
|
-
var TAG = '[EZ EMPTY]';
|
|
1700
|
-
var seen = Object.create(null);
|
|
1701
|
-
|
|
1702
|
-
function dbg() {
|
|
1703
|
-
if (!window.__EZ_DEBUG) return;
|
|
1704
|
-
try { console.log.apply(console, arguments); } catch (e) {}
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
function throttle(fn, wait) {
|
|
1708
|
-
var t = 0;
|
|
1709
|
-
var timer = null;
|
|
1710
|
-
return function () {
|
|
1711
|
-
var now = Date.now();
|
|
1712
|
-
var args = arguments;
|
|
1713
|
-
if (now - t >= wait) {
|
|
1714
|
-
t = now;
|
|
1715
|
-
fn.apply(null, args);
|
|
1716
|
-
return;
|
|
1717
|
-
}
|
|
1718
|
-
if (timer) return;
|
|
1719
|
-
timer = setTimeout(function () {
|
|
1720
|
-
timer = null;
|
|
1721
|
-
t = Date.now();
|
|
1722
|
-
fn.apply(null, args);
|
|
1723
|
-
}, wait);
|
|
1724
|
-
};
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
function isVisible(el) {
|
|
1728
|
-
try {
|
|
1729
|
-
if (!el || el.nodeType !== 1) return false;
|
|
1730
|
-
var r = el.getBoundingClientRect();
|
|
1731
|
-
if (!r) return false;
|
|
1732
|
-
if (r.width <= 0 || r.height <= 0) return false;
|
|
1733
|
-
var vh = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
1734
|
-
var vw = window.innerWidth || document.documentElement.clientWidth || 0;
|
|
1735
|
-
if (vh <= 0 || vw <= 0) return false;
|
|
1736
|
-
return r.bottom > 0 && r.right > 0 && r.top < vh && r.left < vw;
|
|
1737
|
-
} catch (e) {}
|
|
1738
|
-
return false;
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
function slotHasFill(slot) {
|
|
1742
|
-
try {
|
|
1743
|
-
if (slot.querySelector && slot.querySelector('iframe')) return true;
|
|
1744
|
-
var cid = 'google_ads_iframe_';
|
|
1745
|
-
var any = slot.querySelector && slot.querySelector('[id^="' + cid + '"] iframe');
|
|
1746
|
-
return !!any;
|
|
1747
|
-
} catch (e) {}
|
|
1748
|
-
return false;
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
function pokeRefresh() {
|
|
1752
|
-
try {
|
|
1753
|
-
if (window.ezstandalone && typeof window.ezstandalone.showAds === 'function') {
|
|
1754
|
-
window.ezstandalone.showAds();
|
|
1755
|
-
dbg(TAG, 'showAds called');
|
|
1756
|
-
return true;
|
|
1757
|
-
}
|
|
1758
|
-
} catch (e) {}
|
|
1759
|
-
try { window.dispatchEvent(new Event('scroll')); } catch (e) {}
|
|
1760
|
-
try { window.dispatchEvent(new Event('resize')); } catch (e) {}
|
|
1761
|
-
return false;
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
function checkSlot(slot) {
|
|
1765
|
-
try {
|
|
1766
|
-
if (!slot || !slot.id) return;
|
|
1767
|
-
if (slot.id.indexOf('div-gpt-ad-') !== 0) return;
|
|
1768
|
-
if (slotHasFill(slot)) return;
|
|
1769
|
-
if (!isVisible(slot)) return;
|
|
1770
|
-
|
|
1771
|
-
var k = slot.id;
|
|
1772
|
-
var now = Date.now();
|
|
1773
|
-
if (seen[k] && (now - seen[k]) < 2000) return;
|
|
1774
|
-
seen[k] = now;
|
|
1775
|
-
|
|
1776
|
-
setTimeout(function () {
|
|
1777
|
-
try {
|
|
1778
|
-
if (!slotHasFill(slot) && isVisible(slot)) {
|
|
1779
|
-
console.log(TAG, k);
|
|
1780
|
-
pokeRefresh();
|
|
1781
|
-
}
|
|
1782
|
-
} catch (e) {}
|
|
1783
|
-
}, 120);
|
|
1784
|
-
} catch (e) {}
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
function scan() {
|
|
1788
|
-
try {
|
|
1789
|
-
var slots = document.querySelectorAll('[id^="div-gpt-ad-"]');
|
|
1790
|
-
if (!slots || !slots.length) {
|
|
1791
|
-
dbg(TAG, 'none');
|
|
1792
|
-
return;
|
|
1793
|
-
}
|
|
1794
|
-
for (var i = 0; i < slots.length; i++) checkSlot(slots[i]);
|
|
1795
|
-
} catch (e) {}
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
function observeNewSlots(io) {
|
|
1799
|
-
try {
|
|
1800
|
-
if (typeof MutationObserver === 'undefined') return;
|
|
1801
|
-
var mo = new MutationObserver(function (muts) {
|
|
1802
|
-
try {
|
|
1803
|
-
for (var i = 0; i < muts.length; i++) {
|
|
1804
|
-
var m = muts[i];
|
|
1805
|
-
if (!m.addedNodes) continue;
|
|
1806
|
-
for (var j = 0; j < m.addedNodes.length; j++) {
|
|
1807
|
-
var n = m.addedNodes[j];
|
|
1808
|
-
if (!n || n.nodeType !== 1) continue;
|
|
1809
|
-
if (n.id && n.id.indexOf('div-gpt-ad-') === 0) {
|
|
1810
|
-
try { io.observe(n); } catch (e) {}
|
|
1811
|
-
checkSlot(n);
|
|
1812
|
-
} else if (n.querySelectorAll) {
|
|
1813
|
-
var inner = n.querySelectorAll('[id^="div-gpt-ad-"]');
|
|
1814
|
-
for (var k = 0; k < inner.length; k++) {
|
|
1815
|
-
try { io.observe(inner[k]); } catch (e) {}
|
|
1816
|
-
checkSlot(inner[k]);
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
} catch (e) {}
|
|
1822
|
-
});
|
|
1823
|
-
mo.observe(document.documentElement || document.body, { childList: true, subtree: true });
|
|
1824
|
-
} catch (e) {}
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
function initEmptyWatcher() {
|
|
1828
|
-
scan();
|
|
1829
|
-
|
|
1830
|
-
if ('IntersectionObserver' in window) {
|
|
1831
|
-
try {
|
|
1832
|
-
var io = new IntersectionObserver(function (entries) {
|
|
1833
|
-
for (var i = 0; i < entries.length; i++) {
|
|
1834
|
-
var ent = entries[i];
|
|
1835
|
-
if (ent && ent.isIntersecting) checkSlot(ent.target);
|
|
1836
|
-
}
|
|
1837
|
-
}, { root: null, threshold: 0.12 });
|
|
1838
|
-
|
|
1839
|
-
var slots = document.querySelectorAll('[id^="div-gpt-ad-"]');
|
|
1840
|
-
for (var s = 0; s < slots.length; s++) {
|
|
1841
|
-
try { io.observe(slots[s]); } catch (e) {}
|
|
1842
|
-
}
|
|
1843
|
-
observeNewSlots(io);
|
|
1844
|
-
} catch (e) {}
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
try { window.addEventListener('scroll', throttle(scan, 250), { passive: true }); } catch (e) {}
|
|
1848
|
-
try { window.addEventListener('resize', throttle(scan, 500)); } catch (e) {}
|
|
1849
|
-
try { document.addEventListener('visibilitychange', function () { if (!document.hidden) setTimeout(scan, 150); }); } catch (e) {}
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initEmptyWatcher);
|
|
1853
|
-
else initEmptyWatcher();
|
|
1854
|
-
})();
|
|
1855
|
-
// ===== /V17.13 =====
|
|
1856
|
-
|