mirror of
https://github.com/rikkaneko/paste.git
synced 2025-06-06 16:45:41 +00:00
Populate original file name
Signed-off-by: Joe Ma <rikkaneko23@gmail.com>
This commit is contained in:
parent
4408b4027b
commit
5cef3755b3
1 changed files with 4 additions and 3 deletions
|
@ -61,7 +61,7 @@
|
||||||
<label for="title_input">Title: </label>
|
<label for="title_input">Title: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="title_input" type="text" name="title" spellcheck="false">
|
<input id="title_input" type="text" name="title" spellcheck="false" style="width: 20em">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
<label for="pass_input">Password: </label>
|
<label for="pass_input">Password: </label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input id="pass_input" type="password" name="pass">
|
<input id="pass_input" type="password" name="pass" style="width: 20em">
|
||||||
<input id="show_pass_button" type="checkbox">
|
<input id="show_pass_button" type="checkbox">
|
||||||
<label for="show_pass_button">Show</label>
|
<label for="show_pass_button">Show</label>
|
||||||
</td>
|
</td>
|
||||||
|
@ -96,7 +96,6 @@
|
||||||
<input id="sumbit_form_button" type="submit" value="Sumbit" style="font-size: 14px"> (<span
|
<input id="sumbit_form_button" type="submit" value="Sumbit" style="font-size: 14px"> (<span
|
||||||
id="file_stats">0 bytes</span>)
|
id="file_stats">0 bytes</span>)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -107,6 +106,7 @@
|
||||||
|
|
||||||
function update_file_status() {
|
function update_file_status() {
|
||||||
const status = document.getElementById('file_stats');
|
const status = document.getElementById('file_stats');
|
||||||
|
const title = document.getElementById('title_input');
|
||||||
if (this.files[0] === undefined) {
|
if (this.files[0] === undefined) {
|
||||||
status.textContent = '0 bytes';
|
status.textContent = '0 bytes';
|
||||||
return;
|
return;
|
||||||
|
@ -117,6 +117,7 @@
|
||||||
for (let i = 0, approx = bytes / 1024; approx > 1; approx /= 1024, i++) {
|
for (let i = 0, approx = bytes / 1024; approx > 1; approx /= 1024, i++) {
|
||||||
size = approx.toFixed(3) + ' ' + units[i];
|
size = approx.toFixed(3) + ' ' + units[i];
|
||||||
}
|
}
|
||||||
|
title.value = this.files[0]?.name || '';
|
||||||
status.textContent = `${this.files[0]?.type || 'application/octet-stream'}, ${size}`;
|
status.textContent = `${this.files[0]?.type || 'application/octet-stream'}, ${size}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue