From 18e194648874c64c91f905fcf89dd67dcc4383fa Mon Sep 17 00:00:00 2001 From: BigEd Date: Fri, 5 Nov 2010 19:53:22 +0000 Subject: [PATCH] allow forward or reverse log order --- expert.html | 1 + macros.js | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/expert.html b/expert.html index 5e5a724..816cf26 100644 --- a/expert.html +++ b/expert.html @@ -127,6 +127,7 @@ $().ready(function(){ +
diff --git a/macros.js b/macros.js index 57030f1..abcfbe8 100644 --- a/macros.js +++ b/macros.js @@ -451,6 +451,24 @@ function initLogbox(names){ logbox.innerHTML = ""+logStream.join("")+""; } +var logboxAppend=true; + +// can append or prepend new states to the log table +// when we reverse direction we need to reorder the log stream +function updateLogDirection(){ + logboxAppend=!logboxAppend; + var logbox=document.getElementById('logstream'); + var loglines=[]; + // the first element is the header so we can't reverse() + for (var i=1;i")+""; +} + +// update the table of signal values, by prepending or appending function updateLogbox(names){ var logbox=document.getElementById('logstream'); var signals=[]; @@ -458,7 +476,10 @@ function updateLogbox(names){ for(i in names){ signals.push(busToString(names[i])); } - logStream.push("" + signals.join("") + ""); + if(logboxAppend) + logStream.push("" + signals.join("") + ""); + else + logStream.splice(1,0,"" + signals.join("") + ""); logbox.innerHTML = ""+logStream.join("")+""; }