Free javascript Hosting


lancanotas.js

Uploaded on Nov 18 2021 19:10 by franciscogomes

var tmpArray = document.querySelectorAll('table td div input');
if (tmpArray[0] == null) { alert(`Para uso no SIAEP-MA`); throw new Error("Saindo.."); } else if (!confirm('Continua?')) throw new Error("Saindo..");
var tabelaGrid = document.querySelector('.table');
const endpoint1 = `https://script.google.com/macros/s/AKfycbxFz_Nfbju7Zy4dp7QQpNCMQQclJtZ-biC7rqoLSGEIPGEIpIQ/exec`;
fetch(endpoint1)
.then(res => res.text())
.then(data => {
const json = JSON.parse(data); const nome = []; const nota = []; const rows = json.GoogleSheetData; flag = 0; var nn = '';
icol = document.getElementById("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_drpAvaliacao").selectedIndex;
rows.forEach((row) => {
nome.push(row[0]); nn = row[icol].toString().replace('-', '');
if (nn != '') { nn = (((Math.round(row[icol] * 100) / 100).toFixed(2)).replace(".", ",")) };
nota.push(nn);
});
tmpArray.forEach((campo, i) => {
it = i + 1;
cor = tabelaGrid.rows[it].cells[1].style;
aluno = tabelaGrid.rows[it].cells[3].innerHTML;
indice = nome.indexOf(aluno);
cor.backgroundColor = 'red';
tabelaGrid.rows[it].cells[0].innerHTML = indice;
if (indice >= 0) {
cor.backgroundColor = 'lightgreen';
if (campo.className == 'form-control input-sm') {
cor.backgroundColor = 'lightYellow';
campo.value = nota[indice];
console.log(nota[indice]);
} else if (nota[indice] != '') {
cor.backgroundColor = 'blue'; tabelaGrid.rows[it].cells[0].innerHTML = nota[indice];
tabelaGrid.rows[it].cells[0].style.fontSize = "22px";
}
};
if (indice < 0) { flag = 1 };
});
if (flag == 1) alert('Aluno desconhecido');
});

Back to list