2020-09-20 12:17:29 -07:00
|
|
|
var marq = document.querySelector('marquee');
|
|
|
|
var timeStr, stockPriceDelta, stockPriceDirection;
|
|
|
|
var i = 0;
|
|
|
|
function updateTimestamp() {
|
2020-09-21 11:27:55 -07:00
|
|
|
timeStr = new Date().toLocaleString();
|
2020-09-20 12:17:29 -07:00
|
|
|
}
|
|
|
|
function updateStockPrice() {
|
|
|
|
stockPriceDelta = Math.floor(Math.random() * 10000) / 100;
|
|
|
|
stockPriceDirection = Math.random() < 0.5;
|
|
|
|
}
|
|
|
|
function renderMarquee() {
|
|
|
|
updateTimestamp();
|
|
|
|
if (i % 10 === 0) updateStockPrice();
|
|
|
|
var stockPriceArrow = stockPriceDirection ? "▲" : "▼";
|
|
|
|
var stockPriceColor = stockPriceDirection ? "green" : "red";
|
|
|
|
marq.innerHTML = timeStr + " - FEM <span style=\"color:" + stockPriceColor + ";\">" + stockPriceArrow + " " + stockPriceDelta + "</span>";
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
setInterval(renderMarquee, 1000);
|
|
|
|
renderMarquee();
|