@bebranded/bb-contents 1.0.77-beta → 1.0.78-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.
- package/bb-contents.js +28 -7
- 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.
|
|
4
|
+
* @version 1.0.78-beta
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
// Configuration
|
|
43
43
|
const config = {
|
|
44
|
-
version: '1.0.
|
|
44
|
+
version: '1.0.78-beta',
|
|
45
45
|
debug: true, // Debug activé pour diagnostic
|
|
46
46
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
47
47
|
youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
|
|
@@ -410,10 +410,18 @@
|
|
|
410
410
|
};
|
|
411
411
|
});
|
|
412
412
|
|
|
413
|
-
// Attendre que les images se chargent
|
|
413
|
+
// Attendre que les images se chargent avec timeout adapté mobile
|
|
414
|
+
let waitTimeout = 0;
|
|
415
|
+
const maxWaitTime = 3000; // 3 secondes max sur mobile
|
|
416
|
+
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
417
|
+
|
|
418
|
+
console.log(`🔍 [MARQUEE] Safari - Mobile détecté: ${isMobile}`);
|
|
419
|
+
|
|
414
420
|
const waitForImages = () => {
|
|
415
|
-
|
|
416
|
-
|
|
421
|
+
waitTimeout += 100;
|
|
422
|
+
|
|
423
|
+
if (imagesLoaded >= totalImages || imagesLoaded === 0 || waitTimeout >= maxWaitTime) {
|
|
424
|
+
console.log(`✅ [MARQUEE] Safari - Images chargées: ${imagesLoaded}/${totalImages} (timeout: ${waitTimeout}ms)`);
|
|
417
425
|
startSafariAnimation();
|
|
418
426
|
} else {
|
|
419
427
|
setTimeout(waitForImages, 100);
|
|
@@ -421,20 +429,33 @@
|
|
|
421
429
|
};
|
|
422
430
|
|
|
423
431
|
const startSafariAnimation = () => {
|
|
432
|
+
// Forcer le chargement des images restantes si timeout
|
|
433
|
+
if (waitTimeout >= maxWaitTime && imagesLoaded < totalImages) {
|
|
434
|
+
console.log(`⚠️ [MARQUEE] Safari - Timeout atteint, forcer chargement images restantes`);
|
|
435
|
+
images.forEach(img => {
|
|
436
|
+
if (img.dataset.src && !img.src) {
|
|
437
|
+
img.src = img.dataset.src;
|
|
438
|
+
img.loading = 'eager';
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
424
443
|
// Recalculer la taille après chargement des images
|
|
425
444
|
const newContentSize = isVertical ? mainBlock.offsetHeight : mainBlock.offsetWidth;
|
|
426
445
|
console.log(`🔍 [MARQUEE] Safari - Nouvelle taille après images: ${newContentSize}px`);
|
|
427
446
|
|
|
428
447
|
let finalContentSize = newContentSize > contentSize ? newContentSize : contentSize;
|
|
429
448
|
|
|
430
|
-
// Fallback si toujours trop petit
|
|
449
|
+
// Fallback si toujours trop petit (surtout sur mobile)
|
|
431
450
|
if (finalContentSize < 200) {
|
|
432
451
|
const parentElement = element.parentElement;
|
|
433
452
|
if (parentElement) {
|
|
434
453
|
finalContentSize = isVertical ? parentElement.offsetHeight : parentElement.offsetWidth;
|
|
435
454
|
}
|
|
436
455
|
if (finalContentSize < 200) {
|
|
437
|
-
|
|
456
|
+
// Valeurs par défaut plus généreuses sur mobile
|
|
457
|
+
finalContentSize = isVertical ? (isMobile ? 600 : 400) : (isMobile ? 1000 : 800);
|
|
458
|
+
console.log(`🔍 [MARQUEE] Safari - Utilisation valeur par défaut mobile: ${finalContentSize}px`);
|
|
438
459
|
}
|
|
439
460
|
}
|
|
440
461
|
|