nodebb-plugin-ezoic-infinite 1.9.2 → 1.9.4
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/library.js +19 -17
- package/package.json +1 -1
- package/public/client.js +35 -30
- package/public/templates/admin/plugins/ezoic-infinite.tpl +11 -11
package/library.js
CHANGED
|
@@ -83,27 +83,29 @@ async function getSettings() {
|
|
|
83
83
|
if (_settingsInflight) return _settingsInflight;
|
|
84
84
|
const gen = _settingsGen;
|
|
85
85
|
_settingsInflight = (async () => {
|
|
86
|
+
let data = null;
|
|
86
87
|
try {
|
|
87
88
|
const s = await meta.settings.get(SETTINGS_KEY);
|
|
89
|
+
data = {
|
|
90
|
+
enableBetweenAds: parseBool(s.enableBetweenAds, true),
|
|
91
|
+
showFirstTopicAd: parseBool(s.showFirstTopicAd, false),
|
|
92
|
+
placeholderIds: (s.placeholderIds || '').trim(),
|
|
93
|
+
intervalPosts: Math.max(1, parseInt(s.intervalPosts, 10) || 6),
|
|
94
|
+
enableCategoryAds: parseBool(s.enableCategoryAds, false),
|
|
95
|
+
showFirstCategoryAd: parseBool(s.showFirstCategoryAd, false),
|
|
96
|
+
categoryPlaceholderIds: (s.categoryPlaceholderIds || '').trim(),
|
|
97
|
+
intervalCategories: Math.max(1, parseInt(s.intervalCategories, 10) || 4),
|
|
98
|
+
enableMessageAds: parseBool(s.enableMessageAds, false),
|
|
99
|
+
showFirstMessageAd: parseBool(s.showFirstMessageAd, false),
|
|
100
|
+
messagePlaceholderIds: (s.messagePlaceholderIds || '').trim(),
|
|
101
|
+
messageIntervalPosts: Math.max(1, parseInt(s.messageIntervalPosts, 10) || 3),
|
|
102
|
+
excludedGroups: normalizeExcludedGroups(s.excludedGroups),
|
|
103
|
+
};
|
|
88
104
|
if (_settingsGen === gen) {
|
|
89
105
|
_settingsCacheAt = Date.now();
|
|
90
|
-
_settingsCache =
|
|
91
|
-
enableBetweenAds: parseBool(s.enableBetweenAds, true),
|
|
92
|
-
showFirstTopicAd: parseBool(s.showFirstTopicAd, false),
|
|
93
|
-
placeholderIds: (s.placeholderIds || '').trim(),
|
|
94
|
-
intervalPosts: Math.max(1, parseInt(s.intervalPosts, 10) || 6),
|
|
95
|
-
enableCategoryAds: parseBool(s.enableCategoryAds, false),
|
|
96
|
-
showFirstCategoryAd: parseBool(s.showFirstCategoryAd, false),
|
|
97
|
-
categoryPlaceholderIds: (s.categoryPlaceholderIds || '').trim(),
|
|
98
|
-
intervalCategories: Math.max(1, parseInt(s.intervalCategories, 10) || 4),
|
|
99
|
-
enableMessageAds: parseBool(s.enableMessageAds, false),
|
|
100
|
-
showFirstMessageAd: parseBool(s.showFirstMessageAd, false),
|
|
101
|
-
messagePlaceholderIds: (s.messagePlaceholderIds || '').trim(),
|
|
102
|
-
messageIntervalPosts: Math.max(1, parseInt(s.messageIntervalPosts, 10) || 3),
|
|
103
|
-
excludedGroups: normalizeExcludedGroups(s.excludedGroups),
|
|
104
|
-
};
|
|
106
|
+
_settingsCache = data;
|
|
105
107
|
}
|
|
106
|
-
return _settingsCache;
|
|
108
|
+
return _settingsCache || data;
|
|
107
109
|
} finally {
|
|
108
110
|
if (_settingsGen === gen) _settingsInflight = null;
|
|
109
111
|
}
|
|
@@ -189,7 +191,7 @@ const EZOIC_SCRIPTS = [
|
|
|
189
191
|
'<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>',
|
|
190
192
|
'<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
|
|
191
193
|
'<script data-cfasync="false" src="//www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
192
|
-
'<script src="//ezoicanalytics.com/analytics.js"></script>',
|
|
194
|
+
'<script async src="//ezoicanalytics.com/analytics.js"></script>',
|
|
193
195
|
].join('\n');
|
|
194
196
|
|
|
195
197
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* NodeBB Ezoic Infinite Ads — client.js v2.
|
|
2
|
+
* NodeBB Ezoic Infinite Ads — client.js v2.6.0
|
|
3
3
|
*
|
|
4
4
|
* Architecture: proven v50 core + targeted improvements.
|
|
5
5
|
* Ezoic API: showAds() + destroyPlaceholders() per official docs.
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
BURST_COOLDOWN_MS: 200,
|
|
33
33
|
BLOCK_DURATION_MS: 1_000,
|
|
34
34
|
SHOW_TIMEOUT_MS: 4_500,
|
|
35
|
-
SHOW_RELEASE_MS:
|
|
36
|
-
RECYCLE_DELAY_MS:
|
|
35
|
+
SHOW_RELEASE_MS: 150,
|
|
36
|
+
RECYCLE_DELAY_MS: 50,
|
|
37
37
|
UNCOLLAPSE_CHECK_MS: [500, 5_000],
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const MAX_INSERTS_RUN = 6;
|
|
41
|
-
const MAX_INFLIGHT =
|
|
41
|
+
const MAX_INFLIGHT = 6;
|
|
42
42
|
const MAX_BURST_STEPS = 8;
|
|
43
43
|
const BURST_WINDOW_MS = 2_000;
|
|
44
44
|
|
|
@@ -562,28 +562,26 @@
|
|
|
562
562
|
};
|
|
563
563
|
const timer = setTimeout(release, TIMING.SHOW_TIMEOUT_MS);
|
|
564
564
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
try { wrap?.setAttribute(ATTR.SHOWN, String(t)); } catch (_) {}
|
|
565
|
+
try {
|
|
566
|
+
if (isBlocked()) { clearTimeout(timer); return release(); }
|
|
567
|
+
const ph = document.getElementById(`${PH_PREFIX}${id}`);
|
|
568
|
+
if (!ph?.isConnected || isFilled(ph)) { clearTimeout(timer); return release(); }
|
|
569
|
+
const t = now();
|
|
570
|
+
if (t - (S.lastShow.get(id) ?? 0) < TIMING.SHOW_THROTTLE_MS) { clearTimeout(timer); return release(); }
|
|
571
|
+
S.lastShow.set(id, t);
|
|
572
|
+
const wrap = ph.closest(`.${WRAP_CLASS}`);
|
|
573
|
+
try { wrap?.setAttribute(ATTR.SHOWN, String(t)); } catch (_) {}
|
|
575
574
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
});
|
|
575
|
+
window.ezstandalone = window.ezstandalone || {};
|
|
576
|
+
const ez = window.ezstandalone;
|
|
577
|
+
const doShow = () => {
|
|
578
|
+
try { ez.showAds(id); } catch (_) {}
|
|
579
|
+
if (wrap) scheduleUncollapseChecks(wrap, id);
|
|
580
|
+
scheduleEmptyCheck(id, t);
|
|
581
|
+
setTimeout(() => { clearTimeout(timer); release(); }, TIMING.SHOW_RELEASE_MS);
|
|
582
|
+
};
|
|
583
|
+
typeof ez.cmd?.push === 'function' ? ez.cmd.push(doShow) : doShow();
|
|
584
|
+
} catch (_) { clearTimeout(timer); release(); }
|
|
587
585
|
}
|
|
588
586
|
|
|
589
587
|
function scheduleEmptyCheck(id, showTs) {
|
|
@@ -854,7 +852,7 @@
|
|
|
854
852
|
ensureTcfLocator(); protectAriaHidden();
|
|
855
853
|
patchShowAds(); getIO(); ensureDomObserver();
|
|
856
854
|
RETRY.count = 0; RETRY.scriptReloaded = false; RETRY.postReloadShown = false; RETRY.gen++;
|
|
857
|
-
setTimeout(() => retryBoot(RETRY.gen),
|
|
855
|
+
setTimeout(() => retryBoot(RETRY.gen), 100);
|
|
858
856
|
requestBurst();
|
|
859
857
|
});
|
|
860
858
|
// action:ajaxify.contentLoaded et action:category.loaded ne passent pas par hooks → jQuery uniquement
|
|
@@ -898,6 +896,13 @@
|
|
|
898
896
|
// ── Boot ───────────────────────────────────────────────────────────────────
|
|
899
897
|
|
|
900
898
|
S.pageKey = pageKey();
|
|
899
|
+
(function () {
|
|
900
|
+
const _bootCfg = window.__nbbEzoicCfg;
|
|
901
|
+
if (_bootCfg && typeof _bootCfg === 'object' && !_bootCfg.excluded) {
|
|
902
|
+
S.cfg = _bootCfg;
|
|
903
|
+
initPools(_bootCfg);
|
|
904
|
+
}
|
|
905
|
+
}());
|
|
901
906
|
ensureTcfLocator();
|
|
902
907
|
protectAriaHidden();
|
|
903
908
|
patchShowAds();
|
|
@@ -907,10 +912,10 @@
|
|
|
907
912
|
bindScroll();
|
|
908
913
|
bindResize();
|
|
909
914
|
S.blockedUntil = 0;
|
|
910
|
-
if (document.readyState === '
|
|
911
|
-
requestBurst
|
|
915
|
+
if (document.readyState === 'loading') {
|
|
916
|
+
document.addEventListener('DOMContentLoaded', requestBurst, { once: true });
|
|
912
917
|
} else {
|
|
913
|
-
|
|
918
|
+
requestBurst();
|
|
914
919
|
}
|
|
915
920
|
|
|
916
921
|
// Retry boot: sa.min.js async + Cloudflare Rocket Loader + NodeBB SPA
|
|
@@ -982,6 +987,6 @@
|
|
|
982
987
|
}
|
|
983
988
|
setTimeout(() => retryBoot(gen), RETRY.count <= 4 ? 300 : 1000);
|
|
984
989
|
}
|
|
985
|
-
setTimeout(() => retryBoot(RETRY.gen),
|
|
990
|
+
setTimeout(() => retryBoot(RETRY.gen), 100);
|
|
986
991
|
|
|
987
992
|
})();
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
<div class="form-check mb-3">
|
|
8
8
|
<input class="form-check-input" type="checkbox" id="enableBetweenAds" name="enableBetweenAds" {enableBetweenAds_checked}>
|
|
9
9
|
<label class="form-check-label" for="enableBetweenAds">Activer les pubs entre les posts</label>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
<div class="form-check mt-2">
|
|
11
|
+
<input class="form-check-input" type="checkbox" name="showFirstTopicAd" {showFirstTopicAd_checked} />
|
|
12
|
+
<label class="form-check-label">Afficher une pub après le 1er sujet</label>
|
|
13
|
+
</div>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<div class="mb-3">
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
<h4 class="mt-3">Pubs “message” entre les réponses</h4>
|
|
53
53
|
<p class="form-text">Insère un bloc qui ressemble à un post, toutes les N réponses (dans une page topic).</p>
|
|
54
54
|
|
|
55
|
-
<div class
|
|
56
|
-
<input class
|
|
57
|
-
<label class
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
<div class=”form-check mb-3”>
|
|
56
|
+
<input class=”form-check-input” type=”checkbox” id=”enableMessageAds” name=”enableMessageAds” {enableMessageAds_checked}>
|
|
57
|
+
<label class=”form-check-label” for=”enableMessageAds”>Activer les pubs “message”</label>
|
|
58
|
+
<div class=”form-check mt-2”>
|
|
59
|
+
<input class=”form-check-input” type=”checkbox” name=”showFirstMessageAd” {showFirstMessageAd_checked} />
|
|
60
|
+
<label class=”form-check-label”>Afficher une pub après le 1er message</label>
|
|
61
|
+
</div>
|
|
62
62
|
</div>
|
|
63
63
|
|
|
64
64
|
<div class="mb-3">
|