paste-bin/templates/view_text.html

52 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ paste.title or 'PasteBin' }} - PasteBin</title>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<div class="container">
<header>
<h1><a href="/">PasteBin</a></h1>
</header>
<div class="paste-view">
{% if paste.title %}
<h2>{{ paste.title }}</h2>
{% endif %}
<div class="meta">
<span>ID: <code>{{ paste_id }}</code></span>
<span>Created: {{ paste.created_at[:19] | replace('T', ' ') }}</span>
{% if paste.expires_at %}
<span>Expires: {{ paste.expires_at[:19] | replace('T', ' ') }}</span>
{% else %}
<span>Never expires</span>
{% endif %}
</div>
<div class="content-wrapper">
<pre><code>{{ paste.data }}</code></pre>
</div>
<div class="actions">
<a href="/{{ paste_id }}/raw" class="btn btn-secondary">Raw</a>
<a href="/{{ paste_id }}/download" class="btn btn-primary">Download</a>
<button class="btn btn-secondary copy-btn" onclick="copyToClipboard()">Copy</button>
</div>
</div>
</div>
<script>
function copyToClipboard() {
const text = document.querySelector('pre code').textContent;
navigator.clipboard.writeText(text).then(() => {
const btn = document.querySelector('.copy-btn');
btn.textContent = 'Copied!';
setTimeout(() => btn.textContent = 'Copy', 2000);
});
}
</script>
</body>
</html>