-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add share button to preview #15
base: master
Are you sure you want to change the base?
Conversation
@@ -153,6 +153,7 @@ private function readDirectory(string $directory, mixed $config): array|false | |||
array_push($files, | |||
[ | |||
"name" => $name, | |||
"share" => urlencode($name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems redundant, we already have the name and url encoding it should be done by the link builder.
@@ -333,6 +334,10 @@ public function render(string $directory): string | |||
} | |||
} | |||
|
|||
if (urlencode($f["name"]) === $preview) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opening brace on new line.
const nodes = document.querySelectorAll(".path > a") | ||
const dir = nodes[nodes.length - 1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Surely there's a better way to get the directory, like from the URL
document.getElementById("share").addEventListener("click", _ => { | ||
const nodes = document.querySelectorAll(".path > a") | ||
const dir = nodes[nodes.length - 1] | ||
const url = `${window.location.origin}${window.location.pathname}?dir=${dir.innerHTML}&share=${shareName}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URL encode
No description provided.