50 lines
1.6 KiB
HTML
50 lines
1.6 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<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>Paste</title>
|
|
|
|
<!-- TailwindCSS -->
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
</head>
|
|
<body class="bg-black text-white">
|
|
<div class="p-3 h-screen w-screen relative">
|
|
<div class="flex gap-2 h-full w-full text-xs">
|
|
<p class="hidden md:block">></p>
|
|
<textarea
|
|
id="paste-input"
|
|
class="w-full h-full bg-background outline-none resize-none bg-transparent"
|
|
placeholder="Paste your code here..."></textarea>
|
|
</div>
|
|
|
|
<div class="absolute top-0 right-0 p-3">
|
|
<button id="paste-button" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-1 px-2 rounded">
|
|
Paste
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
<!-- Paste Script -->
|
|
<script>
|
|
document.getElementById('paste-button').addEventListener('click', function() {
|
|
var pasteInput = document.getElementById('paste-input');
|
|
var paste = pasteInput.value;
|
|
|
|
fetch('/api/upload', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'text/plain'
|
|
},
|
|
body: paste
|
|
}).then(function(response) {
|
|
return response.json();
|
|
}).then(function(data) {
|
|
window.location.href = '/' + data.id;
|
|
});
|
|
});
|
|
</script>
|
|
</html> |