@bebranded/bb-contents 1.1.4 → 1.1.6

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 +12 -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.1.4
4
+ * @version 1.1.6
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -10,7 +10,7 @@
10
10
  'use strict';
11
11
 
12
12
  // Version du script
13
- const BB_CONTENTS_VERSION = '1.1.4';
13
+ const BB_CONTENTS_VERSION = '1.1.6';
14
14
 
15
15
  // Créer l'objet temporaire pour la configuration si il n'existe pas
16
16
  if (!window._bbContentsConfig) {
@@ -314,6 +314,7 @@
314
314
  const orientation = bbContents._getAttr(element, 'bb-marquee-orientation') || 'horizontal';
315
315
  const height = bbContents._getAttr(element, 'bb-marquee-height') || '300';
316
316
  const minHeight = bbContents._getAttr(element, 'bb-marquee-min-height');
317
+ const isMobileMarquee = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
317
318
 
318
319
  // Sauvegarder le contenu original
319
320
  const originalHTML = element.innerHTML;
@@ -438,13 +439,13 @@
438
439
  }
439
440
  });
440
441
 
441
- // Timeout de sécurité (max 5 secondes)
442
+ // Timeout de sécurité (réduit sur mobile pour init plus rapide)
442
443
  setTimeout(function() {
443
444
  if (loadedCount + errorCount < totalImages) {
444
445
  errorCount = totalImages - loadedCount;
445
446
  checkComplete();
446
447
  }
447
- }, 5000);
448
+ }, isMobileMarquee ? 2500 : 5000);
448
449
  });
449
450
  };
450
451
 
@@ -580,13 +581,13 @@
580
581
  }
581
582
  });
582
583
 
583
- // Timeout
584
+ // Timeout (réduit sur mobile)
584
585
  setTimeout(function() {
585
586
  if (renderedCount < totalImages) {
586
587
  renderedCount = totalImages;
587
588
  checkRendered();
588
589
  }
589
- }, 2000);
590
+ }, isMobileMarquee ? 1000 : 2000);
590
591
  });
591
592
  };
592
593
 
@@ -897,8 +898,8 @@
897
898
  };
898
899
  });
899
900
 
900
- // Timeout plus long sur mobile pour laisser le temps aux images de se charger
901
- const maxWaitTime = isMobile ? 5000 : 3000; // 5 secondes sur mobile
901
+ // Timeout sur mobile réduit pour init plus rapide (images déjà préchargées avant)
902
+ const maxWaitTime = isMobile ? 2500 : 3000;
902
903
  let waitTimeout = 0;
903
904
 
904
905
  const waitForImages = () => {
@@ -924,8 +925,8 @@
924
925
 
925
926
  if (imagesReady) {
926
927
  // Toutes les images sont chargées ET ont leurs dimensions
927
- // Attendre plus longtemps sur mobile Safari pour le rendu visuel
928
- const renderDelay = isSafari && isMobile ? 1500 : (isMobile ? 1000 : 200);
928
+ // Délai court pour laisser le layout se stabiliser (réduit pour init rapide)
929
+ const renderDelay = isSafari && isMobile ? 300 : (isMobile ? 500 : 200);
929
930
  setTimeout(() => {
930
931
  startSafariAnimation();
931
932
  }, renderDelay);
@@ -937,7 +938,7 @@
937
938
  // Timeout atteint : forcer le démarrage mais c'est un fallback
938
939
  if (bbContents.config.debug) {
939
940
  }
940
- const renderDelay = isSafari && isMobile ? 1500 : (isMobile ? 1000 : 200);
941
+ const renderDelay = isSafari && isMobile ? 300 : (isMobile ? 500 : 200);
941
942
  setTimeout(() => {
942
943
  startSafariAnimation();
943
944
  }, renderDelay);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {