up2k: make confirmation optional

This commit is contained in:
ed 2021-01-29 00:49:35 +01:00
parent 6934c75bba
commit c2d22aa3d1
3 changed files with 19 additions and 2 deletions

View file

@ -201,6 +201,7 @@ function up2k_init(have_crypto) {
var parallel_uploads = cfg_get('nthread');
var multitask = bcfg_get('multitask', true);
var ask_up = bcfg_get('ask_up', true);
var col_hashing = '#00bbff';
var col_hashed = '#004466';
@ -297,7 +298,7 @@ function up2k_init(have_crypto) {
for (var a = 0; a < good_files.length; a++)
msg.push(good_files[a].name);
if (!confirm(msg.join('\n')))
if (ask_up && !confirm(msg.join('\n')))
return;
for (var a = 0; a < good_files.length; a++) {
@ -839,6 +840,11 @@ function up2k_init(have_crypto) {
bcfg_set('multitask', multitask);
}
function tgl_ask_up() {
ask_up = !ask_up;
bcfg_set('ask_up', ask_up);
}
function nop(ev) {
ev.preventDefault();
this.click();
@ -855,6 +861,7 @@ function up2k_init(have_crypto) {
ebi('nthread').addEventListener('input', bumpthread, false);
ebi('multitask').addEventListener('click', tgl_multitask, false);
ebi('ask_up').addEventListener('click', tgl_ask_up, false);
var nodes = ebi('u2conf').getElementsByTagName('a');
for (var a = nodes.length - 1; a >= 0; a--)

View file

@ -194,6 +194,12 @@
#u2conf input+a {
background: #d80;
}
#u2conf input[type="checkbox"]+label {
color: #f5a;
}
#u2conf input[type="checkbox"]:checked+label {
color: #fc5;
}
#u2foot {
color: #fff;
font-style: italic;

View file

@ -43,10 +43,14 @@
<input class="txtbox" id="nthread" value="2" />
<a href="#" id="nthread_add">+</a>
</td>
<td rowspan="2">
<td rowspan="2" style="padding-left:1.5em">
<input type="checkbox" id="multitask" />
<label for="multitask">hash while<br />uploading</label>
</td>
<td rowspan="2">
<input type="checkbox" id="ask_up" />
<label for="ask_up">ask for<br />confirmation</label>
</td>
</tr>
</table>