Add custom file title

Remove redundant API_SPEC_TEXT

Update paste.html formatting style

Fix bugs

Fix typo

Signed-off-by: Joe Ma <rikkaneko23@gmail.com>
This commit is contained in:
Joe Ma 2022-10-15 13:56:31 +08:00
parent 3562fe2d24
commit 1bf8f08ee6
No known key found for this signature in database
GPG key ID: 7A0ECF5F5EDC587F
5 changed files with 80 additions and 105 deletions

View file

@ -34,51 +34,75 @@
The source code is available in my GitHub repository <a href="https://github.com/rikkaneko/paste">[here]</a>.<br>
This webpage is designed for upload files only.
For other operations like changing paste settings and deleting paste, please make use of the
<a href="https://pb.nekoul.com/api">API call</a> with <a href="https://wiki.archlinux.org/title/CURL">curl</a>.
<a href="https://github.com/rikkaneko/paste#api-specification">API call</a> with <a
href="https://wiki.archlinux.org/title/CURL">curl</a>.
</p>
<form id="upload_file_form" action="https://pb.nekoul.com" method="POST" enctype=multipart/form-data>
<div>
<div>
<h4>Upload file</h4>
<input id="upload_file" type="file" name="u">
<input id="upload_file" type="file" name="u" style="font-size: 14px">
</div>
<div>
<h4>Upload text</h4>
<textarea id="text_input" style="width: 30%; max-width: 100%; " rows="5" cols="50"
name="u" placeholder="Paste text or URL link here..." spellcheck="false"></textarea>
</div>
<div>
<h4>Settings</h4>
<label for="pass_input">Password: </label>
<input id="pass_input" type="password" name="pass" style="margin-left: 7px;">
<input id="show_pass_button" type="checkbox">
<label for="show_pass_button">Show</label>
</div>
<div style="margin-top: 1px;">
<label for="read_limit_input">Read limit: </label>
<input id="read_limit_input" type="number" name="read-limit" min="1" style="margin-left: 2px; width: 3em">
</div>
<div style="margin-top: 2px;">
<input id="show_qr_checkbox" type="checkbox" name="qrcode" checked>
<label for="show_qr_checkbox">Show QR code on sumbitted</label>
</div>
<div>
<input id="gen_link" type="checkbox" name="paste-type" value="link">
<label for="gen_link">Generate as shorten URL link</label>
</div>
<br>
<div>
<input id="reset_button" type="reset" value="Reset">
<input id="sumbit_form_button" type="submit" value="Sumbit"> (<span id="file_stats">0 bytes</span>)
<div>
<textarea id="text_input"
style="width: 50%; max-width: 80%; font-size: 14px; margin-top: 2px"
rows="10" name="u" spellcheck="false"></textarea><br>
(<span id="text_length">0 characters</span>)
</div>
</div>
<h4>Settings</h4>
<table style="padding-bottom: 2px;">
<tr>
<td>
<label for="title_input">Title: </label>
</td>
<td>
<input id="title_input" type="text" name="title" spellcheck="false">
</td>
</tr>
<tr>
<td>
<label for="pass_input">Password: </label>
</td>
<td>
<input id="pass_input" type="password" name="pass">
<input id="show_pass_button" type="checkbox">
<label for="show_pass_button">Show</label>
</td>
</tr>
<tr>
<td>
<label for="read_limit_input">Read limit: </label>
</td>
<td>
<input id="read_limit_input" type="number" name="read-limit" min="1" style="width: 3em">
</td>
</tr>
</table>
<input id="show_qr_checkbox" type="checkbox" name="qrcode" checked>
<label for="show_qr_checkbox">Show QR code on sumbitted</label>
</div>
<div>
<input id="gen_link" type="checkbox" name="paste-type" value="link">
<label for="gen_link">Generate as shorten URL link</label>
</div>
<br>
<div>
<input id="reset_button" type="reset" value="Reset" style="font-size: 14px">
<input id="sumbit_form_button" type="submit" value="Sumbit" style="font-size: 14px"> (<span
id="file_stats">0 bytes</span>)
</div>
</div>
</form>
<script>
function update_textarea() {
this.style.height = 'auto';
this.style.height = this.scrollHeight + 'px';
const length = document.getElementById('text_length');
length.textContent = `${this.value.length} characters`;
}
function update_file_status() {
@ -111,8 +135,8 @@
for (let i = 0; i < elements.length; i++) {
elements[i].disabled = false;
}
let size = document.getElementById('file_size');
size.innerHTML = '0 bytes';
let size = document.getElementById('file_stats');
size.textContent = '0 bytes';
}
function handle_submit_form(event) {
@ -144,7 +168,7 @@
document.getElementById('upload_file_form').addEventListener('submit', handle_submit_form, false);
</script>
<br>
<a href="https://nekoul.com">[Homepage]</a><a href="https://pb.nekoul.com/api">[API]</a>
<a href="https://nekoul.com">[Homepage]</a><a href="https://github.com/rikkaneko/paste#api-specification">[API]</a>
<p>&copy; 2022 rikkaneko</p>
</body>
</html>