commit
832894ed7d
41
index.js
41
index.js
@ -56,6 +56,9 @@ function convertBinaryStringToUint8Array(bStr) {
|
|||||||
|
|
||||||
function handleFileSelect(evt) {
|
function handleFileSelect(evt) {
|
||||||
var file = evt.target.files[0];
|
var file = evt.target.files[0];
|
||||||
|
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
|
|
||||||
reader.onload = (function(theFile) {
|
reader.onload = (function(theFile) {
|
||||||
@ -264,34 +267,39 @@ function validate_program_inputs() {
|
|||||||
var fileObj = row.cells[1].childNodes[0];
|
var fileObj = row.cells[1].childNodes[0];
|
||||||
fileData = fileObj.data;
|
fileData = fileObj.data;
|
||||||
if (fileData == null)
|
if (fileData == null)
|
||||||
return "No file selected for row: " + index + "!";
|
return "No file selected for row " + index + "!";
|
||||||
|
|
||||||
}
|
}
|
||||||
return "success"
|
return "success"
|
||||||
}
|
}
|
||||||
|
|
||||||
programButton.onclick = async () => {
|
programButton.onclick = async () => {
|
||||||
var err = validate_program_inputs();
|
const alertMsg = document.getElementById("alertmsg");
|
||||||
|
const err = validate_program_inputs();
|
||||||
|
|
||||||
if (err != "success") {
|
if (err != "success") {
|
||||||
const alertMsg = document.getElementById("alertmsg");
|
|
||||||
alertMsg.innerHTML = "<strong>" + err + "</strong>";
|
alertMsg.innerHTML = "<strong>" + err + "</strong>";
|
||||||
alertDiv.style.display = "block";
|
alertDiv.style.display = "block";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let fileArray = [];
|
// Hide error message
|
||||||
let offset = 0x1000;
|
alertDiv.style.display = "none";
|
||||||
var rowCount = table.rows.length;
|
|
||||||
var row;
|
const fileArray = [];
|
||||||
const progressBars = [];
|
const progressBars = [];
|
||||||
for (let index = 1; index < rowCount; index ++) {
|
|
||||||
row = table.rows[index];
|
|
||||||
var offSetObj = row.cells[0].childNodes[0];
|
|
||||||
offset = parseInt(offSetObj.value);
|
|
||||||
|
|
||||||
var fileObj = row.cells[1].childNodes[0];
|
for (let index = 1; index < table.rows.length; index++) {
|
||||||
|
const row = table.rows[index];
|
||||||
|
|
||||||
progressBars.push(row.cells[2].childNodes[0]);
|
const offSetObj = row.cells[0].childNodes[0];
|
||||||
|
const offset = parseInt(offSetObj.value);
|
||||||
|
|
||||||
|
const fileObj = row.cells[1].childNodes[0];
|
||||||
|
const progressBar = row.cells[2].childNodes[0];
|
||||||
|
|
||||||
|
progressBar.value = 0;
|
||||||
|
progressBars.push(progressBar);
|
||||||
|
|
||||||
row.cells[2].style.display = "initial";
|
row.cells[2].style.display = "initial";
|
||||||
row.cells[3].style.display = "none";
|
row.cells[3].style.display = "none";
|
||||||
@ -312,9 +320,10 @@ programButton.onclick = async () => {
|
|||||||
console.error(e);
|
console.error(e);
|
||||||
term.writeln(`Error: ${e.message}`);
|
term.writeln(`Error: ${e.message}`);
|
||||||
} finally {
|
} finally {
|
||||||
for (let index = 1; index < rowCount; index ++) {
|
// Hide progress bars and show erase buttons
|
||||||
row.cells[2].style.display = "none";
|
for (let index = 1; index < table.rows.length; index++) {
|
||||||
row.cells[3].style.display = "initial";
|
table.rows[index].cells[2].style.display = "none";
|
||||||
|
table.rows[index].cells[3].style.display = "initial";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user