@bebranded/bb-contents 1.0.27-beta → 1.0.29-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 +49 -15
- 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.29-beta
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
// Configuration
|
|
19
19
|
const config = {
|
|
20
|
-
version: '1.0.
|
|
20
|
+
version: '1.0.29-beta',
|
|
21
21
|
debug: window.location.hostname === 'localhost' || window.location.hostname.includes('webflow.io'),
|
|
22
22
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
23
23
|
i18n: {
|
|
@@ -339,6 +339,8 @@
|
|
|
339
339
|
// Créer le conteneur principal
|
|
340
340
|
const mainContainer = document.createElement('div');
|
|
341
341
|
const isVertical = orientation === 'vertical';
|
|
342
|
+
const useAutoHeight = isVertical && height === 'auto';
|
|
343
|
+
|
|
342
344
|
mainContainer.style.cssText = `
|
|
343
345
|
position: relative;
|
|
344
346
|
width: 100%;
|
|
@@ -351,11 +353,9 @@
|
|
|
351
353
|
// Créer le conteneur de défilement
|
|
352
354
|
const scrollContainer = document.createElement('div');
|
|
353
355
|
scrollContainer.style.cssText = `
|
|
354
|
-
position: absolute;
|
|
356
|
+
${useAutoHeight ? 'position: relative;' : 'position: absolute;'}
|
|
355
357
|
will-change: transform;
|
|
356
|
-
height: 100%;
|
|
357
|
-
top: 0px;
|
|
358
|
-
left: 0px;
|
|
358
|
+
${useAutoHeight ? '' : 'height: 100%; top: 0px; left: 0px;'}
|
|
359
359
|
display: flex;
|
|
360
360
|
${isVertical ? 'flex-direction: column;' : ''}
|
|
361
361
|
align-items: center;
|
|
@@ -424,7 +424,11 @@
|
|
|
424
424
|
// Animation JavaScript pour le vertical
|
|
425
425
|
const contentSize = contentHeight;
|
|
426
426
|
const totalSize = contentSize * 4 + parseInt(gap) * 3; // 4 copies au lieu de 3
|
|
427
|
-
|
|
427
|
+
|
|
428
|
+
// Ajuster la hauteur du scrollContainer seulement si pas en mode auto
|
|
429
|
+
if (!useAutoHeight) {
|
|
430
|
+
scrollContainer.style.height = totalSize + 'px';
|
|
431
|
+
}
|
|
428
432
|
|
|
429
433
|
let currentPosition = direction === 'bottom' ? -contentSize - parseInt(gap) : 0;
|
|
430
434
|
const step = (parseFloat(speed) * 2) / 60; // Vitesse différente
|
|
@@ -651,16 +655,46 @@
|
|
|
651
655
|
element.rel = 'noopener noreferrer';
|
|
652
656
|
}
|
|
653
657
|
|
|
654
|
-
// Remplir la thumbnail (
|
|
658
|
+
// Remplir la thumbnail (qualité optimisée)
|
|
655
659
|
const thumbnail = element.querySelector('[bb-youtube-thumbnail]');
|
|
656
660
|
if (thumbnail) {
|
|
657
|
-
//
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
661
|
+
// Logique optimisée pour la meilleure qualité disponible
|
|
662
|
+
let bestThumbnailUrl = null;
|
|
663
|
+
let bestQuality = 'unknown';
|
|
664
|
+
|
|
665
|
+
// Priorité 1: maxres (1280x720) - qualité maximale
|
|
666
|
+
if (snippet.thumbnails.maxres?.url) {
|
|
667
|
+
bestThumbnailUrl = snippet.thumbnails.maxres.url;
|
|
668
|
+
bestQuality = 'maxres (1280x720)';
|
|
669
|
+
}
|
|
670
|
+
// Priorité 2: high (480x360) - bonne qualité pour l'affichage
|
|
671
|
+
else if (snippet.thumbnails.high?.url) {
|
|
672
|
+
bestThumbnailUrl = snippet.thumbnails.high.url;
|
|
673
|
+
bestQuality = 'high (480x360)';
|
|
674
|
+
}
|
|
675
|
+
// Priorité 3: medium (320x180) - qualité acceptable en dernier recours
|
|
676
|
+
else if (snippet.thumbnails.medium?.url) {
|
|
677
|
+
bestThumbnailUrl = snippet.thumbnails.medium.url;
|
|
678
|
+
bestQuality = 'medium (320x180)';
|
|
679
|
+
}
|
|
680
|
+
// Fallback: default (120x90) - seulement si rien d'autre
|
|
681
|
+
else if (snippet.thumbnails.default?.url) {
|
|
682
|
+
bestThumbnailUrl = snippet.thumbnails.default.url;
|
|
683
|
+
bestQuality = 'default (120x90)';
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// Appliquer la meilleure thumbnail trouvée
|
|
687
|
+
if (bestThumbnailUrl) {
|
|
688
|
+
thumbnail.src = bestThumbnailUrl;
|
|
689
|
+
thumbnail.alt = snippet.title;
|
|
690
|
+
|
|
691
|
+
// Debug: logger la qualité utilisée (en mode debug seulement)
|
|
692
|
+
if (bbContents.config.debug) {
|
|
693
|
+
bbContents.utils.log(`Thumbnail optimisée pour ${snippet.title}: ${bestQuality}`);
|
|
694
|
+
}
|
|
695
|
+
} else {
|
|
696
|
+
bbContents.utils.log('Aucune thumbnail disponible pour:', snippet.title);
|
|
697
|
+
}
|
|
664
698
|
}
|
|
665
699
|
|
|
666
700
|
// Remplir le titre (avec décodage HTML)
|