@bebranded/bb-contents 1.0.13-beta → 1.0.15-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.
Files changed (2) hide show
  1. package/bb-contents.js +24 -11
  2. 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.13-beta
4
+ * @version 1.0.15-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.13-beta',
20
+ version: '1.0.15-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: {
@@ -320,7 +320,7 @@
320
320
  if (element.bbProcessed) return;
321
321
  element.bbProcessed = true;
322
322
 
323
- const speed = bbContents._getAttr(element, 'bb-marquee-speed') || '30';
323
+ const speed = bbContents._getAttr(element, 'bb-marquee-speed') || '100';
324
324
  const direction = bbContents._getAttr(element, 'bb-marquee-direction') || 'left';
325
325
  const pause = bbContents._getAttr(element, 'bb-marquee-pause') || 'true';
326
326
  const gap = bbContents._getAttr(element, 'bb-marquee-gap') || '50';
@@ -345,7 +345,7 @@
345
345
  align-items: center;
346
346
  ${orientation === 'vertical' ? 'flex-direction: column;' : ''}
347
347
  gap: ${gap}px;
348
- animation: marquee ${speed}s linear infinite;
348
+ animation: marquee ${speed}ms linear infinite;
349
349
  ${direction === 'right' ? 'animation-direction: reverse;' : ''}
350
350
  ${orientation === 'vertical' ? 'animation-name: marquee-vertical;' : ''}
351
351
  `;
@@ -399,7 +399,7 @@
399
399
  // Délai pour l'animation
400
400
  const isVertical = orientation === 'vertical';
401
401
  setTimeout(() => {
402
- scrollContainer.style.animation = `marquee${isVertical ? '-vertical' : ''} ${speed}s linear infinite`;
402
+ scrollContainer.style.animation = `marquee${isVertical ? '-vertical' : ''} ${speed}ms linear infinite`;
403
403
  if (direction === 'right') {
404
404
  scrollContainer.style.animationDirection = 'reverse';
405
405
  }
@@ -528,23 +528,28 @@
528
528
  element.rel = 'noopener noreferrer';
529
529
  }
530
530
 
531
- // Remplir la thumbnail
531
+ // Remplir la thumbnail (haute qualité)
532
532
  const thumbnail = element.querySelector('[bb-youtube-thumbnail]');
533
533
  if (thumbnail) {
534
- thumbnail.src = snippet.thumbnails.medium.url;
534
+ // Utiliser la meilleure qualité disponible
535
+ const highQualityUrl = snippet.thumbnails.maxres?.url ||
536
+ snippet.thumbnails.high?.url ||
537
+ snippet.thumbnails.medium?.url ||
538
+ snippet.thumbnails.default?.url;
539
+ thumbnail.src = highQualityUrl;
535
540
  thumbnail.alt = snippet.title;
536
541
  }
537
542
 
538
- // Remplir le titre
543
+ // Remplir le titre (avec décodage HTML)
539
544
  const title = element.querySelector('[bb-youtube-title]');
540
545
  if (title) {
541
- title.textContent = snippet.title;
546
+ title.textContent = this.decodeHtmlEntities(snippet.title);
542
547
  }
543
548
 
544
- // Remplir la description
549
+ // Remplir la description (avec décodage HTML)
545
550
  const description = element.querySelector('[bb-youtube-description]');
546
551
  if (description) {
547
- description.textContent = snippet.description;
552
+ description.textContent = this.decodeHtmlEntities(snippet.description);
548
553
  }
549
554
 
550
555
  // Remplir la date
@@ -571,6 +576,14 @@
571
576
  if (diffDays < 30) return `Il y a ${Math.floor(diffDays / 7)} semaines`;
572
577
  if (diffDays < 365) return `Il y a ${Math.floor(diffDays / 30)} mois`;
573
578
  return `Il y a ${Math.floor(diffDays / 365)} ans`;
579
+ },
580
+
581
+ // Fonction pour décoder les entités HTML
582
+ decodeHtmlEntities: function(text) {
583
+ if (!text) return '';
584
+ const textarea = document.createElement('textarea');
585
+ textarea.innerHTML = text;
586
+ return textarea.value;
574
587
  }
575
588
  }
576
589
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.13-beta",
3
+ "version": "1.0.15-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {