@bebranded/bb-contents 1.0.50-beta → 1.0.52-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 +17 -10
  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.50-beta
4
+ * @version 1.0.52-beta
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -19,10 +19,16 @@
19
19
  console.warn('BeBranded Contents est déjà chargé');
20
20
  return;
21
21
  }
22
+
23
+ // Vérifier si la version a déjà été affichée
24
+ if (window._bbContentsVersionDisplayed) {
25
+ return;
26
+ }
27
+ window._bbContentsVersionDisplayed = true;
22
28
 
23
29
  // Configuration
24
30
  const config = {
25
- version: '1.0.50-beta',
31
+ version: '1.0.52-beta',
26
32
  debug: false, // Debug désactivé
27
33
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
28
34
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
@@ -425,7 +431,7 @@
425
431
  // Si pas de contenu valide ou images pas chargées, réessayer (sauf si on force)
426
432
  if ((!hasValidDimensions || !imagesLoaded) && !shouldForceInit && !shouldForceInitImages) {
427
433
  if (retryCount < maxRetries) {
428
- const delay = 300 + retryCount * 200; // Délais plus longs pour attendre les images
434
+ const delay = 50 + retryCount * 50; // Délais rapides pour header
429
435
  console.log(`[bb-contents] Marquee ${index + 1}: RETRY dans ${delay}ms (dimensions: ${hasValidDimensions}, images: ${imagesLoaded})`);
430
436
  // Contenu/images non prêts, nouvelle tentative
431
437
  setTimeout(() => initAnimation(retryCount + 1), delay);
@@ -451,23 +457,24 @@
451
457
  console.log(`[bb-contents] Marquee ${index + 1}: INITIALISATION DE L'ANIMATION`);
452
458
 
453
459
  if (isVertical) {
454
- // Animation JavaScript pour le vertical
460
+ // Animation JavaScript pour le vertical - défilement infini smooth
455
461
  const contentSize = finalHeight;
456
- const totalSize = contentSize * 4 + parseInt(gap) * 3; // 4 copies au lieu de 3
462
+ const gapSize = parseInt(gap);
463
+ const totalSize = contentSize + gapSize; // Taille d'un cycle complet
457
464
 
458
465
  // Ajuster la hauteur du scrollContainer seulement si pas en mode auto
459
466
  if (!useAutoHeight) {
460
467
  scrollContainer.style.height = totalSize + 'px';
461
468
  }
462
469
 
463
- let currentPosition = direction === 'bottom' ? -contentSize - parseInt(gap) : 0;
470
+ let currentPosition = direction === 'bottom' ? -totalSize : 0;
464
471
  const baseStep = (parseFloat(speed) * 2) / 60; // Vitesse de base
465
472
  let currentStep = baseStep;
466
473
  let isPaused = false;
467
474
  let animationId = null;
468
475
  let lastTime = 0;
469
476
 
470
- // Fonction d'animation JavaScript optimisée
477
+ // Fonction d'animation JavaScript optimisée pour défilement infini
471
478
  const animate = (currentTime) => {
472
479
  if (!lastTime) lastTime = currentTime;
473
480
  const deltaTime = currentTime - lastTime;
@@ -476,12 +483,12 @@
476
483
  if (direction === 'bottom') {
477
484
  currentPosition += currentStep * (deltaTime / 16.67); // Normaliser à 60fps
478
485
  if (currentPosition >= 0) {
479
- currentPosition = -contentSize - parseInt(gap);
486
+ currentPosition = -totalSize; // Reset smooth
480
487
  }
481
488
  } else {
482
489
  currentPosition -= currentStep * (deltaTime / 16.67);
483
- if (currentPosition <= -contentSize - parseInt(gap)) {
484
- currentPosition = 0;
490
+ if (currentPosition <= -totalSize) {
491
+ currentPosition = 0; // Reset smooth
485
492
  }
486
493
  }
487
494
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.50-beta",
3
+ "version": "1.0.52-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {