Actualiser js/public.js
This commit is contained in:
+10
-6
@@ -18,18 +18,22 @@ function getStarsHTML(rating) {
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "Support physique / Cinéma" (ou l'ancien libellé) n'est pas une plateforme de streaming
|
||||||
|
function isPhysicalLabel(value) {
|
||||||
|
const v = String(value || '').toLowerCase();
|
||||||
|
return v.includes('support physique');
|
||||||
|
}
|
||||||
|
|
||||||
function generateStreamingSelect() {
|
function generateStreamingSelect() {
|
||||||
const select = document.getElementById('pub-streaming-select');
|
const select = document.getElementById('pub-streaming-select');
|
||||||
if (!select) return;
|
if (!select) return;
|
||||||
|
|
||||||
const platforms = new Set();
|
const platforms = new Set();
|
||||||
films.forEach(f => {
|
films.forEach(f => {
|
||||||
if (f.type === 'critique' && f.streaming &&
|
if (f.type === 'critique' && f.streaming && f.streaming.trim() !== '') {
|
||||||
f.streaming !== 'Disponible en support physique ou Cinéma' &&
|
|
||||||
f.streaming.trim() !== '') {
|
|
||||||
f.streaming.split(',').forEach(p => {
|
f.streaming.split(',').forEach(p => {
|
||||||
const platform = p.trim();
|
const platform = p.trim();
|
||||||
if (platform.length > 0) platforms.add(platform);
|
if (platform.length > 0 && !isPhysicalLabel(platform)) platforms.add(platform);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -151,7 +155,7 @@ function renderPublicGrid() {
|
|||||||
if (currentPubTab === 'critique' && activeStreamingFilter) {
|
if (currentPubTab === 'critique' && activeStreamingFilter) {
|
||||||
const filterLower = activeStreamingFilter.toLowerCase();
|
const filterLower = activeStreamingFilter.toLowerCase();
|
||||||
filtered = filtered.filter(f => {
|
filtered = filtered.filter(f => {
|
||||||
if (!f.streaming || f.streaming === 'Disponible en support physique ou Cinéma') return false;
|
if (!f.streaming || isPhysicalLabel(f.streaming)) return false;
|
||||||
const platforms = f.streaming.split(',').map(p => p.trim().toLowerCase());
|
const platforms = f.streaming.split(',').map(p => p.trim().toLowerCase());
|
||||||
return platforms.includes(filterLower);
|
return platforms.includes(filterLower);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user