From 731141c7232955415dc413244830837fb0f8d4e6 Mon Sep 17 00:00:00 2001 From: Starow Date: Tue, 12 Aug 2014 16:11:11 +0200 Subject: [PATCH] Padding log hours + adding some super nice bootstrap icon :) --- var/www/static/js/indexjavascript.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/var/www/static/js/indexjavascript.js b/var/www/static/js/indexjavascript.js index 7459d1aa..abd49e72 100644 --- a/var/www/static/js/indexjavascript.js +++ b/var/www/static/js/indexjavascript.js @@ -18,6 +18,11 @@ source.onmessage = function(event) { create_log_table(feed); }; +function pad_2(number) +{ + return (number < 10 ? '0' : '') + number; +} + function create_log_table(obj_json) { tableBody = document.getElementById("tab_body") var tr = document.createElement('TR') @@ -57,7 +62,7 @@ function create_log_table(obj_json) { src.appendChild(source_link); var now = new Date(); - var timepaste = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(); + var timepaste = pad_2(now.getHours()) + ":" + pad_2(now.getMinutes()) + ":" + pad_2(now.getSeconds()); time.appendChild(document.createTextNode(timepaste)); chan.appendChild(document.createTextNode(chansplit[0])); @@ -66,6 +71,16 @@ function create_log_table(obj_json) { scrpt.appendChild(document.createTextNode(parsedmess[0])); pdate.appendChild(document.createTextNode(parsedmess[2])); nam.appendChild(document.createTextNode(parsedmess[3])); + + var iconspan = document.createElement('SPAN'); + if (parsedmess[4].split(" ")[0] == "Detected"){ + iconspan.className = "glyphicon glyphicon-eye-open"; + } + else if (parsedmess[4].split(" ")[0] == "Checked"){ + iconspan.className = "glyphicon glyphicon-thumbs-up"; + } + iconspan.innerHTML = " "; + msage.appendChild(iconspan); msage.appendChild(document.createTextNode(parsedmess[4])); tr.appendChild(time)