@bebranded/bb-contents 1.0.82 → 1.0.84-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 +7 -32
- 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.84
|
|
5
5
|
* @author BeBranded
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @website https://www.bebranded.xyz
|
|
@@ -16,30 +16,27 @@
|
|
|
16
16
|
|
|
17
17
|
// Protection contre le double chargement
|
|
18
18
|
if (window.bbContents) {
|
|
19
|
-
console.warn('BeBranded Contents est déjà chargé');
|
|
20
19
|
return;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
// Vérifier si la version a déjà été affichée
|
|
24
23
|
if (window._bbContentsVersionDisplayed) {
|
|
25
|
-
console.log('🔄 [BB Contents] Version déjà affichée, réinitialisation...');
|
|
26
24
|
return;
|
|
27
25
|
}
|
|
28
26
|
window._bbContentsVersionDisplayed = true;
|
|
29
27
|
|
|
30
28
|
// Protection supplémentaire contre la double initialisation
|
|
31
29
|
if (window._bbContentsInitialized) {
|
|
32
|
-
console.log('🔄 [BB Contents] Déjà initialisé, réinitialisation...');
|
|
33
30
|
return;
|
|
34
31
|
}
|
|
35
32
|
window._bbContentsInitialized = true;
|
|
36
33
|
|
|
37
|
-
// Log de démarrage simple
|
|
38
|
-
console.log('bb-contents | v1.0.
|
|
34
|
+
// Log de démarrage simple (une seule fois)
|
|
35
|
+
console.log('bb-contents | v1.0.84');
|
|
39
36
|
|
|
40
37
|
// Configuration
|
|
41
38
|
const config = {
|
|
42
|
-
version: '1.0.
|
|
39
|
+
version: '1.0.84',
|
|
43
40
|
debug: false, // Debug désactivé pour rendu propre
|
|
44
41
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
45
42
|
youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
|
|
@@ -112,9 +109,7 @@
|
|
|
112
109
|
|
|
113
110
|
// Initialisation
|
|
114
111
|
init: function() {
|
|
115
|
-
//
|
|
116
|
-
console.log('bb-contents | v' + this.config.version);
|
|
117
|
-
|
|
112
|
+
// Initialisation silencieuse
|
|
118
113
|
this.utils.log('Initialisation v' + this.config.version);
|
|
119
114
|
|
|
120
115
|
// Debug environnement supprimé pour console propre
|
|
@@ -263,7 +258,7 @@
|
|
|
263
258
|
if (scope.closest && scope.closest('[data-bb-disable]')) return;
|
|
264
259
|
const elements = scope.querySelectorAll(bbContents._attrSelector('marquee'));
|
|
265
260
|
|
|
266
|
-
|
|
261
|
+
// Éléments marquee détectés
|
|
267
262
|
|
|
268
263
|
// Traitement simple et parallèle de tous les marquees
|
|
269
264
|
elements.forEach((element, index) => {
|
|
@@ -356,7 +351,6 @@
|
|
|
356
351
|
|
|
357
352
|
|
|
358
353
|
if (contentSize === 0) {
|
|
359
|
-
console.log('⚠️ [MARQUEE] Contenu vide, retry dans 200ms');
|
|
360
354
|
setTimeout(() => this.initAnimation(element, scrollContainer, mainBlock, options), 200);
|
|
361
355
|
return;
|
|
362
356
|
}
|
|
@@ -416,12 +410,9 @@
|
|
|
416
410
|
waitTimeout += 100;
|
|
417
411
|
|
|
418
412
|
if (imagesLoaded >= totalImages || imagesLoaded === 0 || waitTimeout >= maxWaitTime) {
|
|
419
|
-
console.log(`✅ [MARQUEE] Safari - Images chargées: ${imagesLoaded}/${totalImages} (timeout: ${waitTimeout}ms)`);
|
|
420
|
-
|
|
421
413
|
// Attendre plus longtemps sur mobile pour le rendu visuel
|
|
422
414
|
const renderDelay = isMobile ? 1000 : 200;
|
|
423
415
|
setTimeout(() => {
|
|
424
|
-
console.log(`🖼️ [MARQUEE] Safari - Attente rendu visuel des images...`);
|
|
425
416
|
startSafariAnimation();
|
|
426
417
|
}, renderDelay);
|
|
427
418
|
} else {
|
|
@@ -434,7 +425,6 @@
|
|
|
434
425
|
const startSafariAnimation = () => {
|
|
435
426
|
// Forcer le chargement des images restantes si timeout
|
|
436
427
|
if (waitTimeout >= maxWaitTime && imagesLoaded < totalImages) {
|
|
437
|
-
console.log(`⚠️ [MARQUEE] Safari - Timeout atteint, forcer chargement images restantes`);
|
|
438
428
|
images.forEach(img => {
|
|
439
429
|
if (img.dataset.src && !img.src) {
|
|
440
430
|
img.src = img.dataset.src;
|
|
@@ -450,11 +440,9 @@
|
|
|
450
440
|
imagesWithSize++;
|
|
451
441
|
}
|
|
452
442
|
});
|
|
453
|
-
console.log(`🖼️ [MARQUEE] Safari - Images avec taille visible: ${imagesWithSize}/${totalImages}`);
|
|
454
443
|
|
|
455
444
|
// Recalculer la taille après chargement des images
|
|
456
445
|
const newContentSize = isVertical ? mainBlock.offsetHeight : mainBlock.offsetWidth;
|
|
457
|
-
console.log(`🔍 [MARQUEE] Safari - Nouvelle taille après images: ${newContentSize}px`);
|
|
458
446
|
|
|
459
447
|
let finalContentSize = newContentSize > contentSize ? newContentSize : contentSize;
|
|
460
448
|
|
|
@@ -467,7 +455,6 @@
|
|
|
467
455
|
if (finalContentSize < 200) {
|
|
468
456
|
// Valeurs par défaut plus généreuses sur mobile
|
|
469
457
|
finalContentSize = isVertical ? (isMobile ? 600 : 400) : (isMobile ? 1000 : 800);
|
|
470
|
-
console.log(`🔍 [MARQUEE] Safari - Utilisation valeur par défaut mobile: ${finalContentSize}px`);
|
|
471
458
|
}
|
|
472
459
|
}
|
|
473
460
|
|
|
@@ -496,8 +483,6 @@
|
|
|
496
483
|
? `translate3d(0, ${currentPosition}px, 0)`
|
|
497
484
|
: `translate3d(${currentPosition}px, 0, 0)`;
|
|
498
485
|
scrollContainer.style.transform = initialTransform;
|
|
499
|
-
|
|
500
|
-
console.log(`🔍 [MARQUEE] Safari - Position initiale: ${currentPosition}px, transform: ${initialTransform}`);
|
|
501
486
|
|
|
502
487
|
// Fonction d'animation Safari avec debug des resets
|
|
503
488
|
let frameCount = 0;
|
|
@@ -508,21 +493,16 @@
|
|
|
508
493
|
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
509
494
|
currentPosition += step;
|
|
510
495
|
if (currentPosition >= 0) {
|
|
511
|
-
console.log(`🔄 [MARQUEE] Safari RESET bottom/right: ${currentPosition} → ${-(finalContentSize + gapSize)}`);
|
|
512
496
|
currentPosition = -(finalContentSize + gapSize);
|
|
513
497
|
}
|
|
514
498
|
} else {
|
|
515
499
|
currentPosition -= step;
|
|
516
500
|
if (currentPosition <= -(2 * (finalContentSize + gapSize))) {
|
|
517
|
-
console.log(`🔄 [MARQUEE] Safari RESET top/left: ${currentPosition} → ${-(finalContentSize + gapSize)}`);
|
|
518
501
|
currentPosition = -(finalContentSize + gapSize);
|
|
519
502
|
}
|
|
520
503
|
}
|
|
521
504
|
|
|
522
|
-
//
|
|
523
|
-
if (frameCount % 60 === 0) {
|
|
524
|
-
console.log(`📍 [MARQUEE] Safari position: ${currentPosition}px (frame ${frameCount})`);
|
|
525
|
-
}
|
|
505
|
+
// Animation continue
|
|
526
506
|
|
|
527
507
|
// ARRONDI pour éviter les erreurs de précision JavaScript
|
|
528
508
|
currentPosition = Math.round(currentPosition * 100) / 100;
|
|
@@ -539,7 +519,6 @@
|
|
|
539
519
|
// Démarrer l'animation avec un petit délai pour Safari
|
|
540
520
|
setTimeout(() => {
|
|
541
521
|
animate();
|
|
542
|
-
console.log('✅ [MARQUEE] Animation Safari démarrée avec JavaScript optimisé');
|
|
543
522
|
}, 50);
|
|
544
523
|
|
|
545
524
|
// Pause au survol pour Safari
|
|
@@ -599,7 +578,6 @@
|
|
|
599
578
|
|
|
600
579
|
// Démarrer l'animation
|
|
601
580
|
animate();
|
|
602
|
-
console.log('✅ [MARQUEE] Animation standard démarrée');
|
|
603
581
|
|
|
604
582
|
// Pause au survol
|
|
605
583
|
if (pauseOnHover === 'true') {
|
|
@@ -707,7 +685,6 @@
|
|
|
707
685
|
const networkFunc = this.networks[network];
|
|
708
686
|
|
|
709
687
|
if (!networkFunc) {
|
|
710
|
-
console.error('[BB Contents] Réseau non supporté:', network);
|
|
711
688
|
return;
|
|
712
689
|
}
|
|
713
690
|
|
|
@@ -786,7 +763,6 @@
|
|
|
786
763
|
bbContents.utils.log('Partage natif réussi');
|
|
787
764
|
}).catch(function(error) {
|
|
788
765
|
if (error.name !== 'AbortError') {
|
|
789
|
-
console.error('[BB Contents] Erreur partage natif:', error);
|
|
790
766
|
// Fallback vers copie si échec
|
|
791
767
|
bbContents.modules.share.copyToClipboard(data.url, element, false);
|
|
792
768
|
}
|
|
@@ -1203,7 +1179,6 @@
|
|
|
1203
1179
|
window[loadingKey] = false;
|
|
1204
1180
|
})
|
|
1205
1181
|
.catch(error => {
|
|
1206
|
-
console.error('Erreur API YouTube:', error);
|
|
1207
1182
|
// Erreur dans le module youtube
|
|
1208
1183
|
|
|
1209
1184
|
// Libérer le verrou en cas d'erreur
|