diff --git a/lsp/functions.js b/lsp/functions.js index 3adf6e31..8c3bb060 100644 --- a/lsp/functions.js +++ b/lsp/functions.js @@ -370,3 +370,35 @@ $('#header-host').text(settings.server.replace('HTTP://', '')); } + + + /** + * Formats the status property to a string (with colors!) + * @param status, the status property of a stream + */ + function formatStatus(status) + { + if(status == undefined) + { + return "Unknown, checking..."; + } + + switch(status) + { + case 1: return "Running"; break; + case 0: return "Offline"; break; + default: return "" + status + ""; break; + } + } + + +/* + if(status == 1) + { + $(row.children()[3]).html("Running"); + } + $(row.children()[3]).html("" + (status == 0 ? 'Offline' : (!status ? 'Unknown, checking...' : status) ) + ""); + } + +*/ + diff --git a/lsp/main.js b/lsp/main.js index 3bd48afa..93a87ec0 100644 --- a/lsp/main.js +++ b/lsp/main.js @@ -438,13 +438,15 @@ TODO als server het stuurt { var row = $('#stream-' + stream); var status = streams[stream][0]; - +/* if(status == 1) { $(row.children()[3]).html("Running"); - }else{ - $(row.children()[3]).html("" + (status == 0 ? 'Offline' : (!status ? 'Unknown, checking...' : status) ) + ""); } + $(row.children()[3]).html("" + (status == 0 ? 'Offline' : (!status ? 'Unknown, checking...' : status) ) + ""); + } +*/ + $row.children()[3]).html( formatStatus(status) ); $(row.children()[4]).text(streams[stream][1]); } @@ -483,12 +485,16 @@ TODO als server het stuurt $tr.append( $('').text(cstr.name) ); +/* if(cstr.online && cstr.online == 1) { $tr.append( $('').html("Running") ); }else{ $tr.append( $('').html("" + (cstr.online == 0 ? 'Offline' : 'Unknown, checking...') + "") ); } +*/ + $tr.append( $('').html( formatStatus(status) ); + var cviewers = 0;