aboutsummaryrefslogtreecommitdiff
path: root/advtrains_train_steam/models
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains_train_steam/models')
0 files changed, 0 insertions, 0 deletions
re>
function e(s) {
    if (typeof s === "undefined") s = '';
    return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;'); //mc"
}
function human_time(t) {
    var n = 's';
    if (!t || t < 0) t = 0;
    var f = 0;
    var s = parseInt((new Date().getTime() / 1000 - (t || 0)));
    if (!s || s <= 0) s = 0;
    if (s == 0) return 'now';
    if (s >= 60) {
        s /= 60;
        n = 'm';
        if (s >= 60) {
            s /= 60;
            n = 'h';
            f = 1;
            if (s >= 24) {
                s /= 24;
                n = 'd';
                f = 1;
                if (s >= 30) {
                    s /= 30;
                    n = 'M';
                    f = 1;
                    if (s >= 12) {
                        s /= 12;
                        n = 'y';
                        f = 1;
                    }
                }
            }
        }
    }
    return ((f ? parseFloat(s).toFixed(1) : parseInt(s)) + n);
}
function success(r) {
    if (!r || !r.list) return;
    var h = '<table><tr><th>ip:port</th><th>clients, max</th><th>version</th><th>name</th><th>desc</th><th>flags</th><th>updated/started</th><th>ping</th></tr>';
    for (var i = 0; i < r.list.length; ++i) {
        var s = r.list[i];
        if (!s) continue;
        h += '<tr>';
        h += '<td>' + e(s.address) + ':' + e(s.port) + '</td>';