@bebranded/bb-contents 1.0.85 → 1.0.87
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 +27 -4
- 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.87
|
|
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.87');
|
|
36
36
|
|
|
37
37
|
// Configuration
|
|
38
38
|
const config = {
|
|
39
|
-
version: '1.0.
|
|
39
|
+
version: '1.0.87',
|
|
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)
|
|
@@ -385,13 +385,36 @@
|
|
|
385
385
|
const totalImages = images.length;
|
|
386
386
|
|
|
387
387
|
|
|
388
|
-
//
|
|
388
|
+
// OPTIMISATION: Charger les images sans forcer les dimensions
|
|
389
389
|
images.forEach(img => {
|
|
390
390
|
if (img.dataset.src && !img.src) {
|
|
391
391
|
img.src = img.dataset.src;
|
|
392
392
|
img.loading = 'eager';
|
|
393
393
|
}
|
|
394
|
+
|
|
395
|
+
// OPTIMISATION: Préserver les styles CSS existants (object-fit, etc.)
|
|
396
|
+
const originalObjectFit = img.style.objectFit || getComputedStyle(img).objectFit;
|
|
397
|
+
const originalObjectPosition = img.style.objectPosition || getComputedStyle(img).objectPosition;
|
|
398
|
+
const originalWidth = img.style.width;
|
|
399
|
+
const originalHeight = img.style.height;
|
|
400
|
+
|
|
394
401
|
img.onload = () => {
|
|
402
|
+
// OPTIMISATION: Restaurer les styles CSS après chargement
|
|
403
|
+
if (originalObjectFit && originalObjectFit !== 'none') {
|
|
404
|
+
img.style.objectFit = originalObjectFit;
|
|
405
|
+
}
|
|
406
|
+
if (originalObjectPosition && originalObjectPosition !== 'initial') {
|
|
407
|
+
img.style.objectPosition = originalObjectPosition;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// OPTIMISATION: Préserver les dimensions naturelles des images
|
|
411
|
+
if (!originalWidth || originalWidth === '') {
|
|
412
|
+
img.style.width = 'auto';
|
|
413
|
+
}
|
|
414
|
+
if (!originalHeight || originalHeight === '') {
|
|
415
|
+
img.style.height = 'auto';
|
|
416
|
+
}
|
|
417
|
+
|
|
395
418
|
imagesLoaded++;
|
|
396
419
|
};
|
|
397
420
|
img.onerror = () => {
|