@bebranded/bb-contents 1.0.33-beta → 1.0.35-beta

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.
Files changed (2) hide show
  1. package/bb-contents.js +31 -8
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -17,8 +17,8 @@
17
17
 
18
18
  // Configuration
19
19
  const config = {
20
- version: '1.0.33-beta',
21
- debug: false, // Désactivé par défaut pour une console propre
20
+ version: '1.0.35-beta',
21
+ debug: true, // Activé temporairement pour debug
22
22
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
23
23
  i18n: {
24
24
  copied: 'Lien copié !'
@@ -33,6 +33,7 @@
33
33
  _reinitScheduled: false,
34
34
  _initRetryCount: 0,
35
35
  _maxInitRetries: 3,
36
+ _performanceBoostDetected: false,
36
37
 
37
38
  // Utilitaires
38
39
  utils: {
@@ -83,6 +84,20 @@
83
84
 
84
85
  this.utils.log('Initialisation v' + this.config.version);
85
86
 
87
+ // Debug: Analyser l'environnement
88
+ this.utils.log('=== DEBUG ENVIRONNEMENT ===');
89
+ this.utils.log('Body attributes:', Array.from(document.body.attributes).map(attr => attr.name + '=' + attr.value));
90
+ this.utils.log('Scripts chargés:', document.querySelectorAll('script').length);
91
+ this.utils.log('Stylesheets chargés:', document.querySelectorAll('link[rel="stylesheet"]').length);
92
+ this.utils.log('Marquees détectés:', document.querySelectorAll('[bb-marquee]').length);
93
+ this.utils.log('Marquees déjà traités:', document.querySelectorAll('[bb-marquee][data-bb-marquee-processed]').length);
94
+
95
+ // Détection du bb-performance-boost
96
+ this._performanceBoostDetected = document.body.hasAttribute('bb-performance-boost');
97
+ if (this._performanceBoostDetected) {
98
+ this.utils.log('bb-performance-boost détecté - mode de compatibilité activé');
99
+ }
100
+
86
101
  // Déterminer la portée
87
102
  const scope = document.querySelector('[data-bb-scope]') || document;
88
103
 
@@ -133,9 +148,10 @@
133
148
  this._initRetryCount++;
134
149
  bbContents.utils.log('Tentative de réinitialisation', this._initRetryCount, '/', this._maxInitRetries);
135
150
 
151
+ const delay = this._performanceBoostDetected ? 1000 * this._initRetryCount : 500 * this._initRetryCount;
136
152
  setTimeout(() => {
137
153
  this.init();
138
- }, 500 * this._initRetryCount); // Délai progressif
154
+ }, delay); // Délai progressif adaptatif
139
155
  }
140
156
  },
141
157
 
@@ -173,10 +189,11 @@
173
189
 
174
190
  if (shouldReinit && !this._reinitScheduled) {
175
191
  this._reinitScheduled = true;
192
+ const delay = this._performanceBoostDetected ? 200 : 100;
176
193
  setTimeout(() => {
177
194
  this.init();
178
195
  this._reinitScheduled = false;
179
- }, 100);
196
+ }, delay);
180
197
  }
181
198
  });
182
199
 
@@ -580,7 +597,10 @@
580
597
  };
581
598
 
582
599
  // Démarrer l'initialisation avec délai adaptatif
583
- const initDelay = isVertical ? 300 : 100;
600
+ let initDelay = isVertical ? 300 : 100;
601
+ if (bbContents._performanceBoostDetected) {
602
+ initDelay = isVertical ? 600 : 300; // Délais plus longs avec bb-performance-boost
603
+ }
584
604
  setTimeout(() => initAnimation(0), initDelay);
585
605
  });
586
606
 
@@ -974,19 +994,22 @@
974
994
  if (document.readyState === 'loading') {
975
995
  document.addEventListener('DOMContentLoaded', function() {
976
996
  // Délai pour éviter le blocage du rendu
997
+ const delay = document.body.hasAttribute('bb-performance-boost') ? 300 : 100;
977
998
  setTimeout(function() {
978
999
  bbContents.init();
979
- }, 100);
1000
+ }, delay);
980
1001
  });
981
1002
  } else {
982
1003
  // Délai pour éviter le blocage du rendu
1004
+ const delay = document.body.hasAttribute('bb-performance-boost') ? 300 : 100;
983
1005
  setTimeout(function() {
984
1006
  bbContents.init();
985
- }, 100);
1007
+ }, delay);
986
1008
  }
987
1009
 
988
1010
  // Initialisation différée supplémentaire pour les cas difficiles
989
1011
  window.addEventListener('load', function() {
1012
+ const loadDelay = document.body.hasAttribute('bb-performance-boost') ? 2000 : 1000;
990
1013
  setTimeout(function() {
991
1014
  // Vérifier s'il y a des éléments non initialisés
992
1015
  const unprocessedMarquees = document.querySelectorAll('[bb-marquee]:not([data-bb-marquee-processed])');
@@ -994,7 +1017,7 @@
994
1017
  bbContents.utils.log('Éléments marquee non initialisés détectés après load, réinitialisation...');
995
1018
  bbContents.reinit();
996
1019
  }
997
- }, 1000);
1020
+ }, loadDelay);
998
1021
  });
999
1022
  }
1000
1023
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.33-beta",
3
+ "version": "1.0.35-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {