aboutsummaryrefslogtreecommitdiffstats
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
parenta670aee7f555f6eee6e3ef5d88307b9dae052db1 (diff)
downloadfileup-10a9aa16bb7cfd74e360a183222d8a71d3a52574.tar.gz
Actions part 3 of N, Open in iframe
-rw-r--r--actions.js14
-rw-r--r--css/style.css7
-rw-r--r--loggedin.js28
3 files changed, 36 insertions, 13 deletions
diff --git a/actions.js b/actions.js
index 69912e4..066500e 100644
--- a/actions.js
+++ b/actions.js
@@ -1,9 +1,3 @@
-
-// Patterns in the URL:
-// $fileanme - filename
-// $content_urlencoded - file contents, urlencoded
-// $content_base64 - file contents, base64'd
-
const actions = [
{
"extension": ".txt",
@@ -14,5 +8,11 @@ const actions = [
"extension": ".txt",
"text": "Google search contents",
"url": "https://www.google.com/search?q=$content_urlencoded"
- }
+ },
+ {
+ "extension": ".txt",
+ "text": "ZAMUNDDA TO4KA NET",
+ "url": "https://zamunda.net",
+ "open_in_iframe": "true",
+ },
];
diff --git a/css/style.css b/css/style.css
index ef22be7..3121768 100644
--- a/css/style.css
+++ b/css/style.css
@@ -493,3 +493,10 @@ pre {
background: white;
}
+
+.wndtitle {
+ display: flex;
+ align-items: center;
+ flex: 1 1 0;
+ padding-left: 0.8rem;
+}
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);
}]
);