nodebb-plugin-ezoic-infinite 1.6.38 → 1.6.39
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 -4
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -501,20 +501,43 @@ function globalGapFixInit() {
|
|
|
501
501
|
// Best-effort refresh for Ezoic standalone when we defer placement.
|
|
502
502
|
// Some stacks won't fill ads if a placeholder is rendered while collapsed/0px.
|
|
503
503
|
let _refreshTimer = null;
|
|
504
|
+
|
|
505
|
+
function collectEzoicIds(root) {
|
|
506
|
+
const ids = new Set();
|
|
507
|
+
if (!root || !root.querySelectorAll) return [];
|
|
508
|
+
// Common Ezoic placeholder ids
|
|
509
|
+
root.querySelectorAll('[id^="ezoic-pub-ad-placeholder-"]').forEach(el => ids.add(el.id));
|
|
510
|
+
// Some integrations keep ids on wrappers
|
|
511
|
+
root.querySelectorAll('[data-ezoic-id]').forEach(el => {
|
|
512
|
+
if (el.id) ids.add(el.id);
|
|
513
|
+
});
|
|
514
|
+
return Array.from(ids);
|
|
515
|
+
}
|
|
516
|
+
|
|
504
517
|
function refreshAds(ids) {
|
|
505
|
-
if (!ids || !ids.length) return;
|
|
506
518
|
clearTimeout(_refreshTimer);
|
|
507
519
|
_refreshTimer = setTimeout(() => {
|
|
508
520
|
try {
|
|
509
521
|
if (window.ezstandalone && typeof window.ezstandalone.showAds === 'function') {
|
|
510
|
-
|
|
522
|
+
// Prefer a full rescan; fall back to ids if supported.
|
|
523
|
+
try {
|
|
524
|
+
window.ezstandalone.showAds();
|
|
525
|
+
} catch (e) {
|
|
526
|
+
if (ids && ids.length) window.ezstandalone.showAds(ids);
|
|
527
|
+
}
|
|
528
|
+
if (window.__EZ_DEBUG) console.debug('[ezoic-infinite] refreshAds (ezstandalone)', { ids });
|
|
511
529
|
return;
|
|
512
530
|
}
|
|
513
531
|
if (window.ez && typeof window.ez.showAds === 'function') {
|
|
514
|
-
|
|
532
|
+
try {
|
|
533
|
+
window.ez.showAds();
|
|
534
|
+
} catch (e) {
|
|
535
|
+
if (ids && ids.length) window.ez.showAds(ids);
|
|
536
|
+
}
|
|
537
|
+
if (window.__EZ_DEBUG) console.debug('[ezoic-infinite] refreshAds (ez)', { ids });
|
|
515
538
|
}
|
|
516
539
|
} catch (e) {}
|
|
517
|
-
},
|
|
540
|
+
}, 75);
|
|
518
541
|
}
|
|
519
542
|
|
|
520
543
|
function primePlaceholderPool(allIds) {
|