diff options
Diffstat (limited to 'mod/lorea-status/www/status.js')
-rw-r--r-- | mod/lorea-status/www/status.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mod/lorea-status/www/status.js b/mod/lorea-status/www/status.js new file mode 100644 index 000000000..a7f1daf09 --- /dev/null +++ b/mod/lorea-status/www/status.js @@ -0,0 +1,33 @@ +(function($) { + + function update_status(data) { + var items = []; + var klass; + + $('#status-throbbler').hide(); + + $('<h3/>', { 'html': 'Monitoring ' + data.seeds + ' seeds.' }).appendTo('#status').fadeIn(); + + $.each(data.list, function(i, item) { + klass = (item.ping == 1) ? "up" : "down"; + klass = (item.running == 1) ? klass + " running" : klass; + + console.log(item.host + ":" + item.ping + item.running + " " + klass); + + items.push('<li class="' + klass + '"><a href="https://' + item.host + '/">' + item.host + '</a></li>'); + }); + $('<ul/>', { 'html': items.join('') }).appendTo('#status'); + + } + + $(document).ready(function() { + + // Put a loader + $('#status').html('<p id="status-throbbler"><img src="data:image/gif;base64,R0lGODlhFAAUAOMIAAAAABoaGjMzM0xMTGZmZoCAgJmZmbKysv///////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQBCgAIACwAAAAAFAAUAAAEUxDJSau9CADMteZTEEjehhzHJYqkiaLWOlZvGs8WDO6UIPAGw8TnAwWDEuKPcxQml0YnjzcYYAqFS7VqwWItWyuCQJB4s2AxmWxGg9bl6YQtl0cAACH5BAEKAA8ALAAAAAAUABQAAART8MlJq70vBMy15pMgSN72AMAliqSJotY6Vm8azxYM7tQw8IfDxOcDBYMS4o9zFCaXRiePRyBgDIZLtWrBYi1b66NQkHizYDGZbEaD1uXphC2XRwAAIfkEAQoADwAsAAAAABQAFAAABFPwyUmrvU8IzLXm0zBI3vYEwSWKpImi1jpWbxrPFgzuFEHwAMDE5wMFgxLij3MUJpdGJ49XKGAOh0u1asFiLVvrw2CQeLNgMZlsRoPW5emELZdHAAAh+QQBCgAPACwAAAAAFAAUAAAEU/DJSau9bwzMteYTQUje9gjCJYqkiaLWOlZvGs8WDO5UUfCBwMTnAwWDEuKPcxQml0Ynj2cwYACAS7VqwWItW+vjcJB4s2AxmWxGg9bl6YQtl0cAACH5BAEKAA8ALAAAAAAUABQAAART8MlJq72PEMy15lNRSN72DMMliqSJotY6Vm8azxYM7pRh8ALBxOcDBYMS4o9zFCaXRiePdzhgAoFLtWrBYi1b6wMAkHizYDGZbEaD1uXphC2XRwAAIfkEAQoADwAsAAAAABQAFAAABFPwyUmrva8UzLXmk2FI3vYQxCWKpImi1jpWbxrPFgzu1HHwg8HE5wMFgxLij3MUJpdGJ48HAGAEgku1asFiLVvrIxCQeLNgMZlsRoPW5emELZdHAAAh+QQBCgAPACwAAAAAFAAUAAAEU/DJSau9zxjMtebTcUje9hTFJYqkiaLWOlZvGs8WDO4UAPAEwsTnAwWDEuKPcxQml0YnjxcIYAaDS7VqwWItW+tDIJB4s2AxmWxGg9bl6YQtl0cAACH5BAEKAA8ALAAAAAAUABQAAART8MlJq73vHMy15hMASN72GMYliqSJotY6Vm8azxYM7lQQ8IXCxOcDBYMS4o9zFCaXRiePJxBgCIRLtWrBYi1b62MwkHizYDGZbEaD1uXphC2XRwAAOw==" alt="loading..."/></p>'); + + // Read status + $.getJSON('http://status.lorea.org/pub/status.json', update_status); + + }); + +})(jQuery); |