This repository has been archived on 2024-06-10. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Backend/src/main/resources/templates/paste.html
Liam 1ab282772e
Some checks failed
Publish Docker Image / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Waiting to run
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled
re-enable the cache and make the buttons smaller
2024-06-01 18:33:40 +01:00

54 lines
1.9 KiB
HTML

<!doctype html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title th:text="${title}"></title>
<!-- TailwindCSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Highlight.js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
</head>
<body class="bg-black text-white h-screen relative">
<pre><code class="bg-transparent text-sm" th:text="${paste.content}"></code></pre>
<div class="absolute top-0 right-0 p-3">
<button id="raw-button" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-1 px-2 rounded">
<a th:href="${rawUrl}">
Raw
</a>
</button>
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-1 px-2 rounded">
<a href="/">
New
</a>
</button>
</div>
</body>
<script>
// Highlight the code block
hljs.highlightAll();
// Custom select all behavior to select all the content inside the <pre> block
document.addEventListener('keydown', function(event) {
if (event.ctrlKey && event.key === 'a') {
event.preventDefault(); // Prevent the default select all behavior
// Select all the content inside the <pre> block
const preBlock = document.querySelector('pre');
const range = document.createRange();
range.selectNodeContents(preBlock);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
});
</script>
</html>