diff options
author | adam <adam@> | 2021-02-15 11:09:03 +0200 |
---|---|---|
committer | adam <adam@> | 2021-02-15 11:09:03 +0200 |
commit | ceb1706e1caf92054bbc6291a70824f16e30eff0 (patch) | |
tree | f61414f03c85753790b39603c5906fe1209be328 /loggedin.js | |
parent | f4e5ef20b3d0dd21867f24db5bea2b2137abe1e1 (diff) | |
parent | e2ab5591cc6d30b1fa26e094b2c50aa7879cdd88 (diff) | |
download | fileup-ceb1706e1caf92054bbc6291a70824f16e30eff0.tar.gz |
Merge https://github.com/alexvitkov/india
Diffstat (limited to 'loggedin.js')
-rw-r--r-- | loggedin.js | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/loggedin.js b/loggedin.js index da894dd..9efbb75 100644 --- a/loggedin.js +++ b/loggedin.js @@ -311,25 +311,27 @@ function openfile_nondir() { 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"; + + var pre = mk(focus.filecontents, 'pre'); + xhr.onload = function () { - focus.filecontents.innerText = xhr.responseText; + pre.innerText = xhr.responseText; + pre.contentEditable = "true"; }; } @@ -402,7 +404,7 @@ function opendir() { xhr.send(data); focus.filecontentsroot.style.display = 'none'; - focus.foldercontents.style.display = 'block'; + focus.foldercontents.style.display = 'flex'; } @@ -1020,4 +1022,4 @@ document.body.oncontextmenu = (e) => { the_file.onchange = on_file_added; -main();
\ No newline at end of file +main(); |