From b6ad2bd2f2a65e069261c4e8b26df94b7cbf7d24 Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Mon, 15 Feb 2021 13:07:49 +0200 Subject: Close button for windows --- loggedin.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'loggedin.js') diff --git a/loggedin.js b/loggedin.js index effc880..c7be090 100644 --- a/loggedin.js +++ b/loggedin.js @@ -816,11 +816,17 @@ function download_file(in_file, filename) { // make_window creates an explorer window - the kind that can list directories/open files -function make_window(pwd) { +function make_window(pwd, has_close) { var wnd = make_window_base(pwd, 100, 100, 800, 600); path = mk(wnd.h2, 'div', 'path'); + if (has_close) { + var x_button = mk(wnd.h2, 'button', 'close_button'); + x_button.innerText = "X"; + x_button.onclick = delete_window; + } + // wnd.foldercontents is where the FileViews will be stored // it also has a subheader (h3) with 'Upload' and 'New FOlder' buttons { @@ -917,7 +923,7 @@ function add_file_visuals(fileview) { ['Open in New Window', () => { var new_pwd = focus.pwd.slice(); new_pwd.push(fileview.filename); - var new_wnd = make_window(new_pwd); + var new_wnd = make_window(new_pwd, true); focus_window(new_wnd); openfile(fileview.is_directory); }], -- cgit v1.2.3