Skip to content
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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Add share button to preview #15

wants to merge 8 commits into from

Conversation

Xwilarg
Copy link
Member

@Xwilarg Xwilarg commented Sep 11, 2024

No description provided.

@Xwilarg Xwilarg marked this pull request as ready for review September 11, 2024 11:05
@@ -153,6 +153,7 @@ private function readDirectory(string $directory, mixed $config): array|false
array_push($files,
[
"name" => $name,
"share" => urlencode($name),
Copy link
Member

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) {
Copy link
Member

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.

Comment on lines +70 to +71
const nodes = document.querySelectorAll(".path > a")
const dir = nodes[nodes.length - 1]
Copy link
Member

@TheIndra55 TheIndra55 Sep 12, 2024

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}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL encode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants