2022-04-10 22:21:45 +00:00
|
|
|
{% include "header.html" %}
|
2022-07-31 18:41:19 +00:00
|
|
|
<div style="float: left">
|
2022-10-29 11:11:55 +00:00
|
|
|
{% if pasta.content != "No Text Content" %}
|
2022-11-07 18:30:33 +00:00
|
|
|
<button id="copy-text-button" class="copy-button" style="margin-right: 0.5rem">
|
2022-10-29 11:11:55 +00:00
|
|
|
Copy Text
|
|
|
|
</button>
|
2022-11-07 18:30:33 +00:00
|
|
|
{% if args.public_path.to_string() != "" && pasta.pasta_type == "url" %}
|
|
|
|
<button id="copy-redirect-button" class="copy-button" style="margin-right: 0.5rem">
|
|
|
|
Copy Redirect
|
|
|
|
</button>
|
|
|
|
{%- endif %}
|
2023-02-26 23:18:00 +00:00
|
|
|
<a style="margin-right: 1rem" href="{{ args.public_path }}/{{ args.raw_endpoint }}/{{pasta.id_as_animals()}}">Raw Text
|
2022-10-29 11:11:55 +00:00
|
|
|
Content</a>
|
|
|
|
{%- endif %}
|
|
|
|
{% if args.qr && args.public_path.to_string() != "" %}
|
|
|
|
<a style="margin-right: 1rem" href="{{ args.public_path }}/qr/{{pasta.id_as_animals()}}">QR</a>
|
2022-07-31 18:41:19 +00:00
|
|
|
{%- endif %}
|
|
|
|
{% if pasta.editable %}
|
2022-10-29 11:11:55 +00:00
|
|
|
<a style="margin-right: 1rem" href="{{ args.public_path }}/edit/{{pasta.id_as_animals()}}">Edit</a>
|
2022-07-31 18:41:19 +00:00
|
|
|
{%- endif %}
|
2022-10-29 11:11:55 +00:00
|
|
|
<a style="margin-right: 1rem" href="{{ args.public_path }}/remove/{{pasta.id_as_animals()}}">Remove</a>
|
2022-07-31 18:41:19 +00:00
|
|
|
</div>
|
|
|
|
<div style="float: right">
|
2022-10-29 11:11:55 +00:00
|
|
|
<a style="margin-right: 0.5rem"
|
2023-03-04 00:02:17 +00:00
|
|
|
href="{{ args.public_path }}/{{ args.pasta_endpoint }}/{{pasta.id_as_animals()}}"><i>{{pasta.id_as_animals()}}</i></a>
|
2022-10-29 11:11:55 +00:00
|
|
|
{% if args.public_path.to_string() != "" %}
|
2022-11-07 18:30:33 +00:00
|
|
|
<button id="copy-url-button" class="copy-button" style="margin-right: 0">
|
2022-10-29 11:11:55 +00:00
|
|
|
Copy URL
|
2022-10-27 11:12:11 +00:00
|
|
|
</button>
|
2022-10-29 11:11:55 +00:00
|
|
|
{%- endif %}
|
2022-07-31 18:41:19 +00:00
|
|
|
</div>
|
2022-10-29 11:11:55 +00:00
|
|
|
{% if pasta.file.is_some() %}
|
|
|
|
<br>
|
2022-07-31 18:41:19 +00:00
|
|
|
<br>
|
2023-02-26 23:47:40 +00:00
|
|
|
{% if pasta.file.as_ref().unwrap().is_image() %}
|
|
|
|
<img src="{{ args.public_path }}/file/{{pasta.id_as_animals()}}/{{pasta.file.as_ref().unwrap().name()}}" alt="">
|
|
|
|
<br>
|
|
|
|
{%- endif %}
|
2022-10-29 11:11:55 +00:00
|
|
|
<a href="{{ args.public_path }}/file/{{pasta.id_as_animals()}}/{{pasta.file.as_ref().unwrap().name()}}" download>
|
|
|
|
Download attached file: '{{pasta.file.as_ref().unwrap().name()}}' [{{pasta.file.as_ref().unwrap().size}}]
|
|
|
|
</a>
|
|
|
|
{%- endif %}
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
{% if pasta.content != "No Text Content" %}
|
2022-10-01 05:37:26 +00:00
|
|
|
<div class="code-container">
|
|
|
|
<div style="clear: both;">
|
|
|
|
{% if args.highlightsyntax %}
|
|
|
|
<pre><code id="code">{{pasta.content_syntax_highlighted()}}</code></pre>
|
|
|
|
{%- else %}
|
|
|
|
<pre><code id="code">{{pasta.content_not_highlighted()}}</code></pre>
|
|
|
|
{%- endif %}
|
|
|
|
</div>
|
2022-07-31 18:41:19 +00:00
|
|
|
</div>
|
2022-10-29 11:11:55 +00:00
|
|
|
{%- endif %}
|
|
|
|
<div>
|
2022-11-01 18:56:07 +00:00
|
|
|
{% if pasta.read_count == 1 %}
|
|
|
|
<p style="font-size: small">Read {{pasta.read_count}} time, last {{pasta.last_read_time_ago_as_string()}}</p>
|
|
|
|
{%- else %}
|
2022-10-29 11:11:55 +00:00
|
|
|
<p style="font-size: small">Read {{pasta.read_count}} times, last {{pasta.last_read_time_ago_as_string()}}</p>
|
2022-11-01 18:56:07 +00:00
|
|
|
{%- endif %}
|
|
|
|
|
2022-10-29 11:11:55 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
2022-10-01 05:37:26 +00:00
|
|
|
|
|
|
|
<script>
|
2022-10-29 11:11:55 +00:00
|
|
|
const copyURLBtn = document.getElementById("copy-url-button")
|
|
|
|
const copyTextBtn = document.getElementById("copy-text-button")
|
2022-11-07 18:30:33 +00:00
|
|
|
const copyRedirectBtn = document.getElementById("copy-redirect-button")
|
2022-10-02 04:50:05 +00:00
|
|
|
const content = `{{ pasta.content_escaped() }}`
|
2023-02-26 23:18:00 +00:00
|
|
|
const url = `{{ args.public_path }}/{{ args.pasta_endpoint }}/{{pasta.id_as_animals()}}`
|
|
|
|
const redirect_url = `{{ args.public_path }}/{{ args.url_endpoint }}/{{pasta.id_as_animals()}}`
|
2022-10-29 11:11:55 +00:00
|
|
|
|
|
|
|
copyURLBtn.addEventListener("click", () => {
|
|
|
|
navigator.clipboard.writeText(url)
|
|
|
|
copyURLBtn.innerHTML = "Copied"
|
|
|
|
setTimeout(() => {
|
|
|
|
copyURLBtn.innerHTML = "Copy URL"
|
|
|
|
}, 1000)
|
|
|
|
})
|
2022-10-01 05:37:26 +00:00
|
|
|
|
2022-11-07 18:30:33 +00:00
|
|
|
// it will be undefined when the element does not exist on non-url pastas
|
|
|
|
if (copyRedirectBtn) {
|
|
|
|
copyRedirectBtn.addEventListener("click", () => {
|
|
|
|
navigator.clipboard.writeText(redirect_url)
|
|
|
|
copyRedirectBtn.innerHTML = "Copied"
|
|
|
|
setTimeout(() => {
|
|
|
|
copyRedirectBtn.innerHTML = "Copy Redirect"
|
|
|
|
}, 1000)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-10-29 11:11:55 +00:00
|
|
|
copyTextBtn.addEventListener("click", () => {
|
2022-10-01 05:37:26 +00:00
|
|
|
navigator.clipboard.writeText(content)
|
2022-10-29 11:11:55 +00:00
|
|
|
copyTextBtn.innerHTML = "Copied"
|
2022-10-22 18:12:15 +00:00
|
|
|
setTimeout(() => {
|
2022-10-29 11:11:55 +00:00
|
|
|
copyTextBtn.innerHTML = "Copy Text"
|
2022-10-22 18:12:15 +00:00
|
|
|
}, 1000)
|
2022-10-01 05:37:26 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2022-06-03 16:24:34 +00:00
|
|
|
<style>
|
2022-10-27 11:12:11 +00:00
|
|
|
code-line {
|
|
|
|
counter-increment: listing;
|
|
|
|
text-align: right;
|
|
|
|
float: left;
|
|
|
|
clear: left;
|
|
|
|
}
|
2022-06-03 16:24:34 +00:00
|
|
|
|
2022-10-27 11:12:11 +00:00
|
|
|
code-line::before {
|
|
|
|
content: counter(listing);
|
|
|
|
display: inline-block;
|
|
|
|
padding-left: auto;
|
|
|
|
margin-left: auto;
|
|
|
|
text-align: left;
|
|
|
|
width: 1.6rem;
|
|
|
|
border-right: 1px solid lightgrey;
|
|
|
|
color: grey;
|
|
|
|
margin-right: 0.4rem;
|
|
|
|
-webkit-user-select: none;
|
|
|
|
-moz-user-select: none;
|
|
|
|
-ms-user-select: none;
|
|
|
|
user-select: none;
|
|
|
|
}
|
2022-06-03 16:24:34 +00:00
|
|
|
|
2022-10-27 11:12:11 +00:00
|
|
|
#code {
|
|
|
|
min-height: 2rem;
|
|
|
|
}
|
2022-10-01 05:37:26 +00:00
|
|
|
|
2022-10-27 11:12:11 +00:00
|
|
|
.code-container {
|
|
|
|
position: relative;
|
|
|
|
}
|
2022-10-02 04:50:05 +00:00
|
|
|
|
2022-10-27 11:12:11 +00:00
|
|
|
.hidden {
|
|
|
|
display: none;
|
|
|
|
}
|
2022-10-01 05:37:26 +00:00
|
|
|
|
2022-11-07 18:30:33 +00:00
|
|
|
.copy-button {
|
2022-10-27 11:12:11 +00:00
|
|
|
font-size: small;
|
|
|
|
padding: 4px;
|
2022-11-07 18:30:33 +00:00
|
|
|
padding-left: 0.8rem;
|
|
|
|
padding-right: 0.8rem;
|
2022-10-27 11:12:11 +00:00
|
|
|
}
|
2022-06-03 16:24:34 +00:00
|
|
|
</style>
|
2022-05-02 15:53:10 +00:00
|
|
|
|
2023-02-17 10:28:09 +00:00
|
|
|
{% include "footer.html" %}
|