@bebranded/bb-contents 1.0.62-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 +27 -11
  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.62-beta
4
+ * @version 1.0.63-beta
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -34,7 +34,7 @@
34
34
 
35
35
  // Configuration
36
36
  const config = {
37
- version: '1.0.62-beta',
37
+ version: '1.0.63-beta',
38
38
  debug: false, // Debug désactivé
39
39
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
40
40
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
@@ -265,10 +265,23 @@
265
265
  if (scope.closest && scope.closest('[data-bb-disable]')) return;
266
266
  const elements = scope.querySelectorAll(bbContents._attrSelector('marquee'));
267
267
 
268
- 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
+
269
280
  // Vérifier si l'élément a déjà été traité par un autre module
270
281
  if (element.bbProcessed || element.hasAttribute('data-bb-youtube-processed')) {
271
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);
272
285
  return;
273
286
  }
274
287
  element.bbProcessed = true;
@@ -495,16 +508,19 @@
495
508
  });
496
509
  };
497
510
 
498
- // Démarrer l'initialisation avec délai adaptatif - Solution simple et efficace
511
+ // Démarrer l'initialisation avec délai adaptatif - Initialisation séquentielle
499
512
  const baseDelay = isVertical ? 800 : 400; // Délais fixes selon le type
500
- const randomDelay = Math.random() * 100; // 0-100ms aléatoire pour éviter les conflits
501
- const initDelay = baseDelay + randomDelay;
502
513
 
503
- bbContents.utils.log(`Marquee ${index + 1} (${isVertical ? 'vertical' : 'horizontal'}) initialisé dans ${initDelay}ms`);
504
- setTimeout(() => initAnimation(0), initDelay);
505
- });
506
-
507
- 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();
508
524
  }
509
525
  },
510
526
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.62-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": {