update: fixed unwanted overwriting

This commit is contained in:
2025-09-03 12:23:41 +08:00
parent 5990ddbaca
commit 41df5739c3
6 changed files with 110 additions and 92 deletions

View File

@@ -90,8 +90,8 @@
<input id="max_occurrence" class="inactive pure-u-23-24" type="number" min="0" value="5" disabled/>
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="retry">Retry</label>
<input id="retry" class="pure-u-23-24" type="number" min="0"/>
<label for="attempts">Attempts</label>
<input id="attempts" class="pure-u-23-24" type="number" min="1"/>
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="locale">Locale</label>
@@ -230,13 +230,13 @@ $$$('#send', 'click', async (e) => {
switch (Status) {
case 'STANDBY':
Connection.send('RESUME');
$('#send > span.text').innerHTML = 'Pause';
$('#send > span.text').innerText = 'Pause';
$('#send > span.icon').classList.remove('hidden');
$('#send').disabled = true;
break;
case 'RUNNING':
Connection.send('ONHOLD');
$('#send > span.text').innerHTML = 'Resume';
$('#send > span.text').innerText = 'Resume';
$('#send > span.icon').classList.add('hidden');
$('#send').disabled = true;
break;
@@ -267,7 +267,7 @@ $$$('#send', 'click', async (e) => {
Status = 'RUNNING';
Timer.setTimestamp(true);
$('#send > span.text').innerHTML = 'Pause';
$('#send > span.text').innerText = 'Pause';
$('#send > span.icon').classList.remove('hidden');
$('#skip').disabled = false;
break;
@@ -298,8 +298,8 @@ $$$('#send', 'click', async (e) => {
Connection.send(buffer);
Status = 'READY';
$('#fileLabel').innerHTML = file.name;
$('#send > span.text').innerHTML = 'Send';
$('#fileLabel').innerText = file.name;
$('#send > span.text').innerText = 'Send';
$('#cancel').disabled = false;
$('#send').disabled = true;
} finally {
@@ -433,7 +433,7 @@ function main(url, parameters, locales) {
break;
case 'setSubject':
let [subject] = args;
$('#subjectLabel').innerHTML = subject;
$('#subjectLabel').innerText = subject;
break;
case 'setMetadata':
[Limit, Columns] = args;
@@ -454,8 +454,8 @@ function main(url, parameters, locales) {
break;
case 'setProgress':
let [index, name, recipient, sent, warnings, errors] = args;
let label = name ? `${name} <${recipient}>` : recipient;
$('#recipientLabel').innerHTML = label;
let label = name ? `${name}<${recipient}>` : recipient;
$('#recipientLabel').innerText = label;
$('#progressLabel').dataset.sent = sent;
$('#progressLabel').dataset.index = index;
$('#progressLabel').dataset.errors = errors;
@@ -477,7 +477,7 @@ function main(url, parameters, locales) {
break;
case 'FAILED':
Status = 'STANDBY';
$('#send > span.text').innerHTML = 'Resume';
$('#send > span.text').innerText = 'Resume';
$('#send > span.icon').classList.add('hidden');
break;
case 'FINISH':
@@ -485,7 +485,7 @@ function main(url, parameters, locales) {
alert(`${sent||0} Sent; ${warnings||0} Warning(s); ${errors||0} Error(s)`);
case 'CANCEL':
Status = null;
$('#send > span.text').innerHTML = 'Open';
$('#send > span.text').innerText = 'Open';
$('#send > span.icon').classList.add('hidden');
$('#cancel').disabled = true;
$('#skip').disabled = true;
@@ -518,22 +518,22 @@ function main(url, parameters, locales) {
let city = timezone.split('/')[1];
let date = dayjs().tz(timezone).format("YYYY-MM-DD HH:mm:ss");
$('#timezoneLabel').innerHTML = `${date} (${city})`;
$('#statusLabel').innerHTML = Status ? Status.charAt(0).toUpperCase() + Status.slice(1).toLowerCase() : 'Idle';
$('#timezoneLabel').innerText = `${date} (${city})`;
$('#statusLabel').innerText = Status ? Status.charAt(0).toUpperCase() + Status.slice(1).toLowerCase() : 'Idle';
if (Status === 'RUNNING') {
let index = Number($('#progressLabel').dataset.index) || 0;
let limit = Number($('#subcategory').dataset.limit) || Limit;
let percentage = parseFloat((index / limit * 100).toFixed(2));
$('#progressLabel').innerHTML = `${index} / ${limit} (${percentage} %)`;
$('#progressLabel').innerText = `${index} / ${limit} (${percentage} %)`;
let uptime = Timer.getTimedelta();
$('#uptimeLabel').innerHTML = uptime.format("HH:mm:ss");
$('#uptimeLabel').innerText = uptime.format("HH:mm:ss");
let rate = Number($('#progressLabel').dataset.sent) / uptime.asSeconds();
let spm = parseFloat(Number(rate*60).toFixed(2));
$('#remainingLabel').innerHTML = rate > 0 ? `<span>${dayjs.duration((limit - index) / rate, 'second').humanize()}</span>` : '';
$('#remainingLabel').innerHTML += spm >= 1 ? `<span class="${spm > 8.33 ? 'rate warning' : 'rate'}">${spm} per minute</span>` : '';
$('#remainingLabel').innerText = rate > 0 ? `<span>${dayjs.duration((limit - index) / rate, 'second').humanize()}</span>` : '';
$('#remainingLabel').innerText += spm >= 1 ? `<span class="${spm > 8.33 ? 'rate warning' : 'rate'}">${spm} per minute</span>` : '';
}
}, 500);
}