nodebb-plugin-ezoic-infinite 1.6.83 → 1.6.84
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 +23 -5
- package/public/style.css +8 -10
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
let config = null;
|
|
11
11
|
let isInternalChange = false;
|
|
12
12
|
let ezEnabled = false;
|
|
13
|
+
let definedIds = new Set();
|
|
13
14
|
|
|
14
15
|
function getPool() {
|
|
15
16
|
let p = document.getElementById(POOL_ID);
|
|
@@ -25,23 +26,39 @@
|
|
|
25
26
|
function callEzoic(pid) {
|
|
26
27
|
if (typeof window.ezstandalone === 'undefined') return;
|
|
27
28
|
const id = parseInt(pid, 10);
|
|
29
|
+
if (isNaN(id)) return;
|
|
30
|
+
|
|
28
31
|
try {
|
|
32
|
+
// 1. On définit TOUJOURS l'ID avant toute autre action
|
|
29
33
|
window.ezstandalone.define(id);
|
|
34
|
+
definedIds.add(id);
|
|
35
|
+
|
|
36
|
+
// 2. Si c'est la toute première fois de la page
|
|
30
37
|
if (!ezEnabled) {
|
|
31
38
|
window.ezstandalone.enable();
|
|
32
39
|
window.ezstandalone.display();
|
|
33
40
|
ezEnabled = true;
|
|
41
|
+
console.log('[Ezoic-Infinite] Initialized with ID:', id);
|
|
34
42
|
} else {
|
|
35
|
-
//
|
|
36
|
-
|
|
43
|
+
// 3. Sinon, on utilise refresh avec un léger délai
|
|
44
|
+
// pour s'assurer que le navigateur a fini de dessiner le DIV
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
const el = document.getElementById('ezoic-pub-ad-placeholder-' + id);
|
|
47
|
+
if (el) {
|
|
48
|
+
window.ezstandalone.refresh();
|
|
49
|
+
console.log('[Ezoic-Infinite] Refresh called for:', id);
|
|
50
|
+
}
|
|
51
|
+
}, 300);
|
|
37
52
|
}
|
|
38
|
-
} catch (e) {
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.warn('[Ezoic-Infinite] JS Error:', e.message);
|
|
55
|
+
}
|
|
39
56
|
}
|
|
40
57
|
|
|
41
58
|
function redistribute() {
|
|
42
59
|
if (!config || config.excluded) return;
|
|
43
60
|
|
|
44
|
-
//
|
|
61
|
+
// Ciblage Harmony NodeBB 4
|
|
45
62
|
const topicItems = document.querySelectorAll('[component="category/topic"]');
|
|
46
63
|
const postItems = document.querySelectorAll('[component="post"]');
|
|
47
64
|
|
|
@@ -71,7 +88,9 @@
|
|
|
71
88
|
const available = pool.querySelector(`.${WRAP_CLASS}[data-kind="${kind}"]`);
|
|
72
89
|
if (available) {
|
|
73
90
|
isInternalChange = true;
|
|
91
|
+
// Insertion physique dans le DOM
|
|
74
92
|
item.parentNode.insertBefore(available, item.nextSibling);
|
|
93
|
+
// Activation Ezoic
|
|
75
94
|
callEzoic(available.getAttribute('data-placeholder-id'));
|
|
76
95
|
setTimeout(() => { isInternalChange = false; }, 100);
|
|
77
96
|
}
|
|
@@ -103,7 +122,6 @@
|
|
|
103
122
|
|
|
104
123
|
redistribute();
|
|
105
124
|
|
|
106
|
-
// On surveille les changements de page et l'infinite scroll
|
|
107
125
|
const observer = new MutationObserver(() => {
|
|
108
126
|
if (!isInternalChange) redistribute();
|
|
109
127
|
});
|
package/public/style.css
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
/* Style du container injecté */
|
|
2
1
|
.nodebb-ezoic-wrap {
|
|
3
2
|
display: block !important;
|
|
4
3
|
width: 100% !important;
|
|
5
4
|
margin: 30px 0 !important;
|
|
6
|
-
min-height:
|
|
5
|
+
min-height: 250px; /* Taille minimum pour forcer le chargement */
|
|
7
6
|
clear: both;
|
|
7
|
+
overflow: visible !important;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
.nodebb-ezoic-wrap .ezoic-ad {
|
|
11
|
+
min-width: 1px;
|
|
12
|
+
min-height: 1px;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
/*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
border-top: 1px solid rgba(0,0,0,0.05);
|
|
19
|
-
padding: 15px 0;
|
|
15
|
+
/* Évite que les pubs se collent */
|
|
16
|
+
.nodebb-ezoic-wrap + .nodebb-ezoic-wrap {
|
|
17
|
+
display: none !important;
|
|
20
18
|
}
|