@bebranded/bb-contents 1.0.8-beta → 1.0.10-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 +28 -11
- package/package.json +1 -1
package/bb-contents.js
CHANGED
|
@@ -442,19 +442,22 @@
|
|
|
442
442
|
return;
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
-
// Chercher le
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
445
|
+
// Chercher le template pour une vidéo (directement dans l'élément ou dans un conteneur)
|
|
446
|
+
let template = element.querySelector('[bb-youtube-item]');
|
|
447
|
+
let container = element;
|
|
448
|
+
|
|
449
|
+
// Si pas de template direct, chercher dans un conteneur
|
|
450
|
+
if (!template) {
|
|
451
|
+
const containerElement = element.querySelector('[bb-youtube-container]');
|
|
452
|
+
if (containerElement) {
|
|
453
|
+
container = containerElement;
|
|
454
|
+
template = containerElement.querySelector('[bb-youtube-item]');
|
|
455
|
+
}
|
|
451
456
|
}
|
|
452
457
|
|
|
453
|
-
// Chercher le template pour une vidéo
|
|
454
|
-
const template = container.querySelector('[bb-youtube-item]');
|
|
455
458
|
if (!template) {
|
|
456
459
|
bbContents.utils.log('Erreur: élément [bb-youtube-item] manquant');
|
|
457
|
-
|
|
460
|
+
element.innerHTML = '<div style="padding: 20px; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; color: #dc2626;"><strong>Template manquant</strong><br>Ajoutez un élément avec l\'attribut bb-youtube-item</div>';
|
|
458
461
|
return;
|
|
459
462
|
}
|
|
460
463
|
|
|
@@ -495,10 +498,24 @@
|
|
|
495
498
|
let videos = data.items;
|
|
496
499
|
if (!allowShorts) {
|
|
497
500
|
videos = videos.filter(item => {
|
|
498
|
-
// Filtrer les shorts (vidéos
|
|
501
|
+
// Filtrer les shorts (vidéos avec #shorts dans le titre ou description)
|
|
499
502
|
const title = item.snippet.title.toLowerCase();
|
|
500
503
|
const description = item.snippet.description.toLowerCase();
|
|
501
|
-
|
|
504
|
+
|
|
505
|
+
// Détecter les shorts par plusieurs critères
|
|
506
|
+
const isShort =
|
|
507
|
+
title.includes('#shorts') ||
|
|
508
|
+
title.includes('#short') ||
|
|
509
|
+
description.includes('#shorts') ||
|
|
510
|
+
description.includes('#short') ||
|
|
511
|
+
title.includes('shorts') ||
|
|
512
|
+
description.includes('shorts');
|
|
513
|
+
|
|
514
|
+
if (isShort) {
|
|
515
|
+
bbContents.utils.log(`Short détecté et filtré: "${item.snippet.title}"`);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return !isShort;
|
|
502
519
|
});
|
|
503
520
|
bbContents.utils.log(`Filtrage des shorts: ${data.items.length} → ${videos.length} vidéos`);
|
|
504
521
|
}
|