var logContent = {}; var logNames = { "rtcLog": "RTC CLIENT", "rtmLog": "RTM CLIENT", "signalChannel": "SIGNAL CHANNEL", "chatChannel": "CHAT CHANNEL", "globalErr": "OTHER" } function clear() { $("#tableData tbody").html(""); } function loadFile() { var input, file, fr; if (typeof window.FileReader !== 'function') { alert("Browser not supported."); return; } input = document.getElementById('fileinput'); if (!input) { alert("Can't find fileinput element."); } else if (!input.files) { alert("Browser not supported."); } else if (!input.files[0]) { alert("Select file"); } else { file = input.files[0]; fr = new FileReader(); fr.onload = receivedText; fr.readAsText(file); } function receivedText(e) { const currentFileContent = e.target.result; //allLoadedBalls = lines.replace( /\r?\n/g, " " ).split( " " ); parseLog(currentFileContent); } } function setCurrentLog(logName) { clear(); $("#currentLog").html(logNames[logName]); parseLogSection(logContent[logName]); } function parseLog(content) { console.log(content); try { logContent = JSON.parse(content); } catch(err) { alert("error parsing json"); console.log("parse error", err); return; } console.log(logContent); $("#userId").html(logContent.userId); $("#userName").html(logContent.userName); } function parseLogSection(log) { console.log("PARSE LOG SECTION"); const table = $("#tableData tbody"); for(let i = 0; i < log.length; i++) { console.log(log[i]); // time var t = $("