Skip to content

Commit

Permalink
Use innerText instead of innerHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
leoarc committed Jun 6, 2020
1 parent 1b98048 commit 5b67bee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
35 changes: 18 additions & 17 deletions apps/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ function uploadModel() {
var submit = document.querySelector('#submit');

// Reset previous input
_name.value = _classes.value = topology.value = weights.value = status.innerHTML = _imageSize.value = url.value = '';
_name.value = _classes.value = topology.value = weights.value = status.innerText = _imageSize.value = url.value = '';

$UI.uploadModal.open();

Expand All @@ -719,7 +719,7 @@ function uploadModel() {

if ( _name.value && _classes.value && _imageSize.value &&
((!toggle.checked && topology.files[0].name.split('.').pop() == 'json') || (toggle.checked && url))) {
status.innerHTML = 'Uploading';
status.innerText = 'Uploading';
status.classList.remove('error');
status.classList.add('blink');

Expand All @@ -742,7 +742,7 @@ function uploadModel() {
throw new Error('Model name repeated');
}
} catch (e) {
status.innerHTML = 'Model with the same name already exists. Please choose a new name';
status.innerText = 'Model with the same name already exists. Please choose a new name';
status.classList.remove('blink');
console.log(e);
document.getElementById('name').style = 'border:2px; border-style: solid; border-color: red;';
Expand All @@ -757,7 +757,7 @@ function uploadModel() {
tf.ones([1, parseInt(_imageSize.value), parseInt(_imageSize.value), parseInt(_channels)]));
result.dispose();
} catch (e) {
status.innerHTML = 'Model failed on the given values of patch size.' +
status.innerText = 'Model failed on the given values of patch size.' +
'Please input values on which the model was trained.';
console.log(e);
status.classList.remove('blink');
Expand Down Expand Up @@ -794,7 +794,7 @@ function uploadModel() {
initUIcomponents();
};
req.onerror = function(e) {
status.innerHTML = 'Some error this way!';
status.innerText = 'Some error this way!';
console.log(e);
status.classList.remove('blink');
};
Expand All @@ -804,13 +804,13 @@ function uploadModel() {
status.classList.remove('blink');
if (toggle.checked) status.innerHTML = 'Please enter a valid URL.';
else {
status.innerHTML = 'Please enter a valid model.' +
status.innerText = 'Please enter a valid model.' +
'Input model.json in first input and all weight binaries in second one without renaming.';
}
console.error(e);
}
} else {
status.innerHTML = 'Please fill out all the fields with valid values.';
status.innerText = 'Please fill out all the fields with valid values.';
status.classList.add('error');
console.error(e);
}
Expand Down Expand Up @@ -876,15 +876,15 @@ async function showInfo() {
classes = (e.target.result.classes.join(', '));
inputShape = e.target.result.input_shape.slice(1, 3).join('x');
td = row.insertCell();
td.innerHTML = name.split('/').pop().split('_').splice(2).join('_').slice(0, -3);
td.innerText = name.split('/').pop().split('_').splice(2).join('_').slice(0, -3);
td = row.insertCell();
td.innerHTML = classes;
td.innerText = classes;
td = row.insertCell();
td.innerHTML = inputShape;
td.innerText = inputShape;
td = row.insertCell();
td.innerHTML = +size.toFixed(2);
td.innerText = +size.toFixed(2);
td = row.insertCell();
td.innerHTML = date;
td.innerText = date;
td = row.insertCell();
td.innerHTML = '<button class="btn-del" '+
'id=removeModel'+ modelCount+' type="button"><i class="material-icons"'+
Expand Down Expand Up @@ -1080,6 +1080,7 @@ async function selectModel() {
var store = tx.objectStore('models_store');
var modelCount=0;
empty(table);
console.log(data);

// Update table data
(function(callback) {
Expand All @@ -1098,15 +1099,15 @@ async function selectModel() {
classes = (e.target.result.classes.join(', '));
inputShape = e.target.result.input_shape.slice(1, 3).join('x');
td = row.insertCell();
td.innerHTML = name.split('/').pop().split('_').splice(2).join('_').slice(0, -3);
td.innerText = name.split('/').pop().split('_').splice(2).join('_').slice(0, -3);
td = row.insertCell();
td.innerHTML = classes;
td.innerText = classes;
td = row.insertCell();
td.innerHTML = inputShape;
td.innerText = inputShape;
td = row.insertCell();
td.innerHTML = +size.toFixed(2);
td.innerText = +size.toFixed(2);
td = row.insertCell();
td.innerHTML = date;
td.innerText = date;
td = row.insertCell();
td.innerHTML = '<button class="btn-sel"'+
'id=selectModel'+ modelCount+' type="button"><i class="material-icons">done</i></button>';
Expand Down
2 changes: 1 addition & 1 deletion apps/segment/segment.js
Original file line number Diff line number Diff line change
Expand Up @@ -1389,4 +1389,4 @@ function downloadCSV(data, filename) {
link.setAttribute('href', data);
link.setAttribute('download', filename);
link.click();
}
}

0 comments on commit 5b67bee

Please sign in to comment.