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 copy URL button to view paste page #166

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/asset/pinnwand.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ section.paste-submit {
}

div.file-meta button,
section.paste-submit button {
section.paste-submit button,
.copyurl {
box-sizing: border-box;
border: .0625rem solid var(--color3);
padding: .4rem 1.4rem;
Expand All @@ -164,7 +165,8 @@ section.paste-submit button {
}

div.file-meta button:hover,
section.paste-submit button:hover {
section.paste-submit button:hover,
.copyurl:hover {
color: var(--color3);
background: var(--color1);
border: .0625rem solid var(--color3);
Expand Down
6 changes: 4 additions & 2 deletions src/pinnwand/static/pinnwand.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ section.paste-submit {
padding: .5rem; }

div.file-meta button,
section.paste-submit button {
section.paste-submit button,
.copyurl {
box-sizing: border-box;
border: 0.0625rem solid var(--color3);
padding: .4rem 1.4rem;
Expand All @@ -133,7 +134,8 @@ section.paste-submit button {
text-align: center; }

div.file-meta button:hover,
section.paste-submit button:hover {
section.paste-submit button:hover,
.copyurl:hover {
color: var(--color3);
background: var(--color1);
border: 0.0625rem solid var(--color3); }
Expand Down
6 changes: 6 additions & 0 deletions src/pinnwand/static/pinnwand.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ function setupShowPage() {
});
};

let shareButton = document.getElementById("copyurl-btn");

Copy link
Owner

Choose a reason for hiding this comment

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

I think this needs a null check or coalesce before continuing into the event listener below.

shareButton.addEventListener("click", function(event) {
navigator.clipboard.writeText(window.location.href);
});

return false;
}

Expand Down
1 change: 1 addition & 0 deletions src/pinnwand/template/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<a href="mailto:{{ handler.application.configuration.report_email }}?subject=Pinnwand report (File ID: {{ file.slug }})">Report</a> this file.
{% end %}
</div>
<button class="copyurl" id="copyurl-btn">Copy URL</button>
</div>
{% end %}
</div>
Expand Down