FILEUP



LOG | FILES | OVERVIEW


F diff --git a/css/style.css b/css/style.css --- a/css/style.css +++ b/css/style.css
+
html, body {
margin: 0;
height: 100%;
background: white;
}
+ .filecontents.imgview {
+ background-color: black;
+ background-repeat: no-repeat;
+ background-position: center;
+ }
+
+ .filecontentsroot, .foldercontents {
+ display: flex;
+ flex-direction: column;
+ }
+
.filecontents {
padding: 0.8rem;
font-size: 1.1rem;
.close_button:hover {
background: white;
}
+
F diff --git a/loggedin.js b/loggedin.js --- a/loggedin.js +++ b/loggedin.js
xhr.open('POST', '/php/readfile.php', true);
focus.filecontents.innerText = "";
- focus.filecontentsroot.style.display = 'block';
+ focus.filecontentsroot.style.display = 'flex';
focus.foldercontents.style.display = 'none';
if (mimetype.split("/")[0] == "image") {
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
- var b = base64ArrayBuffer(xhr.response);
- var image = new Image();
- image.src = `data:image/png;base64,${b}`;
- image.style.minWidth = "0px";
- image.style.minHeight = "0px";
-
- focus.filecontents.appendChild(image);
- focus.filecontents.display = "flex";
+ let b = `data:image/png;base64,${base64ArrayBuffer(xhr.response)}`;
+
+
+ focus.filecontents.style.backgroundImage = `url('${b}')`;
+ focus.filecontents.classList.add('imgview');
+ focus.filecontents.innerText = "asdf";
}
}
else {
+ focus.filecontents.classList.remove('imgview');
+ focus.filecontents.style.backgroundImage = "unset";
+
xhr.onload = function () {
focus.filecontents.innerText = xhr.responseText;
};
xhr.send(data);
focus.filecontentsroot.style.display = 'none';
- focus.foldercontents.style.display = 'block';
+ focus.foldercontents.style.display = 'flex';
}
the_file.onchange = on_file_added;
- main();
> \ No newline at end of file
+ main();