Diverse endringer fra de siste årene. Programmet er fortsatt 🍝

This commit is contained in:
Trygve 2023-11-07 15:26:58 +01:00
parent c25ef18f21
commit 150d6cb931
2 changed files with 24 additions and 11 deletions

View File

@ -158,10 +158,10 @@ h4 {
display: flex;
flex-flow: column wrap;
align-content: center;
gap: 1rem;
gap: 0.5rem;
/* Your container needs a fixed height, and it
* needs to be taller than your tallest column. */
height: 200rem;
height: var(--row-count);;
}
.all-result::before,
.all-result::after {
@ -170,9 +170,6 @@ h4 {
width: 0;
order: 2;
}
.all-result-div{
margin-bottom: 2%; /* Optional */
}
.all-result-div:nth-child(3n+1) { order: 1; }
.all-result-div:nth-child(3n+2) { order: 2; }
.all-result-div:nth-child(3n) { order: 3; }

View File

@ -81,7 +81,7 @@ function loadresults() {
}
document.getElementById("alle-cont").innerHTML = "";
//console.log(xmlObj);
let rowCount = 0;
document.getElementById("header-brand").innerHTML=xmlObj.Event.Name;
@ -92,6 +92,7 @@ function loadresults() {
let winnerTime;
let controlArray = [];
if(typeof(xmlObj.ClassResult[i].PersonResult)!== 'undefined'){
if(typeof(xmlObj.ClassResult[i].PersonResult[0])!== 'undefined' && typeof(xmlObj.ClassResult[i].PersonResult[0].Result.SplitTime)!== 'undefined'){
splitTimes += '<td></td>'
controlArray = Array.from(xmlObj.ClassResult[i].PersonResult[0].Result.SplitTime);
@ -99,10 +100,13 @@ function loadresults() {
splitTimes += `<td ctrlcode="${xmlObj.ClassResult[i].PersonResult[0].Result.SplitTime[s].ControlCode}">${(s+1)}-${xmlObj.ClassResult[i].PersonResult[0].Result.SplitTime[s].ControlCode}</td>`;
}
}
}
splitTimes += '</tr>'
if(typeof(xmlObj.ClassResult[i].PersonResult)!== 'undefined'){
for (let k = 0; k < xmlObj.ClassResult[i].PersonResult.length; k++) {
rowCount += 1;
if(typeof(xmlObj.ClassResult[i].PersonResult[k].Result)!== 'undefined' && typeof(xmlObj.ClassResult[i].PersonResult[k].Result.Position)!== 'undefined'){
resultTable += `<tr><td id="Ranking">${xmlObj.ClassResult[i].PersonResult[k].Result.Position}.</td>`;
}
@ -163,21 +167,30 @@ function loadresults() {
let controlTime = 0;
let controlTimeDelta = 0;
for (let t = 0; t < controlArray.length; t++) {
if (typeof(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime[t])!== 'undefined'){
controlTime = parseInt(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime[t].Time, 10)-controlTimeDelta
controlTimeDelta += controlTime;
splitTimes += '<td>'+ TimeFormater(controlTime) +'<br>'+ TimeFormater(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime[t].Time)+'</td>'
}
else{
splitTimes += '<td><br></td>'
}
}
}
else if (typeof(xmlObj.ClassResult[i].PersonResult[k])!== 'undefined' && typeof(xmlObj.ClassResult[i].PersonResult[0].Result.SplitTime)!== 'undefined' && persStatus == 'Disqualified'){
splitTimes += '<tr><td>' + xmlObj.ClassResult[i].PersonResult[k].Person.Name.Given + " " + xmlObj.ClassResult[i].PersonResult[k].Person.Name.Family + "(DSQ)</td>";
let controlTimeDelta = 0;
for (let t = 0; t < controlArray.length; t++) {
if (typeof(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime && typeof(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime[t].Time)!=='undefined')!== 'undefined'){
if (typeof(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime)!== 'undefined'){
if (typeof(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime[t])!== 'undefined'){
if (typeof(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime[t].Time)!=='undefined'){
controlTime = parseInt(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime[t].Time, 10)-controlTimeDelta
controlTimeDelta += controlTime;
splitTimes += '<td>'+ TimeFormater(controlTime) +'<br>'+ TimeFormater(xmlObj.ClassResult[i].PersonResult[k].Result.SplitTime[t].Time)+'</td>'
}
}
}
else {
splitTimes += '<td></td>'
}
@ -185,6 +198,7 @@ function loadresults() {
}
splitTimes += '</tr>';
}
}
resultTable += "</table></div>"
splitTimes += "</table></div>"
@ -208,6 +222,8 @@ function loadresults() {
resultTable = "";
splitTimes = "";
}
//sets the variable that controls height of the all results flex
document.documentElement.style.setProperty('--row-count', rowCount * 1.8 + "rem");
}
};
xmlhttp.open("GET", "xmlToJson.php", true);
@ -258,7 +274,7 @@ if (typeof(EventSource) !== "undefined") {
loadresults()
//console.log("Update!!!!! :=)");
window.lastUpdate = parseInt(statusArray[1], 10);
var jdata = JSON.parse(statusArray[3]);
//var jdata = JSON.parse(statusArray[3]);
} else {
//console.log("No update");
}