@bebranded/bb-contents 1.0.61-beta → 1.0.63-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 +34 -12
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * BeBranded Contents
3
3
  * Contenus additionnels français pour Webflow
4
- * @version 1.0.61-beta
4
+ * @version 1.0.63-beta
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -25,10 +25,16 @@
25
25
  return;
26
26
  }
27
27
  window._bbContentsVersionDisplayed = true;
28
+
29
+ // Protection supplémentaire contre la double initialisation
30
+ if (window._bbContentsInitialized) {
31
+ return;
32
+ }
33
+ window._bbContentsInitialized = true;
28
34
 
29
35
  // Configuration
30
36
  const config = {
31
- version: '1.0.61-beta',
37
+ version: '1.0.63-beta',
32
38
  debug: false, // Debug désactivé
33
39
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
34
40
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
@@ -259,10 +265,23 @@
259
265
  if (scope.closest && scope.closest('[data-bb-disable]')) return;
260
266
  const elements = scope.querySelectorAll(bbContents._attrSelector('marquee'));
261
267
 
262
- elements.forEach(function(element, index) {
268
+ // Initialisation séquentielle de haut en bas - Hero en priorité
269
+ let currentIndex = 0;
270
+
271
+ const initNextMarquee = () => {
272
+ if (currentIndex >= elements.length) {
273
+ bbContents.utils.log('Tous les marquees initialisés:', elements.length, 'éléments');
274
+ return;
275
+ }
276
+
277
+ const element = elements[currentIndex];
278
+ currentIndex++;
279
+
263
280
  // Vérifier si l'élément a déjà été traité par un autre module
264
281
  if (element.bbProcessed || element.hasAttribute('data-bb-youtube-processed')) {
265
282
  bbContents.utils.log('Élément marquee déjà traité par un autre module, ignoré:', element);
283
+ // Passer au suivant immédiatement
284
+ setTimeout(initNextMarquee, 0);
266
285
  return;
267
286
  }
268
287
  element.bbProcessed = true;
@@ -489,16 +508,19 @@
489
508
  });
490
509
  };
491
510
 
492
- // Démarrer l'initialisation avec délai adaptatif - Gestion multiple marquees
493
- const baseDelay = isVertical ? 1000 : 500; // Délais de base selon le type
494
- const progressiveDelay = index * 200; // Délai progressif pour éviter les conflits
495
- const initDelay = baseDelay + progressiveDelay;
511
+ // Démarrer l'initialisation avec délai adaptatif - Initialisation séquentielle
512
+ const baseDelay = isVertical ? 800 : 400; // Délais fixes selon le type
496
513
 
497
- bbContents.utils.log(`Marquee ${index + 1} (${isVertical ? 'vertical' : 'horizontal'}) initialisé dans ${initDelay}ms`);
498
- setTimeout(() => initAnimation(0), initDelay);
499
- });
500
-
501
- bbContents.utils.log('Module Marquee initialisé:', elements.length, 'éléments');
514
+ bbContents.utils.log(`Marquee ${currentIndex} (${isVertical ? 'vertical' : 'horizontal'}) initialisé dans ${baseDelay}ms`);
515
+ setTimeout(() => {
516
+ initAnimation(0);
517
+ // Après initialisation, passer au marquee suivant
518
+ setTimeout(initNextMarquee, 100); // Petit délai entre les marquees
519
+ }, baseDelay);
520
+ };
521
+
522
+ // Démarrer l'initialisation séquentielle
523
+ initNextMarquee();
502
524
  }
503
525
  },
504
526
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.61-beta",
3
+ "version": "1.0.63-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {