@bebranded/bb-contents 1.0.12-beta → 1.0.14-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 +21 -8
  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.6-beta
4
+ * @version 1.0.13-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.6-beta',
20
+ version: '1.0.13-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: {
@@ -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.12-beta",
3
+ "version": "1.0.14-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {