nodebb-plugin-ezoic-infinite 1.6.85 → 1.6.86

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.6.85",
3
+ "version": "1.6.86",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -9,6 +9,8 @@
9
9
 
10
10
  let config = null;
11
11
  let isInternalChange = false;
12
+ let ezIsLoaded = false;
13
+ let lastEnableTime = 0;
12
14
 
13
15
  function getPool() {
14
16
  let p = document.getElementById(POOL_ID);
@@ -26,18 +28,26 @@
26
28
  const id = parseInt(pid, 10);
27
29
  if (isNaN(id)) return;
28
30
 
29
- // On utilise la queue que tu as définie dans ton header
30
31
  window.ezstandalone.cmd.push(function() {
31
32
  window.ezstandalone.define(id);
32
33
 
33
- // On laisse Ezoic décider s'il doit faire enable() ou refresh()
34
+ // Si pas encore activé globalement
34
35
  if (!window.ezstandalone.enabled) {
35
36
  window.ezstandalone.enable();
36
37
  window.ezstandalone.display();
38
+ lastEnableTime = Date.now();
37
39
  } else {
38
- // On utilise refresh uniquement si l'ID est déjà affiché
39
- // ou si le cycle initial est terminé.
40
- window.ezstandalone.refresh();
40
+ // SECURITÉ : On attend au moins 2 secondes après un 'enable'
41
+ // avant d'autoriser un 'refresh' pour éviter l'erreur "same page"
42
+ const timeSinceEnable = Date.now() - lastEnableTime;
43
+ if (timeSinceEnable > 2000) {
44
+ window.ezstandalone.refresh();
45
+ } else {
46
+ // Si on est trop proche du enable, on retente dans 2.5s
47
+ setTimeout(function() {
48
+ window.ezstandalone.refresh();
49
+ }, 2500);
50
+ }
41
51
  }
42
52
  });
43
53
  }
@@ -45,16 +55,16 @@
45
55
  function redistribute() {
46
56
  if (!config || config.excluded) return;
47
57
 
48
- // Sélecteurs NodeBB 4.x Harmony
49
- // TopicItems = Lignes de sujets sur l'accueil
50
- // PostItems = Messages dans un sujet
58
+ // Harmony NodeBB 4 - Sélecteurs Accueil et Topics
51
59
  const topicItems = document.querySelectorAll('[component="category/topic"]');
52
60
  const postItems = document.querySelectorAll('[component="post"]');
53
61
 
62
+ // Page d'accueil / Catégories
54
63
  if (topicItems.length > 0 && config.enableBetweenAds) {
55
64
  processItems(Array.from(topicItems), 'between', config.intervalPosts, config.showFirstTopicAd);
56
65
  }
57
66
 
67
+ // Topics (Messages)
58
68
  if (postItems.length > 0 && config.enableMessageAds) {
59
69
  processItems(Array.from(postItems), 'message', config.messageIntervalPosts, config.showFirstMessageAd);
60
70
  }
@@ -111,9 +121,9 @@
111
121
  });
112
122
  }
113
123
 
114
- // Gestion de la navigation AJAX de NodeBB 4
124
+ // Correction Page d'accueil : Forcer redistribution quand on finit de charger une page
115
125
  window.addEventListener('action:ajaxify.end', function() {
116
- setTimeout(redistribute, 500);
126
+ setTimeout(redistribute, 800);
117
127
  });
118
128
 
119
129
  if (document.readyState === 'loading') {
package/public/style.css CHANGED
@@ -1,25 +1,31 @@
1
+ /* Container principal */
1
2
  .nodebb-ezoic-wrap {
2
3
  display: block !important;
3
4
  width: 100% !important;
4
- margin: 25px auto !important;
5
- min-height: 250px; /* Réserve l'espace pour éviter les sauts de page */
5
+ min-width: 100% !important;
6
+ margin: 20px 0 !important;
7
+ min-height: 250px;
6
8
  clear: both;
7
- text-align: center;
9
+ float: none !important;
8
10
  }
9
11
 
10
- /* Accueil : Ajout d'une séparation propre entre les lignes de sujets */
11
- [component="category/topic"] + .nodebb-ezoic-wrap {
12
- border-bottom: 1px solid rgba(0,0,0,0.05);
13
- margin-bottom: 15px !important;
12
+ /* Forcer l'affichage dans la liste des catégories/topics (Accueil) */
13
+ [component="category/topic"] {
14
+ margin-bottom: 0 !important;
14
15
  }
15
16
 
16
- /* Cache si vide (Ezoic ajoute des classes quand il ne remplit pas) */
17
+ .nodebb-ezoic-wrap[data-kind="between"] {
18
+ background: transparent;
19
+ border-top: 1px solid rgba(0,0,0,0.05);
20
+ padding: 20px 0;
21
+ }
22
+
23
+ /* Cache si vraiment aucun contenu injecté après 5s */
17
24
  .nodebb-ezoic-wrap:empty {
18
- display: none !important;
19
- min-height: 0;
25
+ min-height: 1px;
20
26
  }
21
27
 
22
- /* Anti-empilement */
28
+ /* Empêche les doublons */
23
29
  .nodebb-ezoic-wrap + .nodebb-ezoic-wrap {
24
30
  display: none !important;
25
31
  }