aboutsummaryrefslogtreecommitdiffstats
path: root/loggedin.js
diff options
context:
space:
mode:
authorAlex Vitkov <alexvitkov98@gmail.com>2021-03-07 10:53:00 +0200
committerAlex Vitkov <alexvitkov98@gmail.com>2021-03-07 10:53:00 +0200
commit10a9aa16bb7cfd74e360a183222d8a71d3a52574 (patch)
treec7834318f70f398e0d5e08131710254ef1898c3f /loggedin.js
parenta670aee7f555f6eee6e3ef5d88307b9dae052db1 (diff)
downloadfileup-10a9aa16bb7cfd74e360a183222d8a71d3a52574.tar.gz
Actions part 3 of N, Open in iframe
Diffstat (limited to 'loggedin.js')
-rw-r--r--loggedin.js28
1 files changed, 22 insertions, 6 deletions
diff --git a/loggedin.js b/loggedin.js
index 18bd785..b7b0f0e 100644
--- a/loggedin.js
+++ b/loggedin.js
@@ -669,16 +669,12 @@ function mkcheckbox(parent, label, togglefn) {
function make_share_window(folder, filename) {
var wnd = make_window_base(null, 400, 400, 400, 0);
- wnd.h2.style.padding = "0.0rem 0rem 0.0rem 0.8rem";
wnd.h2.style.display = 'flex';
// The title of the window. WE set its 'flex' to 1 1 0 so it fills up the titlebar
// and pushes the X button to the very right
- var heading = mk(wnd.h2, 'span');
+ var heading = mk(wnd.h2, 'span', 'wndtitle');
heading.innerText = "Share " + filename;
- heading.style.display = 'flex';
- heading.style.alignItems = 'center';
- heading.style.flex = "1 1 0";
// Close button
var x_button = mk(wnd.h2, 'button', 'close_button');
@@ -970,7 +966,27 @@ function add_file_visuals(fileview) {
const ue = encodeURIComponent(x);
let url = a.url.replace("$content_urlencoded", ue)
.replace("$filename", fileview.filename);
- window.location = url;
+
+ if (a.open_in_iframe) {
+ const wnd = make_window_base([], 10, 10, 800, 600);
+
+ var title = mk(wnd.h2, 'span', 'wndtitle');
+ title.innerText = fileview.filename;
+
+ // Close button
+ var x_button = mk(wnd.h2, 'button', 'close_button');
+ x_button.innerText = "X";
+ x_button.onclick = delete_window;
+
+ const contents = mk(wnd.visuals, 'div', 'filecontentsroot');
+ const iframe = mk(contents, 'iframe');
+ iframe.style.flex = '1 0 0';
+ iframe.src = url;
+
+ focus_window(wnd);
+ } else {
+ window.location = url;
+ }
}, get_path(), fileview.filename);
}]
);