@bebranded/bb-contents 1.0.80-beta → 1.0.81-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 +18 -28
- package/package.json +1 -1
package/bb-contents.js
CHANGED
|
@@ -34,15 +34,13 @@
|
|
|
34
34
|
}
|
|
35
35
|
window._bbContentsInitialized = true;
|
|
36
36
|
|
|
37
|
-
// Log de démarrage
|
|
38
|
-
console.log('
|
|
39
|
-
console.log('🔍 [BB Contents] User Agent:', navigator.userAgent);
|
|
40
|
-
console.log('🔍 [BB Contents] Safari détecté:', /^((?!chrome|android).)*safari/i.test(navigator.userAgent));
|
|
37
|
+
// Log de démarrage simple
|
|
38
|
+
console.log('bb-contents | v1.0.81-beta');
|
|
41
39
|
|
|
42
40
|
// Configuration
|
|
43
41
|
const config = {
|
|
44
|
-
version: '1.0.
|
|
45
|
-
debug:
|
|
42
|
+
version: '1.0.81-beta',
|
|
43
|
+
debug: false, // Debug désactivé pour rendu propre
|
|
46
44
|
prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
|
|
47
45
|
youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
|
|
48
46
|
i18n: {
|
|
@@ -247,7 +245,7 @@
|
|
|
247
245
|
subtree: true
|
|
248
246
|
});
|
|
249
247
|
|
|
250
|
-
|
|
248
|
+
this.utils.log('MutationObserver actif');
|
|
251
249
|
}
|
|
252
250
|
};
|
|
253
251
|
|
|
@@ -255,14 +253,14 @@
|
|
|
255
253
|
bbContents.modules = {
|
|
256
254
|
// Module Marquee - Version simplifiée et robuste
|
|
257
255
|
marquee: {
|
|
258
|
-
|
|
259
|
-
|
|
256
|
+
detect: function(scope) {
|
|
257
|
+
const s = scope || document;
|
|
260
258
|
return s.querySelector(bbContents._attrSelector('marquee')) !== null;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
init: function(root) {
|
|
262
|
+
const scope = root || document;
|
|
263
|
+
if (scope.closest && scope.closest('[data-bb-disable]')) return;
|
|
266
264
|
const elements = scope.querySelectorAll(bbContents._attrSelector('marquee'));
|
|
267
265
|
|
|
268
266
|
console.log('🔍 [MARQUEE] Éléments trouvés:', elements.length);
|
|
@@ -273,9 +271,8 @@
|
|
|
273
271
|
if (element.bbProcessed || element.hasAttribute('data-bb-marquee-processed')) {
|
|
274
272
|
return;
|
|
275
273
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
console.log(`🔍 [MARQUEE] Initialisation ${index + 1}/${elements.length}`);
|
|
274
|
+
element.bbProcessed = true;
|
|
275
|
+
|
|
279
276
|
|
|
280
277
|
// Récupérer les options
|
|
281
278
|
const speed = bbContents._getAttr(element, 'bb-marquee-speed') || '100';
|
|
@@ -357,7 +354,6 @@
|
|
|
357
354
|
// Calculer les dimensions
|
|
358
355
|
const contentSize = isVertical ? mainBlock.offsetHeight : mainBlock.offsetWidth;
|
|
359
356
|
|
|
360
|
-
console.log(`🔍 [MARQUEE] Animation démarrée - contentSize: ${contentSize}px, isVertical: ${isVertical}`);
|
|
361
357
|
|
|
362
358
|
if (contentSize === 0) {
|
|
363
359
|
console.log('⚠️ [MARQUEE] Contenu vide, retry dans 200ms');
|
|
@@ -367,7 +363,6 @@
|
|
|
367
363
|
|
|
368
364
|
// Détection Safari
|
|
369
365
|
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
370
|
-
console.log(`🔍 [MARQUEE] Safari détecté: ${isSafari}`);
|
|
371
366
|
|
|
372
367
|
const gapSize = parseInt(gap);
|
|
373
368
|
const step = (parseFloat(speed) * (isVertical ? 1.5 : 0.8)) / 60;
|
|
@@ -389,14 +384,12 @@
|
|
|
389
384
|
initSafariAnimation: function(element, scrollContainer, mainBlock, options) {
|
|
390
385
|
const { speed, direction, gap, isVertical, useAutoHeight, contentSize, gapSize } = options;
|
|
391
386
|
|
|
392
|
-
console.log(`🔍 [MARQUEE] Safari Animation - direction: ${direction}, isVertical: ${isVertical}, contentSize: ${contentSize}`);
|
|
393
387
|
|
|
394
388
|
// SOLUTION SAFARI : Forcer le chargement des images avant animation
|
|
395
389
|
const images = mainBlock.querySelectorAll('img');
|
|
396
390
|
let imagesLoaded = 0;
|
|
397
391
|
const totalImages = images.length;
|
|
398
392
|
|
|
399
|
-
console.log(`🔍 [MARQUEE] Safari - ${totalImages} images détectées`);
|
|
400
393
|
|
|
401
394
|
// Forcer le chargement de toutes les images
|
|
402
395
|
images.forEach(img => {
|
|
@@ -406,17 +399,14 @@
|
|
|
406
399
|
}
|
|
407
400
|
img.onload = () => {
|
|
408
401
|
imagesLoaded++;
|
|
409
|
-
console.log(`🖼️ [MARQUEE] Safari - Image ${imagesLoaded}/${totalImages} chargée`);
|
|
410
402
|
};
|
|
411
403
|
img.onerror = () => {
|
|
412
404
|
imagesLoaded++;
|
|
413
|
-
console.log(`❌ [MARQUEE] Safari - Image ${imagesLoaded}/${totalImages} erreur de chargement`);
|
|
414
405
|
};
|
|
415
406
|
});
|
|
416
407
|
|
|
417
408
|
// SOLUTION SAFARI MOBILE SIMPLE : Attendre plus longtemps
|
|
418
409
|
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
419
|
-
console.log(`🔍 [MARQUEE] Safari - Mobile détecté: ${isMobile}`);
|
|
420
410
|
|
|
421
411
|
// Timeout plus long sur mobile pour laisser le temps aux images de se charger
|
|
422
412
|
const maxWaitTime = isMobile ? 5000 : 3000; // 5 secondes sur mobile
|
|
@@ -497,7 +487,7 @@
|
|
|
497
487
|
let currentPosition;
|
|
498
488
|
if (direction === (isVertical ? 'bottom' : 'right')) {
|
|
499
489
|
currentPosition = -(finalContentSize + gapSize);
|
|
500
|
-
|
|
490
|
+
} else {
|
|
501
491
|
currentPosition = 0;
|
|
502
492
|
}
|
|
503
493
|
|
|
@@ -521,7 +511,7 @@
|
|
|
521
511
|
console.log(`🔄 [MARQUEE] Safari RESET bottom/right: ${currentPosition} → ${-(finalContentSize + gapSize)}`);
|
|
522
512
|
currentPosition = -(finalContentSize + gapSize);
|
|
523
513
|
}
|
|
524
|
-
|
|
514
|
+
} else {
|
|
525
515
|
currentPosition -= step;
|
|
526
516
|
if (currentPosition <= -(2 * (finalContentSize + gapSize))) {
|
|
527
517
|
console.log(`🔄 [MARQUEE] Safari RESET top/left: ${currentPosition} → ${-(finalContentSize + gapSize)}`);
|
|
@@ -932,8 +922,8 @@
|
|
|
932
922
|
// Debug: logger la qualité utilisée (en mode debug seulement)
|
|
933
923
|
if (bbContents.config.debug) {
|
|
934
924
|
// Thumbnail optimisée
|
|
935
|
-
|
|
936
|
-
|
|
925
|
+
}
|
|
926
|
+
} else {
|
|
937
927
|
// Aucune thumbnail disponible
|
|
938
928
|
}
|
|
939
929
|
}
|