voilaaaaa
This commit is contained in:
parent
65cbe79f95
commit
b759735a87
1 changed files with 14 additions and 14 deletions
28
js/ens.js
28
js/ens.js
|
@ -84,7 +84,7 @@ async function gen_contenu() {
|
||||||
'ico',
|
'ico',
|
||||||
'raw'];
|
'raw'];
|
||||||
|
|
||||||
switch (ext) {
|
switch (true) {
|
||||||
case image_extensions.includes(ext): // image
|
case image_extensions.includes(ext): // image
|
||||||
previewCell = document.createElement('td');
|
previewCell = document.createElement('td');
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
|
@ -92,14 +92,14 @@ async function gen_contenu() {
|
||||||
img.alt = doc.titre;
|
img.alt = doc.titre;
|
||||||
previewCell.appendChild(img);
|
previewCell.appendChild(img);
|
||||||
|
|
||||||
let link = document.createElement('a');
|
let lien_img = document.createElement('a');
|
||||||
link.href = doc.upload_path;
|
lien_img.href = doc.upload_path;
|
||||||
link.textContent = 'Voir image';
|
lien_img.textContent = 'Voir image';
|
||||||
link.target = '_blank';
|
lien_img.target = '_blank';
|
||||||
previewCell.appendChild(link);
|
previewCell.appendChild(lien_img);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "pdf": // pdf
|
case ext=="pdf": // pdf
|
||||||
previewCell = document.createElement('td');
|
previewCell = document.createElement('td');
|
||||||
const pdfLink = document.createElement('a');
|
const pdfLink = document.createElement('a');
|
||||||
pdfLink.href = doc.upload_path;
|
pdfLink.href = doc.upload_path;
|
||||||
|
@ -107,14 +107,14 @@ async function gen_contenu() {
|
||||||
pdfLink.target = '_blank';
|
pdfLink.target = '_blank';
|
||||||
previewCell.appendChild(pdfLink);
|
previewCell.appendChild(pdfLink);
|
||||||
break;
|
break;
|
||||||
case "mp4": // video
|
case ext == "mp4": // video
|
||||||
previewCell = document.createElement('td');
|
previewCell = document.createElement('td');
|
||||||
const video = document.createElement('video');
|
const video = document.createElement('video');
|
||||||
video.src = doc.upload_path;
|
video.src = doc.upload_path;
|
||||||
video.controls = true;
|
video.controls = true;
|
||||||
previewCell.appendChild(video);
|
previewCell.appendChild(video);
|
||||||
break;
|
break;
|
||||||
case "html":
|
case ext == "html":
|
||||||
previewCell = document.createElement('td');
|
previewCell = document.createElement('td');
|
||||||
const iframe = document.createElement('iframe');
|
const iframe = document.createElement('iframe');
|
||||||
iframe.href = doc.upload_path;
|
iframe.href = doc.upload_path;
|
||||||
|
@ -124,11 +124,11 @@ async function gen_contenu() {
|
||||||
|
|
||||||
default :
|
default :
|
||||||
previewCell = document.createElement('td');
|
previewCell = document.createElement('td');
|
||||||
link = document.createElement('a');
|
let lien = document.createElement('a');
|
||||||
link.href = doc.upload_path;
|
lien.href = doc.upload_path;
|
||||||
link.textContent = 'Type de fichier non supporté.';
|
lien.textContent = 'Type de fichier non supporté.';
|
||||||
link.target = '_blank';
|
lien.target = '_blank';
|
||||||
previewCell.appendChild(link);
|
previewCell.appendChild(lien);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue