Update Main.js with English trans. & Responsive tab.

This commit is contained in:
2026-05-12 23:40:00 +02:00
parent 5058aff6c8
commit a655c4f1c3
+11 -5
View File
@@ -151,25 +151,26 @@ async function fetchData(planetId) {
let rowHtml = ''; let rowHtml = '';
columns.forEach(col => { columns.forEach(col => {
const colLower = col.toLowerCase(); const colLower = col.toLowerCase();
const colLabel = col.toUpperCase();
if (colLower.includes('url') || colLower === 'image' || colLower === 'img') { if (colLower.includes('url') || colLower === 'image' || colLower === 'img') {
const url = row[col]; const url = row[col];
if (url && url.trim() !== '') { if (url && url.trim() !== '') {
rowHtml += `<td class="col-url"> rowHtml += `<td class="col-url" data-label="${colLabel}">
<a href="${url}" target="_blank" rel="noopener noreferrer"> <a href="${url}" target="_blank" rel="noopener noreferrer">
${url} ${url}
</a> </a>
</td>`; </td>`;
} else { } else {
rowHtml += `<td class="col-url">N/A</td>`; rowHtml += `<td class="col-url" data-label="${colLabel}">N/A</td>`;
} }
} else if (colLower.includes('desc') || colLower.includes('expl')) { } else if (colLower.includes('desc') || colLower.includes('expl')) {
const text = row[col] || ''; const text = row[col] || '';
let fontSizeStyle = ''; let fontSizeStyle = '';
if (text.length > 200) fontSizeStyle = ' font-size: 0.75rem;'; if (text.length > 200) fontSizeStyle = ' font-size: 0.75rem;';
else if (text.length > 100) fontSizeStyle = ' font-size: 0.85rem;'; else if (text.length > 100) fontSizeStyle = ' font-size: 0.85rem;';
rowHtml += `<td class="col-desc" style="${fontSizeStyle}">${text}</td>`; rowHtml += `<td class="col-desc" style="${fontSizeStyle}" data-label="${colLabel}">${text}</td>`;
} else { } else {
rowHtml += `<td>${row[col]}</td>`; rowHtml += `<td data-label="${colLabel}">${row[col]}</td>`;
} }
}); });
@@ -178,6 +179,11 @@ async function fetchData(planetId) {
}); });
const tableContainer = tbody.closest('.table-container'); const tableContainer = tbody.closest('.table-container');
if (tableContainer) {
tableContainer.style.overflowX = 'auto';
tableContainer.style.maxWidth = '100%';
tableContainer.style.WebkitOverflowScrolling = 'touch';
}
const existingBtn = tableContainer.querySelector('.show-more-btn'); const existingBtn = tableContainer.querySelector('.show-more-btn');
if (existingBtn) existingBtn.remove(); if (existingBtn) existingBtn.remove();
@@ -359,7 +365,7 @@ document.addEventListener('DOMContentLoaded', () => {
const iframes = document.querySelectorAll('iframe'); const iframes = document.querySelectorAll('iframe');
iframes.forEach(iframe => { iframes.forEach(iframe => {
const fallback = document.createElement('div'); const fallback = document.createElement('div');
fallback.textContent = "fonctionnalité uniquement fonctionnelle sur pc"; fallback.textContent = "functionality not available on mobile devices";
fallback.style.display = "flex"; fallback.style.display = "flex";
fallback.style.alignItems = "center"; fallback.style.alignItems = "center";
fallback.style.justifyContent = "center"; fallback.style.justifyContent = "center";