@bebranded/bb-contents 1.0.116 → 1.0.117
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 +37 -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.117
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
window._bbContentsInitialized = true;
|
|
33
33
|
|
|
34
34
|
// Log de démarrage simple (une seule fois)
|
|
35
|
-
console.log('bb-contents | v1.0.
|
|
35
|
+
console.log('bb-contents | v1.0.117');
|
|
36
36
|
|
|
37
37
|
// Configuration
|
|
38
38
|
const config = {
|
|
39
|
-
version: '1.0.
|
|
39
|
+
version: '1.0.117',
|
|
40
40
|
debug: false, // Debug désactivé pour rendu propre
|
|
41
41
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
42
42
|
youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
|
|
@@ -413,9 +413,9 @@
|
|
|
413
413
|
const originalHeight = img.style.height;
|
|
414
414
|
|
|
415
415
|
img.onload = () => {
|
|
416
|
-
// SOLUTION
|
|
417
|
-
if (isSVG &&
|
|
418
|
-
// SUR SAFARI
|
|
416
|
+
// SOLUTION SAFARI : Pour les SVG sur Safari (desktop et mobile), utiliser contain avec optimisations
|
|
417
|
+
if (isSVG && isSafari) {
|
|
418
|
+
// SUR SAFARI : Utiliser contain MAIS avec des optimisations pour éviter le flou
|
|
419
419
|
img.style.objectFit = 'contain';
|
|
420
420
|
img.style.objectPosition = 'center';
|
|
421
421
|
|
|
@@ -467,8 +467,38 @@
|
|
|
467
467
|
parent.style.overflow = 'hidden';
|
|
468
468
|
parent.style.boxSizing = 'border-box';
|
|
469
469
|
}
|
|
470
|
+
} else if (isSafari) {
|
|
471
|
+
// SUR SAFARI : Optimisations GPU et dimensions pour toutes les images
|
|
472
|
+
// Restaurer les styles CSS après chargement pour les non-SVG
|
|
473
|
+
if (originalObjectFit && originalObjectFit !== 'none') {
|
|
474
|
+
img.style.objectFit = originalObjectFit;
|
|
475
|
+
}
|
|
476
|
+
if (originalObjectPosition && originalObjectPosition !== 'initial') {
|
|
477
|
+
img.style.objectPosition = originalObjectPosition;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Préserver les dimensions naturelles des images
|
|
481
|
+
if (!originalWidth || originalWidth === '') {
|
|
482
|
+
img.style.width = 'auto';
|
|
483
|
+
}
|
|
484
|
+
if (!originalHeight || originalHeight === '') {
|
|
485
|
+
img.style.height = 'auto';
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Optimisations GPU pour Safari (desktop et mobile)
|
|
489
|
+
img.style.webkitBackfaceVisibility = 'hidden';
|
|
490
|
+
img.style.backfaceVisibility = 'hidden';
|
|
491
|
+
img.style.webkitTransform = 'translateZ(0)';
|
|
492
|
+
img.style.transform = 'translateZ(0)';
|
|
493
|
+
|
|
494
|
+
// Conteneur parent pour contraindre
|
|
495
|
+
const parent = img.parentElement;
|
|
496
|
+
if (parent) {
|
|
497
|
+
parent.style.overflow = 'hidden';
|
|
498
|
+
parent.style.boxSizing = 'border-box';
|
|
499
|
+
}
|
|
470
500
|
} else {
|
|
471
|
-
// OPTIMISATION: Restaurer les styles CSS après chargement pour les non-SVG
|
|
501
|
+
// OPTIMISATION: Restaurer les styles CSS après chargement pour les non-SVG (autres navigateurs)
|
|
472
502
|
if (originalObjectFit && originalObjectFit !== 'none') {
|
|
473
503
|
img.style.objectFit = originalObjectFit;
|
|
474
504
|
}
|