forked from MarseyWorld/MarseyWorld
same as last commit
parent
113791ca69
commit
4c16aa2093
|
@ -83,28 +83,16 @@
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
filename = filename.name.toLowerCase()
|
filename = filename.name.toLowerCase()
|
||||||
if (document.activeElement.id == 'post-text') {
|
f=document.getElementById('file-upload');
|
||||||
let filename = ''
|
f.files = files;
|
||||||
for (const file of files)
|
document.getElementById('filename-show').textContent = filename;
|
||||||
filename += file.name + ', '
|
if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".gif") || filename.endsWith(".webp"))
|
||||||
filename = filename.toLowerCase().slice(0, -2)
|
{
|
||||||
document.getElementById('file-upload-submit').files = files;
|
var fileReader = new FileReader();
|
||||||
document.getElementById('filename-show-submit').textContent = filename;
|
fileReader.readAsDataURL(f.files[0]);
|
||||||
|
fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);});
|
||||||
}
|
}
|
||||||
else {
|
document.getElementById('file-upload').setAttribute('required', 'false');
|
||||||
f=document.getElementById('file-upload');
|
|
||||||
f.files = files;
|
|
||||||
document.getElementById('filename-show').textContent = filename;
|
|
||||||
if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".gif") || filename.endsWith(".webp"))
|
|
||||||
{
|
|
||||||
var fileReader = new FileReader();
|
|
||||||
fileReader.readAsDataURL(f.files[0]);
|
|
||||||
fileReader.addEventListener("load", function () {document.getElementById('image-preview').setAttribute('src', this.result);});
|
|
||||||
}
|
|
||||||
document.getElementById('file-upload').setAttribute('required', 'false');
|
|
||||||
}
|
|
||||||
document.getElementById('post-url').value = null;
|
|
||||||
localStorage.setItem("post-url", "")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue