Subversion Repositories ALCASAR

Rev

Rev 2976 | Rev 3100 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2976 Rev 3037
1
var langxml = [], langarr = [], current_language = "", plugins = [], blocks = [], plugin_liste = [],
1
var langxml = [], langarr = [], current_language = "", plugins = [], blocks = [], plugin_liste = [],
2
     showCPUListExpanded, showCPUInfoExpanded, showNetworkInfosExpanded, showNetworkActiveSpeed, showCPULoadCompact, oldnetwork = [], refrTimer;
2
     showCPUListExpanded, showCPUInfoExpanded, showNetworkInfosExpanded, showNetworkActiveSpeed, showCPULoadCompact, oldnetwork = [], refrTimer;
3
 
3
 
4
/**
4
/**
5
 * generate a cookie, if not exist, and add an entry to it<br><br>
5
 * generate a cookie, if not exist, and add an entry to it<br><br>
6
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
6
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
7
 * @param {String} name name that holds the value
7
 * @param {String} name name that holds the value
8
 * @param {String} value value that needs to be stored
8
 * @param {String} value value that needs to be stored
9
 * @param {Number} days how many days the entry should be valid in the cookie
9
 * @param {Number} days how many days the entry should be valid in the cookie
10
 */
10
 */
11
function createCookie(name, value, days) {
11
function createCookie(name, value, days) {
12
    var date = new Date(), expires = "";
12
    var date = new Date(), expires = "";
13
    if (days) {
13
    if (days) {
14
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
14
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
15
        if (typeof(date.toUTCString)==="function") {
15
        if (typeof(date.toUTCString)==="function") {
16
            expires = "; expires=" + date.toUTCString();
16
            expires = "; expires=" + date.toUTCString();
17
        } else {
17
        } else {
18
            //deprecated
18
            //deprecated
19
            expires = "; expires=" + date.toGMTString();
19
            expires = "; expires=" + date.toGMTString();
20
        }
20
        }
21
    } else {
21
    } else {
22
        expires = "";
22
        expires = "";
23
    }
23
    }
24
    document.cookie = name + "=" + value + expires + "; path=/; samesite=strict";
24
    document.cookie = name + "=" + value + expires + "; path=/; samesite=strict";
25
}
25
}
26
 
26
 
27
/**
27
/**
28
 * read a value out of a cookie and return the value<br><br>
28
 * read a value out of a cookie and return the value<br><br>
29
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
29
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
30
 * @param {String} name name of the value that should be retrieved
30
 * @param {String} name name of the value that should be retrieved
31
 * @return {String}
31
 * @return {String}
32
 */
32
 */
33
function readCookie(name) {
33
function readCookie(name) {
34
    var nameEQ = "", ca = [], c = '';
34
    var nameEQ = "", ca = [], c = '';
35
    nameEQ = name + "=";
35
    nameEQ = name + "=";
36
    ca = document.cookie.split(';');
36
    ca = document.cookie.split(';');
37
    for (var i = 0; i < ca.length; i++) {
37
    for (var i = 0; i < ca.length; i++) {
38
        c = ca[i];
38
        c = ca[i];
39
        while (c.charAt(0) === ' ') {
39
        while (c.charAt(0) === ' ') {
40
            c = c.substring(1, c.length);
40
            c = c.substring(1, c.length);
41
        }
41
        }
42
        if (!c.indexOf(nameEQ)) {
42
        if (!c.indexOf(nameEQ)) {
43
            return c.substring(nameEQ.length, c.length);
43
            return c.substring(nameEQ.length, c.length);
44
        }
44
        }
45
    }
45
    }
46
    return null;
46
    return null;
47
}
47
}
48
 
48
 
49
/**
49
/**
50
 * activates a given style and disables the old one in the document
50
 * activates a given style and disables the old one in the document
51
 * @param {String} template template that should be activated
51
 * @param {String} template template that should be activated
52
 */
52
 */
53
function switchStyle(template) {
53
function switchStyle(template) {
54
    $("#PSI_Template")[0].setAttribute('href', 'templates/' + template + "_bootstrap.css");
54
    $("#PSI_Template")[0].setAttribute('href', 'templates/' + template + "_bootstrap.css");
55
}
55
}
56
 
56
 
57
/**
57
/**
58
 * load the given translation an translate the entire page<br><br>retrieving the translation is done through a
58
 * load the given translation an translate the entire page<br><br>retrieving the translation is done through a
59
 * ajax call
59
 * ajax call
60
 * @private
60
 * @private
61
 * @param {String} plugin if plugin is given, the plugin translation file will be read instead of the main translation file
61
 * @param {String} plugin if plugin is given, the plugin translation file will be read instead of the main translation file
62
 * @param {String} langarrId internal plugin name
62
 * @param {String} langarrId internal plugin name
63
 * @return {jQuery} translation jQuery-Object
63
 * @return {jQuery} translation jQuery-Object
64
 */
64
 */
65
function getLanguage(plugin, langarrId) {
65
function getLanguage(plugin, langarrId) {
66
    var getLangUrl = "";
66
    var getLangUrl = "";
67
    if (current_language) {
67
    if (current_language) {
68
        getLangUrl = 'language/language.php?lang=' + current_language;
68
        getLangUrl = 'language/language.php?lang=' + current_language;
69
        if (plugin) {
69
        if (plugin) {
70
            getLangUrl += "&plugin=" + plugin;
70
            getLangUrl += "&plugin=" + plugin;
71
        }
71
        }
72
    } else {
72
    } else {
73
        getLangUrl = 'language/language.php';
73
        getLangUrl = 'language/language.php';
74
        if (plugin) {
74
        if (plugin) {
75
            getLangUrl += "?plugin=" + plugin;
75
            getLangUrl += "?plugin=" + plugin;
76
        }
76
        }
77
    }
77
    }
78
    $.ajax({
78
    $.ajax({
79
        url: getLangUrl,
79
        url: getLangUrl,
80
        type: 'GET',
80
        type: 'GET',
81
        dataType: 'xml',
81
        dataType: 'xml',
82
        timeout: 100000,
82
        timeout: 100000,
83
        error: function error() {
83
        error: function error() {
84
            $("#errors").append("<li><b>Error loading language</b> - " + getLangUrl + "</li><br>");
84
            $("#errors").append("<li><b>Error loading language</b> - " + getLangUrl + "</li><br>");
85
            $("#errorbutton").attr('data-toggle', 'modal');
85
            $("#errorbutton").attr('data-toggle', 'modal');
86
            $("#errorbutton").css('cursor', 'pointer');
86
            $("#errorbutton").css('cursor', 'pointer');
87
            $("#errorbutton").css("visibility", "visible");
87
            $("#errorbutton").css("visibility", "visible");
88
        },
88
        },
89
        success: function buildblocks(xml) {
89
        success: function buildblocks(xml) {
90
            var idexp;
90
            var idexp;
91
            langxml[langarrId] = xml;
91
            langxml[langarrId] = xml;
92
            if (langarr[langarrId] === undefined) {
92
            if (langarr[langarrId] === undefined) {
93
                langarr.push(langarrId);
93
                langarr.push(langarrId);
94
                langarr[langarrId] = [];
94
                langarr[langarrId] = [];
95
            }
95
            }
96
            $("expression", langxml[langarrId]).each(function langstore(id) {
96
            $("expression", langxml[langarrId]).each(function langstore(id) {
97
                idexp = $("expression", xml).get(id);
97
                idexp = $("expression", xml).get(id);
98
                langarr[langarrId][this.getAttribute('id')] = $("exp", idexp).text().toString().replace(/\//g, "/<wbr>");
98
                langarr[langarrId][this.getAttribute('id')] = $("exp", idexp).text().toString().replace(/\//g, "/<wbr>");
99
            });
99
            });
100
            changeSpanLanguage(plugin);
100
            changeSpanLanguage(plugin);
101
        }
101
        }
102
    });
102
    });
103
}
103
}
104
 
104
 
105
/**
105
/**
106
 * generate a span tag
106
 * generate a span tag
107
 * @param {Number} id translation id in the xml file
107
 * @param {Number} id translation id in the xml file
108
 * @param {String} [plugin] name of the plugin for which the tag should be generated
108
 * @param {String} [plugin] name of the plugin for which the tag should be generated
-
 
109
 * @param {String} [defaultvalue] default value
109
 * @return {String} string which contains generated span tag for translation string
110
 * @return {String} string which contains generated span tag for translation string
110
 */
111
 */
111
function genlang(id, plugin) {
112
function genlang(id, plugin, defaultvalue) {
112
    var html = "", idString = "", plugname = "",
113
    var html = "", idString = "", plugname = "",
113
        langarrId = current_language + "_";
114
        langarrId = current_language + "_";
114
 
115
 
115
    if (plugin === undefined) {
116
    if (plugin === undefined) {
116
        plugname = "";
117
        plugname = "";
117
        langarrId += "phpSysInfo";
118
        langarrId += "phpSysInfo";
118
    } else {
119
    } else {
119
        plugname = plugin.toLowerCase();
120
        plugname = plugin.toLowerCase();
120
        langarrId += plugname;
121
        langarrId += plugname;
121
    }
122
    }
122
 
123
 
123
    if (id < 100) {
124
    if (id < 100) {
124
        if (id < 10) {
125
        if (id < 10) {
125
            idString = "00" + id.toString();
126
            idString = "00" + id.toString();
126
        } else {
127
        } else {
127
            idString = "0" + id.toString();
128
            idString = "0" + id.toString();
128
        }
129
        }
129
    } else {
130
    } else {
130
        idString = id.toString();
131
        idString = id.toString();
131
    }
132
    }
132
    if (plugin) {
133
    if (plugin) {
133
        idString = "plugin_" + plugname + "_" + idString;
134
        idString = "plugin_" + plugname + "_" + idString;
134
    }
135
    }
135
 
136
 
136
    html += "<span class=\"lang_" + idString + "\">";
137
    html += "<span class=\"lang_" + idString + "\">";
137
 
138
 
138
    if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
139
    if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
139
        html += langarr[langarrId][idString];
140
        html += langarr[langarrId][idString];
-
 
141
    } else if (defaultvalue !== undefined) {
-
 
142
        html += defaultvalue;
140
    }
143
    }
141
 
144
 
142
    html += "</span>";
145
    html += "</span>";
143
 
146
 
144
    return html;
147
    return html;
145
}
148
}
146
 
149
 
147
/**
150
/**
148
 * translates all expressions based on the translation xml file<br>
151
 * translates all expressions based on the translation xml file<br>
149
 * translation expressions must be in the format &lt;span class="lang_???"&gt;&lt;/span&gt;, where ??? is
152
 * translation expressions must be in the format &lt;span class="lang_???"&gt;&lt;/span&gt;, where ??? is
150
 * the number of the translated expression in the xml file<br><br>if a translated expression is not found in the xml
153
 * the number of the translated expression in the xml file<br><br>if a translated expression is not found in the xml
151
 * file nothing would be translated, so the initial value which is inside the span tag is displayed
154
 * file nothing would be translated, so the initial value which is inside the span tag is displayed
152
 * @param {String} [plugin] name of the plugin
155
 * @param {String} [plugin] name of the plugin
153
 */
156
 */
154
function changeLanguage(plugin) {
157
function changeLanguage(plugin) {
155
    var langarrId = current_language + "_";
158
    var langarrId = current_language + "_";
156
 
159
 
157
    if (plugin === undefined) {
160
    if (plugin === undefined) {
158
        langarrId += "phpSysInfo";
161
        langarrId += "phpSysInfo";
159
    } else {
162
    } else {
160
        langarrId += plugin;
163
        langarrId += plugin;
161
    }
164
    }
162
 
165
 
163
    if (langxml[langarrId] !== undefined) {
166
    if (langxml[langarrId] !== undefined) {
164
        changeSpanLanguage(plugin);
167
        changeSpanLanguage(plugin);
165
    } else {
168
    } else {
166
        langxml.push(langarrId);
169
        langxml.push(langarrId);
167
        getLanguage(plugin, langarrId);
170
        getLanguage(plugin, langarrId);
168
    }
171
    }
169
}
172
}
170
 
173
 
171
function changeSpanLanguage(plugin) {
174
function changeSpanLanguage(plugin) {
172
    var langId = "", langStr = "", langarrId = current_language + "_";
175
    var langId = "", langStr = "", langarrId = current_language + "_";
173
 
176
 
174
    if (plugin === undefined) {
177
    if (plugin === undefined) {
175
        langarrId += "phpSysInfo";
178
        langarrId += "phpSysInfo";
176
        $('span[class*=lang_]').each(function translate(i) {
179
        $('span[class*=lang_]').each(function translate(i) {
177
            langId = this.className.substring(5);
180
            langId = this.className.substring(5);
178
            if (langId.indexOf('plugin_') !== 0) { //does not begin with plugin_
181
            if (langId.indexOf('plugin_') !== 0) { //does not begin with plugin_
179
                langStr = langarr[langarrId][langId];
182
                langStr = langarr[langarrId][langId];
180
                if (langStr !== undefined) {
183
                if (langStr !== undefined) {
181
                    if (langStr.length > 0) {
184
                    if (langStr.length > 0) {
182
                        this.innerHTML = langStr;
185
                        this.innerHTML = langStr;
183
                    }
186
                    }
184
                }
187
                }
185
            }
188
            }
186
        });
189
        });
187
        $("#select").css( "display", "table-cell" ); //show if any language loaded
190
        $("#select").css( "display", "table-cell" ); //show if any language loaded
188
        $("#output").show();
191
        $("#output").show();
189
    } else {
192
    } else {
190
        langarrId += plugin;
193
        langarrId += plugin;
191
        $('span[class*=lang_plugin_'+plugin.toLowerCase()+'_]').each(function translate(i) {
194
        $('span[class*=lang_plugin_'+plugin.toLowerCase()+'_]').each(function translate(i) {
192
            langId = this.className.substring(5);
195
            langId = this.className.substring(5);
193
            langStr = langarr[langarrId][langId];
196
            langStr = langarr[langarrId][langId];
194
            if (langStr !== undefined) {
197
            if (langStr !== undefined) {
195
                if (langStr.length > 0) {
198
                if (langStr.length > 0) {
196
                    this.innerHTML = langStr;
199
                    this.innerHTML = langStr;
197
                }
200
                }
198
            }
201
            }
199
        });
202
        });
200
        $('#panel_'+plugin.toLowerCase()).show(); //show plugin if any language loaded
203
        $('#panel_'+plugin.toLowerCase()).show(); //show plugin if any language loaded
201
    }
204
    }
202
}
205
}
203
 
206
 
204
function reload(initiate) {
207
function reload(initiate) {
205
    $("#errorbutton").css("visibility", "hidden");
208
    $("#errorbutton").css("visibility", "hidden");
206
    $("#errorbutton").css('cursor', 'default');
209
    $("#errorbutton").css('cursor', 'default');
207
    $("#errorbutton").attr('data-toggle', '');
210
    $("#errorbutton").attr('data-toggle', '');
208
    $("#errors").empty();
211
    $("#errors").empty();
209
    $.ajax({
212
    $.ajax({
210
        dataType: "json",
213
        dataType: "json",
211
        url: "xml.php?json",
214
        url: "xml.php?json",
212
        error: function(jqXHR, status, thrownError) {
215
        error: function(jqXHR, status, thrownError) {
213
            if ((status === "parsererror") && (typeof(xmlDoc = $.parseXML(jqXHR.responseText)) === "object")) {
216
            if ((status === "parsererror") && (typeof(xmlDoc = $.parseXML(jqXHR.responseText)) === "object")) {
214
                var errs = 0;
217
                var errs = 0;
215
                try {
218
                try {
216
                    $(xmlDoc).find("Error").each(function() {
219
                    $(xmlDoc).find("Error").each(function() {
217
                        $("#errors").append("<li><b>"+$(this)[0].attributes.Function.nodeValue+"</b> - "+$(this)[0].attributes.Message.nodeValue.replace(/\n/g, "<br>")+"</li><br>");
220
                        $("#errors").append("<li><b>"+$(this)[0].attributes.Function.nodeValue+"</b> - "+$(this)[0].attributes.Message.nodeValue.replace(/\n/g, "<br>")+"</li><br>");
218
                        errs++;
221
                        errs++;
219
                    });
222
                    });
220
                }
223
                }
221
                catch (err) {
224
                catch (err) {
222
                }
225
                }
223
                if (errs > 0) {
226
                if (errs > 0) {
224
                    $("#errorbutton").attr('data-toggle', 'modal');
227
                    $("#errorbutton").attr('data-toggle', 'modal');
225
                    $("#errorbutton").css('cursor', 'pointer');
228
                    $("#errorbutton").css('cursor', 'pointer');
226
                    $("#errorbutton").css("visibility", "visible");
229
                    $("#errorbutton").css("visibility", "visible");
227
                }
230
                }
228
            }
231
            }
229
        },
232
        },
230
        success: function (data) {
233
        success: function (data) {
231
//            console.log(data);
234
//            console.log(data);
232
//            data_dbg = data;
235
//            data_dbg = data;
233
            if ((typeof(initiate) === 'boolean') && (data.Options !== undefined) && (data.Options["@attributes"] !== undefined) && ((refrtime = data.Options["@attributes"].refresh) !== undefined) && (refrtime !== "0")) {
236
            if ((typeof(initiate) === 'boolean') && (data.Options !== undefined) && (data.Options["@attributes"] !== undefined) && ((refrtime = data.Options["@attributes"].refresh) !== undefined) && (refrtime !== "0")) {
234
                    if ((initiate === false) && (typeof(refrTimer) === 'number')) {
237
                    if ((initiate === false) && (typeof(refrTimer) === 'number')) {
235
                        clearInterval(refrTimer);
238
                        clearInterval(refrTimer);
236
                    }
239
                    }
237
                    refrTimer = setInterval(reload, refrtime);
240
                    refrTimer = setInterval(reload, refrtime);
238
            }
241
            }
239
            renderErrors(data);
242
            renderErrors(data);
240
            renderVitals(data);
243
            renderVitals(data);
241
            renderHardware(data);
244
            renderHardware(data);
242
            renderMemory(data);
245
            renderMemory(data);
243
            renderFilesystem(data);
246
            renderFilesystem(data);
244
            renderNetwork(data);
247
            renderNetwork(data);
245
            renderVoltage(data);
248
            renderVoltage(data);
246
            renderTemperature(data);
249
            renderTemperature(data);
247
            renderFans(data);
250
            renderFans(data);
248
            renderPower(data);
251
            renderPower(data);
249
            renderCurrent(data);
252
            renderCurrent(data);
250
            renderOther(data);
253
            renderOther(data);
251
            renderUPS(data);
254
            renderUPS(data);
252
            changeLanguage();
255
            changeLanguage();
253
        }
256
        }
254
    });
257
    });
255
 
258
 
256
    for (var i = 0; i < plugins.length; i++) {
259
    for (var i = 0; i < plugins.length; i++) {
257
        plugin_request(plugins[i]);
260
        plugin_request(plugins[i]);
258
        if ($("#reload_"+plugins[i]).length > 0) {
261
        if ($("#reload_"+plugins[i]).length > 0) {
259
            $("#reload_"+plugins[i]).attr("title", "reload");
262
            $("#reload_"+plugins[i]).attr("title", "reload");
260
        }
263
        }
261
 
264
 
262
    }
265
    }
263
 
266
 
264
    if ((typeof(initiate) === 'boolean') && (initiate === true)) {
267
    if ((typeof(initiate) === 'boolean') && (initiate === true)) {
265
        for (var j = 0; j < plugins.length; j++) {
268
        for (var j = 0; j < plugins.length; j++) {
266
            if ($("#reload_"+plugins[j]).length > 0) {
269
            if ($("#reload_"+plugins[j]).length > 0) {
267
                $("#reload_"+plugins[j]).click(clickfunction());
270
                $("#reload_"+plugins[j]).click(clickfunction());
268
            }
271
            }
269
        }
272
        }
270
    }
273
    }
271
}
274
}
272
 
275
 
273
function clickfunction(){
276
function clickfunction(){
274
    return function(){
277
    return function(){
275
        plugin_request(this.id.substring(7)); //cut "reload_" from name
278
        plugin_request(this.id.substring(7)); //cut "reload_" from name
276
        $(this).attr("title", datetime());
279
        $(this).attr("title", datetime());
277
    };
280
    };
278
}
281
}
279
 
282
 
280
/**
283
/**
281
 * load the plugin json via ajax
284
 * load the plugin json via ajax
282
 */
285
 */
283
function plugin_request(pluginname) {
286
function plugin_request(pluginname) {
284
 
287
 
285
    $.ajax({
288
    $.ajax({
286
         dataType: "json",
289
         dataType: "json",
287
         url: "xml.php?plugin=" + pluginname + "&json",
290
         url: "xml.php?plugin=" + pluginname + "&json",
288
         pluginname: pluginname,
291
         pluginname: pluginname,
289
         success: function (data) {
292
         success: function (data) {
290
            try {
293
            try {
291
                for (var propertyName in data.Plugins) {
294
                for (var propertyName in data.Plugins) {
292
                    if ((data.Plugins[propertyName]["@attributes"] !== undefined) && 
295
                    if ((data.Plugins[propertyName]["@attributes"] !== undefined) && 
293
                       ((hostname = data.Plugins[propertyName]["@attributes"]["Hostname"]) !== undefined)) {
296
                       ((hostname = data.Plugins[propertyName]["@attributes"]["Hostname"]) !== undefined)) {
294
                        $('span[class=hostname_' + pluginname + ']').html(hostname);
297
                        $('span[class=hostname_' + pluginname + ']').html(hostname);
295
                    }
298
                    }
296
                    break;
299
                    break;
297
                }
300
                }
298
                // dynamic call
301
                // dynamic call
299
                window['renderPlugin_' + this.pluginname](data);
302
                window['renderPlugin_' + this.pluginname](data);
300
                changeLanguage(this.pluginname);
303
                changeLanguage(this.pluginname);
301
                plugin_liste.pushIfNotExist(this.pluginname);
304
                plugin_liste.pushIfNotExist(this.pluginname);
302
            }
305
            }
303
            catch (err) {
306
            catch (err) {
304
            }
307
            }
305
            renderErrors(data);
308
            renderErrors(data);
306
        }
309
        }
307
    });
310
    });
308
}
311
}
309
 
312
 
310
 
313
 
311
$(document).ready(function () {
314
$(document).ready(function () {
312
    var old_template = null, cookie_template = null, cookie_language = null, plugtmp = "", blocktmp = "", ua = null, useragent = navigator.userAgent;
315
    var old_template = null, cookie_template = null, cookie_language = null, plugtmp = "", blocktmp = "", ua = null, useragent = navigator.userAgent;
313
 
316
 
314
    if ($("#hideBootstrapLoader").val().toString()!=="true") {
317
    if ($("#hideBootstrapLoader").val().toString()!=="true") {
315
        $(document).ajaxStart(function () {
318
        $(document).ajaxStart(function () {
316
            $("#loader").css("visibility", "visible");
319
            $("#loader").css("visibility", "visible");
317
        });
320
        });
318
        $(document).ajaxStop(function () {
321
        $(document).ajaxStop(function () {
319
            $("#loader").css("visibility", "hidden");
322
            $("#loader").css("visibility", "hidden");
320
        });
323
        });
321
    }
324
    }
322
 
325
 
323
    if ((ua=useragent.match(/Version\/(\d+)\.[\d\.]+ (Mobile\/\S+ )?Safari\//)) !== null) {
326
    if ((ua=useragent.match(/Version\/(\d+)\.[\d\.]+ (Mobile\/\S+ )?Safari\//)) !== null) {
324
        if (ua[1]<=5) {
327
        if (ua[1]<=5) {
325
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari5.css');
328
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari5.css');
326
        } else if (ua[1]<=8) {
329
        } else if (ua[1]<=8) {
327
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari8.css');
330
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari8.css');
328
        }
331
        }
329
    } else if ((ua=useragent.match(/Firefox\/(\d+)\.[\d\.]+/))  !== null) {
332
    } else if ((ua=useragent.match(/Firefox\/(\d+)\.[\d\.]+/))  !== null) {
330
        if (ua[1]<=15) {
333
        if (ua[1]<=15) {
331
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox15.css');
334
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox15.css');
332
        } else if (ua[1]<=20) {
335
        } else if (ua[1]<=20) {
333
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox20.css');
336
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox20.css');
334
        } else if (ua[1]<=27) {
337
        } else if (ua[1]<=27) {
335
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox27.css');
338
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox27.css');
336
        } else if (ua[1]==28) {
339
        } else if (ua[1]==28) {
337
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox28.css');
340
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox28.css');
338
        }
341
        }
339
    } else if ((ua=useragent.match(/Midori\/(\d+)\.?(\d+)?/))  !== null) {
342
    } else if ((ua=useragent.match(/Midori\/(\d+)\.?(\d+)?/))  !== null) {
340
        if ((ua[1]==0) && (ua.length==3) && (ua[2]<=4)) {
343
        if ((ua[1]==0) && (ua.length==3) && (ua[2]<=4)) {
341
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori04.css');
344
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori04.css');
342
        } else if ((ua[1]==0) && (ua.length==3) && (ua[2]==5)) {
345
        } else if ((ua[1]==0) && (ua.length==3) && (ua[2]==5)) {
343
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori05.css');
346
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori05.css');
344
        }
347
        }
345
    } else if ((ua=useragent.match(/Chrome\/(\d+)\.[\d\.]+/))  !== null) {
348
    } else if ((ua=useragent.match(/Chrome\/(\d+)\.[\d\.]+/))  !== null) {
346
        if (ua[1]<=25) {
349
        if (ua[1]<=25) {
347
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome25.css');
350
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome25.css');
348
        } else if (ua[1]<=28) {
351
        } else if (ua[1]<=28) {
349
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome28.css');
352
            $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome28.css');
350
        }
353
        }
351
    }
354
    }
352
 
355
 
353
    $(window).resize();
356
    $(window).resize();
354
 
357
 
355
    sorttable.init();
358
    sorttable.init();
356
 
359
 
357
    showCPUListExpanded = $("#showCPUListExpanded").val().toString()==="true";
360
    showCPUListExpanded = $("#showCPUListExpanded").val().toString()==="true";
358
    showCPUInfoExpanded = $("#showCPUInfoExpanded").val().toString()==="true";
361
    showCPUInfoExpanded = $("#showCPUInfoExpanded").val().toString()==="true";
359
    showNetworkInfosExpanded = $("#showNetworkInfosExpanded").val().toString()==="true";
362
    showNetworkInfosExpanded = $("#showNetworkInfosExpanded").val().toString()==="true";
360
    showCPULoadCompact = $("#showCPULoadCompact").val().toString()==="true";
363
    showCPULoadCompact = $("#showCPULoadCompact").val().toString()==="true";
361
    switch ($("#showNetworkActiveSpeed").val().toString()) {
364
    switch ($("#showNetworkActiveSpeed").val().toString()) {
362
        case "bps":  showNetworkActiveSpeed = 2;
365
        case "bps":  showNetworkActiveSpeed = 2;
363
                      break;
366
                      break;
364
        case "true": showNetworkActiveSpeed = 1;
367
        case "true": showNetworkActiveSpeed = 1;
365
                      break;
368
                      break;
366
        default:     showNetworkActiveSpeed = 0;
369
        default:     showNetworkActiveSpeed = 0;
367
    }
370
    }
368
 
371
 
369
    blocktmp = $("#blocks").val().toString();
372
    blocktmp = $("#blocks").val().toString();
370
    if (blocktmp.length >0 ){
373
    if (blocktmp.length >0 ){
371
        if (blocktmp === "true") {
374
        if (blocktmp === "true") {
372
            blocks[0] = "true";
375
            blocks[0] = "true";
373
        } else {
376
        } else {
374
            blocks = blocktmp.split(',');
377
            blocks = blocktmp.split(',');
375
            var j = 0;
378
            var j = 0;
376
            for (var i = 0; i < blocks.length; i++) {
379
            for (var i = 0; i < blocks.length; i++) {
377
                if ($("#block_"+blocks[i]).length > 0) {
380
                if ($("#block_"+blocks[i]).length > 0) {
378
                    $("#output").children().eq(j).before($("#block_"+blocks[i]));
381
                    $("#output").children().eq(j).before($("#block_"+blocks[i]));
379
                    j++;
382
                    j++;
380
                }
383
                }
381
            }
384
            }
382
        }
385
        }
383
    }
386
    }
384
 
387
 
385
    plugtmp = $("#plugins").val().toString();
388
    plugtmp = $("#plugins").val().toString();
386
    if (plugtmp.length >0 ){
389
    if (plugtmp.length >0 ){
387
        plugins = plugtmp.split(',');
390
        plugins = plugtmp.split(',');
388
    }
391
    }
389
 
392
 
390
 
393
 
391
    if ($("#language option").length < 2) {
394
    if ($("#language option").length < 2) {
392
        current_language = $("#language").val().toString();
395
        current_language = $("#language").val().toString();
393
/* not visible any objects
396
/* not visible any objects
394
        changeLanguage();
397
        changeLanguage();
395
*/
398
*/
396
/* plugin_liste not initialized yet
399
/* plugin_liste not initialized yet
397
        for (var i = 0; i < plugin_liste.length; i++) {
400
        for (var i = 0; i < plugin_liste.length; i++) {
398
            changeLanguage(plugin_liste[i]);
401
            changeLanguage(plugin_liste[i]);
399
        }
402
        }
400
*/
403
*/
401
    } else {
404
    } else {
402
        cookie_language = readCookie("psi_language");
405
        cookie_language = readCookie("psi_language");
403
        if (cookie_language !== null) {
406
        if (cookie_language !== null) {
404
            current_language = cookie_language;
407
            current_language = cookie_language;
405
            $("#language").val(current_language);
408
            $("#language").val(current_language);
406
        } else {
409
        } else {
407
            current_language = $("#language").val().toString();
410
            current_language = $("#language").val().toString();
408
        }
411
        }
409
/* not visible any objects
412
/* not visible any objects
410
        changeLanguage();
413
        changeLanguage();
411
*/
414
*/
412
/* plugin_liste not initialized yet
415
/* plugin_liste not initialized yet
413
        for (var i = 0; i < plugin_liste.length; i++) {
416
        for (var i = 0; i < plugin_liste.length; i++) {
414
            changeLanguage(plugin_liste[i]);
417
            changeLanguage(plugin_liste[i]);
415
        }
418
        }
416
*/
419
*/
417
        $("#langblock").css( "display", "inline-block" );
420
        $("#langblock").css( "display", "inline-block" );
418
 
421
 
419
        $("#language").change(function changeLang() {
422
        $("#language").change(function changeLang() {
420
            current_language = $("#language").val().toString();
423
            current_language = $("#language").val().toString();
421
            createCookie('psi_language', current_language, 365);
424
            createCookie('psi_language', current_language, 365);
422
            changeLanguage();
425
            changeLanguage();
423
            for (var i = 0; i < plugin_liste.length; i++) {
426
            for (var i = 0; i < plugin_liste.length; i++) {
424
                changeLanguage(plugin_liste[i]);
427
                changeLanguage(plugin_liste[i]);
425
            }
428
            }
426
            return false;
429
            return false;
427
        });
430
        });
428
    }
431
    }
429
    if ($("#template option").length < 2) {
432
    if ($("#template option").length < 2) {
430
        switchStyle($("#template").val().toString());
433
        switchStyle($("#template").val().toString());
431
    } else {
434
    } else {
432
        cookie_template = readCookie("psi_bootstrap_template");
435
        cookie_template = readCookie("psi_bootstrap_template");
433
        if (cookie_template !== null) {
436
        if (cookie_template !== null) {
434
            old_template = $("#template").val();
437
            old_template = $("#template").val();
435
            $("#template").val(cookie_template);
438
            $("#template").val(cookie_template);
436
            if ($("#template").val() === null) {
439
            if ($("#template").val() === null) {
437
                $("#template").val(old_template);
440
                $("#template").val(old_template);
438
            }
441
            }
439
        }
442
        }
440
        switchStyle($("#template").val().toString());
443
        switchStyle($("#template").val().toString());
441
 
444
 
442
        $("#tempblock").css( "display", "inline-block" );
445
        $("#tempblock").css( "display", "inline-block" );
443
 
446
 
444
        $("#template").change(function changeTemplate() {
447
        $("#template").change(function changeTemplate() {
445
            switchStyle($("#template").val().toString());
448
            switchStyle($("#template").val().toString());
446
            createCookie('psi_bootstrap_template', $("#template").val().toString(), 365);
449
            createCookie('psi_bootstrap_template', $("#template").val().toString(), 365);
447
            return false;
450
            return false;
448
        });
451
        });
449
    }
452
    }
450
 
453
 
451
    reload(true);
454
    reload(true);
452
 
455
 
453
    $(".logo").click(function () {
456
    $(".logo").click(function () {
454
        reload(false);
457
        reload(false);
455
    });
458
    });
456
});
459
});
457
 
460
 
458
Array.prototype.push_attrs=function(element) {
461
Array.prototype.push_attrs=function(element) {
459
    for (var i = 0; i < element.length ; i++) {
462
    for (var i = 0; i < element.length ; i++) {
460
        this.push(element[i]["@attributes"]);
463
        this.push(element[i]["@attributes"]);
461
    }
464
    }
462
    return i;
465
    return i;
463
};
466
};
464
 
467
 
465
function full_addr(ip_string) {
468
function full_addr(ip_string) {
466
    var wrongvalue = false;
469
    var wrongvalue = false;
467
    ip_string = $.trim(ip_string).toLowerCase();
470
    ip_string = $.trim(ip_string).toLowerCase();
468
    // ipv4 notation
471
    // ipv4 notation
469
    if (ip_string.match(/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/)) {
472
    if (ip_string.match(/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/)) {
470
        ip_string ='::ffff:' + ip_string;
473
        ip_string ='::ffff:' + ip_string;
471
    }
474
    }
472
    // replace ipv4 address if any
475
    // replace ipv4 address if any
473
    var ipv4 = ip_string.match(/(.*:)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/);
476
    var ipv4 = ip_string.match(/(.*:)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/);
474
    if (ipv4) {
477
    if (ipv4) {
475
        ip_string = ipv4[1];
478
        ip_string = ipv4[1];
476
        ipv4 = ipv4[2].match(/[0-9]+/g);
479
        ipv4 = ipv4[2].match(/[0-9]+/g);
477
        for (var i = 0;i < 4;i ++) {
480
        for (var i = 0;i < 4;i ++) {
478
            var byte = parseInt(ipv4[i], 10);
481
            var byte = parseInt(ipv4[i], 10);
479
            if (byte<256) {
482
            if (byte<256) {
480
                ipv4[i] = ("0" + byte.toString(16)).substr(-2);
483
                ipv4[i] = ("0" + byte.toString(16)).substr(-2);
481
            } else {
484
            } else {
482
                wrongvalue = true;
485
                wrongvalue = true;
483
                break;
486
                break;
484
            }
487
            }
485
        }
488
        }
486
        if (wrongvalue) {
489
        if (wrongvalue) {
487
            ip_string = '';
490
            ip_string = '';
488
        } else {
491
        } else {
489
            ip_string += ipv4[0] + ipv4[1] + ':' + ipv4[2] + ipv4[3];
492
            ip_string += ipv4[0] + ipv4[1] + ':' + ipv4[2] + ipv4[3];
490
        }
493
        }
491
    }
494
    }
492
 
495
 
493
    if (ip_string === '') {
496
    if (ip_string === '') {
494
        return '';
497
        return '';
495
    }
498
    }
496
    // take care of leading and trailing ::
499
    // take care of leading and trailing ::
497
    ip_string = ip_string.replace(/^:|:$/g, '');
500
    ip_string = ip_string.replace(/^:|:$/g, '');
498
 
501
 
499
    var ipv6 = ip_string.split(':');
502
    var ipv6 = ip_string.split(':');
500
 
503
 
501
    for (var li = 0; li < ipv6.length; li ++) {
504
    for (var li = 0; li < ipv6.length; li ++) {
502
        var hex = ipv6[li];
505
        var hex = ipv6[li];
503
        if (hex !== "") {
506
        if (hex !== "") {
504
            if (!hex.match(/^[0-9a-f]{1,4}$/)) {
507
            if (!hex.match(/^[0-9a-f]{1,4}$/)) {
505
                wrongvalue = true;
508
                wrongvalue = true;
506
                break;
509
                break;
507
            }
510
            }
508
            // normalize leading zeros
511
            // normalize leading zeros
509
            ipv6[li] = ("0000" + hex).substr(-4);
512
            ipv6[li] = ("0000" + hex).substr(-4);
510
        }
513
        }
511
        else {
514
        else {
512
            // normalize grouped zeros ::
515
            // normalize grouped zeros ::
513
            hex = [];
516
            hex = [];
514
            for (var j = ipv6.length; j <= 8; j ++) {
517
            for (var j = ipv6.length; j <= 8; j ++) {
515
                hex.push('0000');
518
                hex.push('0000');
516
            }
519
            }
517
            ipv6[li] = hex.join(':');
520
            ipv6[li] = hex.join(':');
518
        }
521
        }
519
    }
522
    }
520
    if (!wrongvalue) {
523
    if (!wrongvalue) {
521
        var out = ipv6.join(':');
524
        var out = ipv6.join(':');
522
        if (out.length == 39) {
525
        if (out.length == 39) {
523
            return out;
526
            return out;
524
        } else {
527
        } else {
525
            return '';
528
            return '';
526
        }
529
        }
527
    } else {
530
    } else {
528
        return '';
531
        return '';
529
    }
532
    }
530
}
533
}
531
 
534
 
532
sorttable.sort_ip=function(a,b) {
535
sorttable.sort_ip=function(a,b) {
533
    var x = full_addr(a[0]);
536
    var x = full_addr(a[0]);
534
    var y = full_addr(b[0]);
537
    var y = full_addr(b[0]);
535
    if ((x === '') || (y === '')) {
538
    if ((x === '') || (y === '')) {
536
        x = a[0];
539
        x = a[0];
537
        y = b[0];
540
        y = b[0];
538
    }
541
    }
539
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
542
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
540
};
543
};
541
 
544
 
542
function items(data) {
545
function items(data) {
543
    if (data !== undefined) {
546
    if (data !== undefined) {
544
        if ((data.length > 0) &&  (data[0] !== undefined) && (data[0]["@attributes"] !== undefined)) {
547
        if ((data.length > 0) &&  (data[0] !== undefined) && (data[0]["@attributes"] !== undefined)) {
545
            return data;
548
            return data;
546
        } else if (data["@attributes"] !== undefined ) {
549
        } else if (data["@attributes"] !== undefined ) {
547
            return [data];
550
            return [data];
548
        } else {
551
        } else {
549
            return [];
552
            return [];
550
        }
553
        }
551
    } else {
554
    } else {
552
        return [];
555
        return [];
553
    }
556
    }
554
}
557
}
555
 
558
 
556
function renderVitals(data) {
559
function renderVitals(data) {
557
    var hostname = "", ip = "";
560
    var hostname = "", ip = "";
558
 
561
 
559
    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) {
562
    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) {
560
        $("#block_vitals").remove();
563
        $("#block_vitals").remove();
561
        if ((data.Vitals !== undefined) && (data.Vitals["@attributes"] !== undefined) && ((hostname = data.Vitals["@attributes"].Hostname) !== undefined) && ((ip = data.Vitals["@attributes"].IPAddr) !== undefined)) {
564
        if ((data.Vitals !== undefined) && (data.Vitals["@attributes"] !== undefined) && ((hostname = data.Vitals["@attributes"].Hostname) !== undefined) && ((ip = data.Vitals["@attributes"].IPAddr) !== undefined)) {
562
            document.title = "System information: " + hostname + " (" + ip + ")";
565
            document.title = "System information: " + hostname + " (" + ip + ")";
563
        }
566
        }
564
        return;
567
        return;
565
    }
568
    }
566
 
569
 
567
    var directives = {
570
    var directives = {
568
        Uptime: {
571
        Uptime: {
569
            html: function () {
572
            html: function () {
570
                return formatUptime(this.Uptime);
573
                return formatUptime(this.Uptime);
571
            }
574
            }
572
        },
575
        },
573
        LastBoot: {
576
        LastBoot: {
574
            text: function () {
577
            text: function () {
575
                var lastboot;
578
                var lastboot;
576
                var timestamp = 0;
579
                var timestamp = 0;
577
                var datetimeFormat;
580
                var datetimeFormat;
578
                if ((data.Generation !== undefined) && (data.Generation["@attributes"] !== undefined) && (data.Generation["@attributes"].timestamp !== undefined) ) {
581
                if ((data.Generation !== undefined) && (data.Generation["@attributes"] !== undefined) && (data.Generation["@attributes"].timestamp !== undefined) ) {
579
                    timestamp = parseInt(data.Generation["@attributes"].timestamp, 10) * 1000; //server time
582
                    timestamp = parseInt(data.Generation["@attributes"].timestamp, 10) * 1000; //server time
580
                    if (isNaN(timestamp)) timestamp = Number(new Date()); //client time
583
                    if (isNaN(timestamp)) timestamp = Number(new Date()); //client time
581
                } else {
584
                } else {
582
                    timestamp = Number(new Date()); //client time
585
                    timestamp = Number(new Date()); //client time
583
                }
586
                }
584
                lastboot = new Date(timestamp - (parseInt(this.Uptime, 10) * 1000));
587
                lastboot = new Date(timestamp - (parseInt(this.Uptime, 10) * 1000));
585
                if (((datetimeFormat = data.Options["@attributes"].datetimeFormat) !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
588
                if (((datetimeFormat = data.Options["@attributes"].datetimeFormat) !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
586
                    return lastboot.toLocaleString();
589
                    return lastboot.toLocaleString();
587
                } else {
590
                } else {
588
                    if (typeof(lastboot.toUTCString) === "function") {
591
                    if (typeof(lastboot.toUTCString) === "function") {
589
                        return lastboot.toUTCString();
592
                        return lastboot.toUTCString();
590
                    } else {
593
                    } else {
591
                    //deprecated
594
                    //deprecated
592
                        return lastboot.toGMTString();
595
                        return lastboot.toGMTString();
593
                    }
596
                    }
594
                }
597
                }
595
            }
598
            }
596
        },
599
        },
597
        Distro: {
600
        Distro: {
598
            html: function () {
601
            html: function () {
599
                return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:32px;"><img src="gfx/images/' + this.Distroicon + '" alt="" style="width:32px;height:32px;" /></td><td style="vertical-align:middle;">' + this.Distro + '</td></tr></table>';
602
                return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:32px;"><img src="gfx/images/' + this.Distroicon + '" alt="" style="width:32px;height:32px;" /></td><td style="vertical-align:middle;">' + this.Distro + '</td></tr></table>';
600
            }
603
            }
601
        },
604
        },
602
        OS: {
605
        OS: {
603
            html: function () {
606
            html: function () {
604
                return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:32px;"><img src="gfx/images/' + this.OS + '.png" alt="" style="width:32px;height:32px;" /></td><td style="vertical-align:middle;">' + this.OS + '</td></tr></table>';
607
                return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:32px;"><img src="gfx/images/' + this.OS + '.png" alt="" style="width:32px;height:32px;" /></td><td style="vertical-align:middle;">' + this.OS + '</td></tr></table>';
605
            }
608
            }
606
        },
609
        },
607
        LoadAvg: {
610
        LoadAvg: {
608
            html: function () {
611
            html: function () {
609
                if (this.CPULoad !== undefined) {
612
                if (this.CPULoad !== undefined) {
610
                    return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:50%;">'+this.LoadAvg + '</td><td><div class="progress">' +
613
                    return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:50%;">'+this.LoadAvg + '</td><td><div class="progress">' +
611
                        '<div class="progress-bar progress-bar-info" style="width:' + round(this.CPULoad,0) + '%;"></div>' +
614
                        '<div class="progress-bar progress-bar-info" style="width:' + round(this.CPULoad,0) + '%;"></div>' +
612
                        '</div><div class="percent">' + round(this.CPULoad,0) + '%</div></td></tr></table>';
615
                        '</div><div class="percent">' + round(this.CPULoad,0) + '%</div></td></tr></table>';
613
                } else {
616
                } else {
614
                    return this.LoadAvg;
617
                    return this.LoadAvg;
615
                }
618
                }
616
            }
619
            }
617
        },
620
        },
618
        Processes: {
621
        Processes: {
619
            html: function () {
622
            html: function () {
620
                var processes = "", p111 = 0, p112 = 0, p113 = 0, p114 = 0, p115 = 0, p116 = 0;
623
                var processes = "", p111 = 0, p112 = 0, p113 = 0, p114 = 0, p115 = 0, p116 = 0;
621
                var not_first = false;
624
                var not_first = false;
622
                processes = parseInt(this.Processes, 10);
625
                processes = parseInt(this.Processes, 10);
-
 
626
                if (processes > 0) {
623
                if (this.ProcessesRunning !== undefined) {
627
                    if (this.ProcessesRunning !== undefined) {
624
                    p111 = parseInt(this.ProcessesRunning, 10);
628
                        p111 = parseInt(this.ProcessesRunning, 10);
625
                }
629
                    }
626
                if (this.ProcessesSleeping !== undefined) {
630
                    if (this.ProcessesSleeping !== undefined) {
627
                    p112 = parseInt(this.ProcessesSleeping, 10);
631
                        p112 = parseInt(this.ProcessesSleeping, 10);
628
                }
632
                    }
629
                if (this.ProcessesStopped !== undefined) {
633
                    if (this.ProcessesStopped !== undefined) {
630
                    p113 = parseInt(this.ProcessesStopped, 10);
634
                        p113 = parseInt(this.ProcessesStopped, 10);
631
                }
635
                    }
632
                if (this.ProcessesZombie !== undefined) {
636
                    if (this.ProcessesZombie !== undefined) {
633
                    p114 = parseInt(this.ProcessesZombie, 10);
637
                        p114 = parseInt(this.ProcessesZombie, 10);
634
                }
638
                    }
635
                if (this.ProcessesWaiting !== undefined) {
639
                    if (this.ProcessesWaiting !== undefined) {
636
                    p115 = parseInt(this.ProcessesWaiting, 10);
640
                        p115 = parseInt(this.ProcessesWaiting, 10);
637
                }
641
                    }
638
                if (this.ProcessesOther !== undefined) {
642
                    if (this.ProcessesOther !== undefined) {
639
                    p116 = parseInt(this.ProcessesOther, 10);
643
                        p116 = parseInt(this.ProcessesOther, 10);
640
                }
644
                    }
641
                if (p111 || p112 || p113 || p114 || p115 || p116) {
645
                    if (p111 || p112 || p113 || p114 || p115 || p116) {
642
                    processes += " (";
646
                        processes += " (";
643
                    for (var proc_type in {111:0,112:1,113:2,114:3,115:4,116:5}) {
647
                        for (var proc_type in {111:0,112:1,113:2,114:3,115:4,116:5}) {
644
                        if (eval("p" + proc_type)) {
648
                            if (eval("p" + proc_type)) {
645
                            if (not_first) {
649
                                if (not_first) {
646
                                processes += ", ";
650
                                    processes += ", ";
-
 
651
                                }
-
 
652
                                processes += eval("p" + proc_type) + String.fromCharCode(160) + genlang(proc_type);
-
 
653
                                not_first = true;
647
                            }
654
                            }
648
                            processes += eval("p" + proc_type) + String.fromCharCode(160) + genlang(proc_type);
-
 
649
                            not_first = true;
-
 
650
                        }
655
                        }
-
 
656
                        processes += ")";
651
                    }
657
                    }
652
                    processes += ")";
-
 
653
                }
658
                }
654
                return processes;
659
                return processes;
655
            }
660
            }
656
        }
661
        }
657
    };
662
    };
658
 
663
 
659
    if (data.Vitals["@attributes"].SysLang === undefined) {
664
    if (data.Vitals["@attributes"].SysLang === undefined) {
660
        $("#tr_SysLang").hide();
665
        $("#tr_SysLang").hide();
661
    }
666
    }
662
    if (data.Vitals["@attributes"].CodePage === undefined) {
667
    if (data.Vitals["@attributes"].CodePage === undefined) {
663
        $("#tr_CodePage").hide();
668
        $("#tr_CodePage").hide();
664
    }
669
    }
665
    if (data.Vitals["@attributes"].Processes === undefined) {
670
    if (data.Vitals["@attributes"].Processes === undefined) {
666
        $("#tr_Processes").hide();
671
        $("#tr_Processes").hide();
667
    }
672
    }
668
    $('#vitals').render(data.Vitals["@attributes"], directives);
673
    $('#vitals').render(data.Vitals["@attributes"], directives);
669
 
674
 
670
    if ((data.Vitals !== undefined) && (data.Vitals["@attributes"] !== undefined) && ((hostname = data.Vitals["@attributes"].Hostname) !== undefined) && ((ip = data.Vitals["@attributes"].IPAddr) !== undefined)) {
675
    if ((data.Vitals !== undefined) && (data.Vitals["@attributes"] !== undefined) && ((hostname = data.Vitals["@attributes"].Hostname) !== undefined) && ((ip = data.Vitals["@attributes"].IPAddr) !== undefined)) {
671
        document.title = "System information: " + hostname + " (" + ip + ")";
676
        document.title = "System information: " + hostname + " (" + ip + ")";
672
    }
677
    }
673
 
678
 
674
    $("#block_vitals").show();
679
    $("#block_vitals").show();
675
}
680
}
676
 
681
 
677
function renderHardware(data) {
682
function renderHardware(data) {
678
    var hw_type, datas, proc_param, i;
683
    var hw_type, datas, proc_param, i;
679
 
684
 
680
    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('hardware', blocks) < 0))) {
685
    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('hardware', blocks) < 0))) {
681
        $("#block_hardware").remove();
686
        $("#block_hardware").remove();
682
        return;
687
        return;
683
    }
688
    }
684
 
689
 
685
    var directives = {
690
    var directives = {
686
        Model: {
691
        Model: {
687
            text: function () {
692
            text: function () {
688
                return this.Model;
693
                return this.Model;
689
            }
694
            }
690
        },
695
        },
691
        CpuSpeed: {
696
        CpuSpeed: {
692
            html: function () {
697
            html: function () {
693
                return formatHertz(this.CpuSpeed);
698
                return formatHertz(this.CpuSpeed);
694
            }
699
            }
695
        },
700
        },
696
        CpuSpeedMax: {
701
        CpuSpeedMax: {
697
            html: function () {
702
            html: function () {
698
                return formatHertz(this.CpuSpeedMax);
703
                return formatHertz(this.CpuSpeedMax);
699
            }
704
            }
700
        },
705
        },
701
        CpuSpeedMin: {
706
        CpuSpeedMin: {
702
            html: function () {
707
            html: function () {
703
                return formatHertz(this.CpuSpeedMin);
708
                return formatHertz(this.CpuSpeedMin);
704
            }
709
            }
705
        },
710
        },
706
        Cache: {
711
        Cache: {
707
            html: function () {
712
            html: function () {
708
                return formatBytes(this.Cache, data.Options["@attributes"].byteFormat);
713
                return formatBytes(this.Cache, data.Options["@attributes"].byteFormat);
709
            }
714
            }
710
        },
715
        },
711
        BusSpeed: {
716
        BusSpeed: {
712
            html: function () {
717
            html: function () {
713
                return formatHertz(this.BusSpeed);
718
                return formatHertz(this.BusSpeed);
714
            }
719
            }
715
        },
720
        },
716
        Cputemp: {
721
        Cputemp: {
717
            html: function () {
722
            html: function () {
718
                return formatTemp(this.Cputemp, data.Options["@attributes"].tempFormat);
723
                return formatTemp(this.Cputemp, data.Options["@attributes"].tempFormat);
719
            }
724
            }
720
        },
725
        },
-
 
726
        Voltage: {
-
 
727
            html: function() {
-
 
728
                return round(this.Voltage, 2) + ' V';
-
 
729
            }
-
 
730
        },
721
        Bogomips: {
731
        Bogomips: {
722
            text: function () {
732
            text: function () {
723
                return parseInt(this.Bogomips, 10);
733
                return parseInt(this.Bogomips, 10);
724
            }
734
            }
725
        },
735
        },
726
        Load: {
736
        Load: {
727
            html: function () {
737
            html: function () {
728
                return '<div class="progress">' +
738
                return '<div class="progress">' +
729
                        '<div class="progress-bar progress-bar-info" style="width:' + round(this.Load,0) + '%;"></div>' +
739
                        '<div class="progress-bar progress-bar-info" style="width:' + round(this.Load,0) + '%;"></div>' +
730
                        '</div><div class="percent">' + round(this.Load,0) + '%</div>';
740
                        '</div><div class="percent">' + round(this.Load,0) + '%</div>';
731
            }
741
            }
732
        }
742
        }
733
    };
743
    };
734
 
744
 
735
    var hw_directives = {
745
    var hw_directives = {
736
        hwName: {
746
        hwName: {
737
            html: function() {
747
            html: function() {
738
                return this.Name;
748
                return this.Name;
739
            }
749
            }
740
        },
750
        },
741
        hwCount: {
751
        hwCount: {
742
            text: function() {
752
            text: function() {
743
                if ((this.Count !== undefined) && !isNaN(this.Count) && (parseInt(this.Count, 10)>1)) {
753
                if ((this.Count !== undefined) && !isNaN(this.Count) && (parseInt(this.Count, 10)>1)) {
744
                    return parseInt(this.Count, 10);
754
                    return parseInt(this.Count, 10);
745
                } else {
755
                } else {
746
                    return "";
756
                    return "";
747
                }
757
                }
748
            }
758
            }
749
        }
759
        }
750
    };
760
    };
751
 
761
 
752
    var mem_directives = {
762
    var mem_directives = {
753
        Speed: {
763
        Speed: {
754
            html: function() {
764
            html: function() {
755
                return formatMTps(this.Speed);
765
                return formatMTps(this.Speed);
756
            }
766
            }
757
        },
767
        },
758
        Voltage: {
768
        Voltage: {
759
            html: function() {
769
            html: function() {
760
                return round(this.Voltage, 2) + ' V';
770
                return round(this.Voltage, 2) + ' V';
761
            }
771
            }
762
        },
772
        },
763
        Capacity: {
773
        Capacity: {
764
            html: function () {
774
            html: function () {
765
                return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
775
                return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
766
            }
776
            }
767
        }
777
        }
768
    };
778
    };
769
 
779
 
770
    var dev_directives = {
780
    var dev_directives = {
771
        Speed: {
781
        Speed: {
772
            html: function() {
782
            html: function() {
773
                return formatBPS(1000000*this.Speed);
783
                return formatBPS(1000000*this.Speed);
774
            }
784
            }
775
        },
785
        },
776
        Capacity: {
786
        Capacity: {
777
            html: function () {
787
            html: function () {
778
                return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
788
                return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
779
            }
789
            }
780
        }
790
        }
781
    };
791
    };
782
 
792
 
783
    var html="";
793
    var html="";
784
 
794
 
-
 
795
    if (data.Hardware["@attributes"] !== undefined) { 
785
    if ((data.Hardware["@attributes"] !== undefined) && (data.Hardware["@attributes"].Name !== undefined)) {
796
        if (data.Hardware["@attributes"].Name !== undefined) {
786
        html+="<tr id=\"hardware-Machine\">";
797
            html+="<tr id=\"hardware-Machine\">";
787
        html+="<th style=\"width:8%;\">"+genlang(107)+"</th>"; //Machine
798
            html+="<th style=\"width:8%;\">"+genlang(107)+"</th>"; //Machine
788
        html+="<td colspan=\"2\"><span data-bind=\"Name\"></span></td>";
799
            html+="<td colspan=\"2\"><span data-bind=\"Name\"></span></td>";
-
 
800
            html+="</tr>";
-
 
801
        }
-
 
802
        if (data.Hardware["@attributes"].Virtualizer !== undefined) {
-
 
803
            html+="<tr id=\"hardware-Virtualizer\">";
-
 
804
            html+="<th style=\"width:8%;\">"+genlang(134)+"</th>"; //Virtualizer
-
 
805
            html+="<td colspan=\"2\"><span data-bind=\"Virtualizer\"></span></td>";
789
        html+="</tr>";
806
            html+="</tr>";
-
 
807
        }
790
    }
808
    }
791
 
809
 
792
    var paramlist = {CpuSpeed:13,CpuSpeedMax:100,CpuSpeedMin:101,Cache:15,Virt:94,BusSpeed:14,Bogomips:16,Cputemp:51,Manufacturer:122,Load:9};
810
    var paramlist = {CpuSpeed:13,CpuSpeedMax:100,CpuSpeedMin:101,Cache:15,Virt:94,BusSpeed:14,Voltage:52,Bogomips:16,Cputemp:51,Manufacturer:122,Load:9};
793
    try {
811
    try {
794
        datas = items(data.Hardware.CPU.CpuCore);
812
        datas = items(data.Hardware.CPU.CpuCore);
795
        for (i = 0; i < datas.length; i++) {
813
        for (i = 0; i < datas.length; i++) {
796
             if (i === 0) {
814
             if (i === 0) {
797
                html+="<tr id=\"hardware-CPU\" class=\"treegrid-CPU\">";
815
                html+="<tr id=\"hardware-CPU\" class=\"treegrid-CPU\">";
798
                html+="<th>CPU</th>";
816
                html+="<th>CPU</th>";
799
                html+="<td><span class=\"treegrid-span\">" + genlang(119) + ":</span></td>"; //Number of processors
817
                html+="<td><span class=\"treegrid-span\">" + genlang(119) + ":</span></td>"; //Number of processors
800
                html+="<td class=\"rightCell\"><span id=\"CPUCount\"></span></td>";
818
                html+="<td class=\"rightCell\"><span id=\"CPUCount\"></span></td>";
801
                html+="</tr>";
819
                html+="</tr>";
802
            }
820
            }
803
            html+="<tr id=\"hardware-CPU-" + i +"\" class=\"treegrid-CPU-" + i +" treegrid-parent-CPU\">";
821
            html+="<tr id=\"hardware-CPU-" + i +"\" class=\"treegrid-CPU-" + i +" treegrid-parent-CPU\">";
804
            html+="<th></th>";
822
            html+="<th></th>";
805
            if (showCPULoadCompact && (datas[i]["@attributes"].Load !== undefined)) {
823
            if (showCPULoadCompact && (datas[i]["@attributes"].Load !== undefined)) {
806
                html+="<td><span class=\"treegrid-span\" data-bind=\"Model\"></span></td>";
824
                html+="<td><span class=\"treegrid-span\" data-bind=\"Model\"></span></td>";
807
                html+="<td style=\"width:15%;\" class=\"rightCell\"><span data-bind=\"Load\"></span></td>";
825
                html+="<td style=\"width:15%;\" class=\"rightCell\"><span data-bind=\"Load\"></span></td>";
808
            } else {
826
            } else {
809
                html+="<td colspan=\"2\"><span class=\"treegrid-span\" data-bind=\"Model\"></span></td>";
827
                html+="<td colspan=\"2\"><span class=\"treegrid-span\" data-bind=\"Model\"></span></td>";
810
            }
828
            }
811
            html+="</tr>";
829
            html+="</tr>";
812
            for (proc_param in paramlist) {
830
            for (proc_param in paramlist) {
813
                if (((proc_param !== 'Load') || !showCPULoadCompact) && (datas[i]["@attributes"][proc_param] !== undefined)) {
831
                if (((proc_param !== 'Load') || !showCPULoadCompact) && (datas[i]["@attributes"][proc_param] !== undefined)) {
814
                    html+="<tr id=\"hardware-CPU-" + i + "-" + proc_param + "\" class=\"treegrid-parent-CPU-" + i +"\">";
832
                    html+="<tr id=\"hardware-CPU-" + i + "-" + proc_param + "\" class=\"treegrid-parent-CPU-" + i +"\">";
815
                    html+="<th></th>";
833
                    html+="<th></th>";
816
                    html+="<td><span class=\"treegrid-span\">" + genlang(paramlist[proc_param]) + "<span></td>";
834
                    html+="<td><span class=\"treegrid-span\">" + genlang(paramlist[proc_param]) + "<span></td>";
817
                    html+="<td class=\"rightCell\"><span data-bind=\"" + proc_param + "\"></span></td>";
835
                    html+="<td class=\"rightCell\"><span data-bind=\"" + proc_param + "\"></span></td>";
818
                    html+="</tr>";
836
                    html+="</tr>";
819
                }
837
                }
820
            }
838
            }
821
 
839
 
822
        }
840
        }
823
    }
841
    }
824
    catch (err) {
842
    catch (err) {
825
        $("#hardware-CPU").hide();
843
        $("#hardware-CPU").hide();
826
    }
844
    }
827
 
845
 
828
    var devparamlist = {Capacity:43,Manufacturer:122,Product:123,Speed:129,Voltage:52,Serial:124};
846
    var devparamlist = {Capacity:43,Manufacturer:122,Product:123,Speed:129,Voltage:52,Serial:124};
829
    for (hw_type in {MEM:0,PCI:1,IDE:2,SCSI:3,NVMe:4,USB:5,TB:6,I2C:7}) {
847
    for (hw_type in {MEM:0,PCI:1,IDE:2,SCSI:3,NVMe:4,USB:5,TB:6,I2C:7}) {
830
        try {
848
        try {
831
            if (hw_type == 'MEM') {
849
            if (hw_type == 'MEM') {
832
                datas = items(data.Hardware[hw_type].Chip);
850
                datas = items(data.Hardware[hw_type].Chip);
833
            } else {
851
            } else {
834
                datas = items(data.Hardware[hw_type].Device);
852
                datas = items(data.Hardware[hw_type].Device);
835
            }
853
            }
836
            for (i = 0; i < datas.length; i++) {
854
            for (i = 0; i < datas.length; i++) {
837
                if (i === 0) {
855
                if (i === 0) {
838
                    html+="<tr id=\"hardware-" + hw_type + "\" class=\"treegrid-" + hw_type + "\">";
856
                    html+="<tr id=\"hardware-" + hw_type + "\" class=\"treegrid-" + hw_type + "\">";
839
                    html+="<th>" + hw_type + "</th>";
857
                    html+="<th>" + hw_type + "</th>";
840
                    if (hw_type == 'MEM') {
858
                    if (hw_type == 'MEM') {
841
                        html+="<td><span class=\"treegrid-span\">" + genlang('128') + ":</span></td>"; //Number of memories
859
                        html+="<td><span class=\"treegrid-span\">" + genlang('128') + ":</span></td>"; //Number of memories
842
                    } else {
860
                    } else {
843
                        html+="<td><span class=\"treegrid-span\">" + genlang('120') + ":</span></td>"; //Number of devices
861
                        html+="<td><span class=\"treegrid-span\">" + genlang('120') + ":</span></td>"; //Number of devices
844
                    }                    
862
                    }                    
845
                    html+="<td class=\"rightCell\"><span id=\"" + hw_type + "Count\"></span></td>";
863
                    html+="<td class=\"rightCell\"><span id=\"" + hw_type + "Count\"></span></td>";
846
                    html+="</tr>";
864
                    html+="</tr>";
847
                }
865
                }
848
                html+="<tr id=\"hardware-" + hw_type + "-" + i +"\" class=\"treegrid-" + hw_type + "-" + i +" treegrid-parent-" + hw_type + "\">";
866
                html+="<tr id=\"hardware-" + hw_type + "-" + i +"\" class=\"treegrid-" + hw_type + "-" + i +" treegrid-parent-" + hw_type + "\">";
849
                html+="<th></th>";
867
                html+="<th></th>";
850
                html+="<td><span class=\"treegrid-span\" data-bind=\"hwName\"></span></td>";
868
                html+="<td><span class=\"treegrid-span\" data-bind=\"hwName\"></span></td>";
851
                html+="<td class=\"rightCell\"><span data-bind=\"hwCount\"></span></td>";
869
                html+="<td class=\"rightCell\"><span data-bind=\"hwCount\"></span></td>";
852
                html+="</tr>";
870
                html+="</tr>";
853
                for (proc_param in devparamlist) {
871
                for (proc_param in devparamlist) {
854
                    if (datas[i]["@attributes"][proc_param] !== undefined) {
872
                    if (datas[i]["@attributes"][proc_param] !== undefined) {
855
                        html+="<tr id=\"hardware-" + hw_type +"-" + i + "-" + proc_param + "\" class=\"treegrid-parent-" + hw_type +"-" + i +"\">";
873
                        html+="<tr id=\"hardware-" + hw_type +"-" + i + "-" + proc_param + "\" class=\"treegrid-parent-" + hw_type +"-" + i +"\">";
856
                        html+="<th></th>";
874
                        html+="<th></th>";
857
                        html+="<td><span class=\"treegrid-span\">" + genlang(devparamlist[proc_param]) + "<span></td>";
875
                        html+="<td><span class=\"treegrid-span\">" + genlang(devparamlist[proc_param]) + "<span></td>";
858
                        html+="<td class=\"rightCell\"><span data-bind=\"" + proc_param + "\"></span></td>";
876
                        html+="<td class=\"rightCell\"><span data-bind=\"" + proc_param + "\"></span></td>";
859
                        html+="</tr>";
877
                        html+="</tr>";
860
                    }
878
                    }
861
                }
879
                }
862
            }
880
            }
863
        }
881
        }
864
        catch (err) {
882
        catch (err) {
865
            $("#hardware-data"+hw_type).hide();
883
            $("#hardware-data"+hw_type).hide();
866
        }
884
        }
867
    }
885
    }
868
    $("#hardware-data").empty().append(html);
886
    $("#hardware-data").empty().append(html);
869
 
887
 
870
 
888
 
-
 
889
    if (data.Hardware["@attributes"] !== undefined) {
871
    if ((data.Hardware["@attributes"] !== undefined) && (data.Hardware["@attributes"].Name !== undefined)) {
890
        if (data.Hardware["@attributes"].Name !== undefined) {
872
        $('#hardware-Machine').render(data.Hardware["@attributes"]);
891
            $('#hardware-Machine').render(data.Hardware["@attributes"]);
-
 
892
        }
-
 
893
        if (data.Hardware["@attributes"].Virtualizer !== undefined) {
-
 
894
            $('#hardware-Virtualizer').render(data.Hardware["@attributes"]);
-
 
895
        }
873
    }
896
    }
874
 
897
 
875
    try {
898
    try {
876
        datas = items(data.Hardware.CPU.CpuCore);
899
        datas = items(data.Hardware.CPU.CpuCore);
877
        for (i = 0; i < datas.length; i++) {
900
        for (i = 0; i < datas.length; i++) {
878
            $('#hardware-CPU-'+ i).render(datas[i]["@attributes"], directives);
901
            $('#hardware-CPU-'+ i).render(datas[i]["@attributes"], directives);
879
            for (proc_param in paramlist) {
902
            for (proc_param in paramlist) {
880
                if (((proc_param !== 'Load') || !showCPULoadCompact) && (datas[i]["@attributes"][proc_param] !== undefined)) {
903
                if (((proc_param !== 'Load') || !showCPULoadCompact) && (datas[i]["@attributes"][proc_param] !== undefined)) {
881
                    $('#hardware-CPU-'+ i +'-'+proc_param).render(datas[i]["@attributes"], directives);
904
                    $('#hardware-CPU-'+ i +'-'+proc_param).render(datas[i]["@attributes"], directives);
882
                }
905
                }
883
            }
906
            }
884
        }
907
        }
885
        if (i > 0) {
908
        if (i > 0) {
886
            $("#CPUCount").html(i);
909
            $("#CPUCount").html(i);
887
        }
910
        }
888
    }
911
    }
889
    catch (err) {
912
    catch (err) {
890
        $("#hardware-CPU").hide();
913
        $("#hardware-CPU").hide();
891
    }
914
    }
892
 
915
 
893
    var licz;
916
    var licz;
894
    for (hw_type in {MEM:0,PCI:1,IDE:2,SCSI:3,NVMe:4,USB:5,TB:6,I2C:7}) {
917
    for (hw_type in {MEM:0,PCI:1,IDE:2,SCSI:3,NVMe:4,USB:5,TB:6,I2C:7}) {
895
        try {
918
        try {
896
            licz = 0;
919
            licz = 0;
897
            if (hw_type == 'MEM') {
920
            if (hw_type == 'MEM') {
898
                datas = items(data.Hardware[hw_type].Chip);
921
                datas = items(data.Hardware[hw_type].Chip);
899
            } else {
922
            } else {
900
                datas = items(data.Hardware[hw_type].Device);
923
                datas = items(data.Hardware[hw_type].Device);
901
            }
924
            }
902
            for (i = 0; i < datas.length; i++) {
925
            for (i = 0; i < datas.length; i++) {
903
                $('#hardware-'+hw_type+'-'+ i).render(datas[i]["@attributes"], hw_directives);
926
                $('#hardware-'+hw_type+'-'+ i).render(datas[i]["@attributes"], hw_directives);
904
                if ((datas[i]["@attributes"].Count !== undefined) && !isNaN(datas[i]["@attributes"].Count) && (parseInt(datas[i]["@attributes"].Count, 10)>1)) {
927
                if ((datas[i]["@attributes"].Count !== undefined) && !isNaN(datas[i]["@attributes"].Count) && (parseInt(datas[i]["@attributes"].Count, 10)>1)) {
905
                    licz += parseInt(datas[i]["@attributes"].Count, 10);
928
                    licz += parseInt(datas[i]["@attributes"].Count, 10);
906
                } else {
929
                } else {
907
                    licz++;
930
                    licz++;
908
                }
931
                }
909
                if (hw_type == 'MEM') {
932
                if (hw_type == 'MEM') {
910
                    for (proc_param in devparamlist) {
933
                    for (proc_param in devparamlist) {
911
                        if ((datas[i]["@attributes"][proc_param] !== undefined)) {
934
                        if ((datas[i]["@attributes"][proc_param] !== undefined)) {
912
                            $('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], mem_directives);
935
                            $('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], mem_directives);
913
                        }
936
                        }
914
                    }
937
                    }
915
                } else {
938
                } else {
916
                    for (proc_param in devparamlist) {
939
                    for (proc_param in devparamlist) {
917
                        if ((datas[i]["@attributes"][proc_param] !== undefined)) {
940
                        if ((datas[i]["@attributes"][proc_param] !== undefined)) {
918
                            $('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], dev_directives);
941
                            $('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], dev_directives);
919
                        }
942
                        }
920
                    }
943
                    }
921
                }
944
                }
922
            }
945
            }
923
            if (i > 0) {
946
            if (i > 0) {
924
                $("#" + hw_type + "Count").html(licz);
947
                $("#" + hw_type + "Count").html(licz);
925
            }
948
            }
926
        }
949
        }
927
        catch (err) {
950
        catch (err) {
928
            $("#hardware-"+hw_type).hide();
951
            $("#hardware-"+hw_type).hide();
929
        }
952
        }
930
    }
953
    }
931
    $('#hardware').treegrid({
954
    $('#hardware').treegrid({
932
        initialState: 'collapsed',
955
        initialState: 'collapsed',
933
        expanderExpandedClass: 'normalicon normalicon-down',
956
        expanderExpandedClass: 'normalicon normalicon-down',
934
        expanderCollapsedClass: 'normalicon normalicon-right'
957
        expanderCollapsedClass: 'normalicon normalicon-right'
935
    });
958
    });
936
    if (showCPUListExpanded) {
959
    if (showCPUListExpanded) {
937
        try {
960
        try {
938
            $('#hardware-CPU').treegrid('expand');
961
            $('#hardware-CPU').treegrid('expand');
939
        }
962
        }
940
        catch (err) {
963
        catch (err) {
941
        }
964
        }
942
    }
965
    }
943
    if (showCPUInfoExpanded && showCPUListExpanded) {
966
    if (showCPUInfoExpanded && showCPUListExpanded) {
944
        try {
967
        try {
945
            datas = items(data.Hardware.CPU.CpuCore);
968
            datas = items(data.Hardware.CPU.CpuCore);
946
            for (i = 0; i < datas.length; i++) {
969
            for (i = 0; i < datas.length; i++) {
947
                $('#hardware-CPU-'+i).treegrid('expand');
970
                $('#hardware-CPU-'+i).treegrid('expand');
948
            }
971
            }
949
        }
972
        }
950
        catch (err) {
973
        catch (err) {
951
        }
974
        }
952
    }
975
    }
953
    $("#block_hardware").show();
976
    $("#block_hardware").show();
954
}
977
}
955
 
978
 
956
function renderMemory(data) {
979
function renderMemory(data) {
957
    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('memory', blocks) < 0))) {
980
    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('memory', blocks) < 0))) {
958
        $("#block_memory").remove();
981
        $("#block_memory").remove();
959
        return;
982
        return;
960
    }
983
    }
961
 
984
 
962
    var directives = {
985
    var directives = {
963
        Total: {
986
        Total: {
964
            html: function () {
987
            html: function () {
965
                return formatBytes(this["@attributes"].Total, data.Options["@attributes"].byteFormat);
988
                return formatBytes(this["@attributes"].Total, data.Options["@attributes"].byteFormat);
966
            }
989
            }
967
        },
990
        },
968
        Free: {
991
        Free: {
969
            html: function () {
992
            html: function () {
970
                return formatBytes(this["@attributes"].Free, data.Options["@attributes"].byteFormat);
993
                return formatBytes(this["@attributes"].Free, data.Options["@attributes"].byteFormat);
971
            }
994
            }
972
        },
995
        },
973
        Used: {
996
        Used: {
974
            html: function () {
997
            html: function () {
975
                return formatBytes(this["@attributes"].Used, data.Options["@attributes"].byteFormat);
998
                return formatBytes(this["@attributes"].Used, data.Options["@attributes"].byteFormat);
976
            }
999
            }
977
        },
1000
        },
978
        Usage: {
1001
        Usage: {
979
            html: function () {
1002
            html: function () {
980
                if ((this.Details === undefined) || (this.Details["@attributes"] === undefined)) {
1003
                if ((this.Details === undefined) || (this.Details["@attributes"] === undefined)) {
981
                    return '<div class="progress">' +
1004
                    return '<div class="progress">' +
982
                        '<div class="progress-bar progress-bar-info" style="width:' + this["@attributes"].Percent + '%;"></div>' +
1005
                        '<div class="progress-bar progress-bar-info" style="width:' + this["@attributes"].Percent + '%;"></div>' +
983
                        '</div><div class="percent">' + this["@attributes"].Percent + '%</div>';
1006
                        '</div><div class="percent">' + this["@attributes"].Percent + '%</div>';
984
                } else {
1007
                } else {
985
                    var rest = parseInt(this["@attributes"].Percent, 10);
1008
                    var rest = parseInt(this["@attributes"].Percent, 10);
986
                    var html = '<div class="progress">';
1009
                    var html = '<div class="progress">';
987
                    if ((this.Details["@attributes"].AppPercent !== undefined) && (this.Details["@attributes"].AppPercent > 0)) {
1010
                    if ((this.Details["@attributes"].AppPercent !== undefined) && (this.Details["@attributes"].AppPercent > 0)) {
988
                        html += '<div class="progress-bar progress-bar-info" style="width:' + this.Details["@attributes"].AppPercent + '%;"></div>';
1011
                        html += '<div class="progress-bar progress-bar-info" style="width:' + this.Details["@attributes"].AppPercent + '%;"></div>';
989
                        rest -= parseInt(this.Details["@attributes"].AppPercent, 10);
1012
                        rest -= parseInt(this.Details["@attributes"].AppPercent, 10);
990
                    }
1013
                    }
991
                    if ((this.Details["@attributes"].CachedPercent !== undefined) && (this.Details["@attributes"].CachedPercent > 0)) {
1014
                    if ((this.Details["@attributes"].CachedPercent !== undefined) && (this.Details["@attributes"].CachedPercent > 0)) {
992
                        html += '<div class="progress-bar progress-bar-warning" style="width:' + this.Details["@attributes"].CachedPercent + '%;"></div>';
1015
                        html += '<div class="progress-bar progress-bar-warning" style="width:' + this.Details["@attributes"].CachedPercent + '%;"></div>';
993
                        rest -= parseInt(this.Details["@attributes"].CachedPercent, 10);
1016
                        rest -= parseInt(this.Details["@attributes"].CachedPercent, 10);
994
                    }
1017
                    }
995
                    if ((this.Details["@attributes"].BuffersPercent !== undefined) && (this.Details["@attributes"].BuffersPercent > 0)) {
1018
                    if ((this.Details["@attributes"].BuffersPercent !== undefined) && (this.Details["@attributes"].BuffersPercent > 0)) {
996
                        html += '<div class="progress-bar progress-bar-danger" style="width:' + this.Details["@attributes"].BuffersPercent + '%;"></div>';
1019
                        html += '<div class="progress-bar progress-bar-danger" style="width:' + this.Details["@attributes"].BuffersPercent + '%;"></div>';
997
                        rest -= parseInt(this.Details["@attributes"].BuffersPercent, 10);
1020
                        rest -= parseInt(this.Details["@attributes"].BuffersPercent, 10);
998
                    }
1021
                    }
999
                    if (rest > 0) {
1022
                    if (rest > 0) {
1000
                        html += '<div class="progress-bar progress-bar-success" style="width:' + rest + '%;"></div>';
1023
                        html += '<div class="progress-bar progress-bar-success" style="width:' + rest + '%;"></div>';
1001
                    }
1024
                    }
1002
                    html += '</div>';
1025
                    html += '</div>';
1003
                    html += '<div class="percent">' + 'Total: ' + this["@attributes"].Percent + '% ' + '<i>(';
1026
                    html += '<div class="percent">' + 'Total: ' + this["@attributes"].Percent + '% ' + '<i>(';
1004
                    var not_first = false;
1027
                    var not_first = false;
1005
                    if (this.Details["@attributes"].AppPercent !== undefined) {
1028
                    if (this.Details["@attributes"].AppPercent !== undefined) {
1006
                        html += genlang(64) + ': '+ this.Details["@attributes"].AppPercent + '%'; //Kernel + apps
1029
                        html += genlang(64) + ': '+ this.Details["@attributes"].AppPercent + '%'; //Kernel + apps
1007
                        not_first = true;
1030
                        not_first = true;
1008
                    }
1031
                    }
1009
                    if (this.Details["@attributes"].CachedPercent !== undefined) {
1032
                    if (this.Details["@attributes"].CachedPercent !== undefined) {
1010
                        if (not_first) html += ' - ';
1033
                        if (not_first) html += ' - ';
1011
                        html += genlang(66) + ': ' + this.Details["@attributes"].CachedPercent + '%'; //Cache
1034
                        html += genlang(66) + ': ' + this.Details["@attributes"].CachedPercent + '%'; //Cache
1012
                        not_first = true;
1035
                        not_first = true;
1013
                    }
1036
                    }
1014
                    if (this.Details["@attributes"].BuffersPercent !== undefined) {
1037
                    if (this.Details["@attributes"].BuffersPercent !== undefined) {
1015
                        if (not_first) html += ' - ';
1038
                        if (not_first) html += ' - ';
1016
                        html += genlang(65) + ': ' + this.Details["@attributes"].BuffersPercent + '%'; //Buffers
1039
                        html += genlang(65) + ': ' + this.Details["@attributes"].BuffersPercent + '%'; //Buffers
1017
                    }
1040
                    }
1018
                    html += ')</i></div>';
1041
                    html += ')</i></div>';
1019
                    return html;
1042
                    return html;
1020
                }
1043
                }
1021
            }
1044
            }
1022
        },
1045
        },
1023
        Type: {
1046
        Type: {
1024
            html: function () {
1047
            html: function () {
1025
                return genlang(28); //Physical Memory
1048
                return genlang(28); //Physical Memory
1026
            }
1049
            }
1027
        }
1050
        }
1028
    };
1051
    };
1029
 
1052
 
1030
    var directive_swap = {
1053
    var directive_swap = {
1031
        Total: {
1054
        Total: {
1032
            html: function () {
1055
            html: function () {
1033
                return formatBytes(this.Total, data.Options["@attributes"].byteFormat);
1056
                return formatBytes(this.Total, data.Options["@attributes"].byteFormat);
1034
            }
1057
            }
1035
        },
1058
        },
1036
        Free: {
1059
        Free: {
1037
            html: function () {
1060
            html: function () {
1038
                return formatBytes(this.Free, data.Options["@attributes"].byteFormat);
1061
                return formatBytes(this.Free, data.Options["@attributes"].byteFormat);
1039
            }
1062
            }
1040
        },
1063
        },
1041
        Used: {
1064
        Used: {
1042
            html: function () {
1065
            html: function () {
1043
                return formatBytes(this.Used, data.Options["@attributes"].byteFormat);
1066
                return formatBytes(this.Used, data.Options["@attributes"].byteFormat);
1044
            }
1067
            }
1045
        },
1068
        },
1046
        Usage: {
1069
        Usage: {
1047
            html: function () {
1070
            html: function () {
1048
                return '<div class="progress">' +
1071
                return '<div class="progress">' +
1049
                    '<div class="progress-bar progress-bar-info" style="width:' + this.Percent + '%;"></div>' +
1072
                    '<div class="progress-bar progress-bar-info" style="width:' + this.Percent + '%;"></div>' +
1050
                    '</div><div class="percent">' + this.Percent + '%</div>';
1073
                    '</div><div class="percent">' + this.Percent + '%</div>';
1051
            }
1074
            }
1052
        },
1075
        },
1053
        Name: {
1076
        Name: {
1054
            html: function () {
1077
            html: function () {
1055
                return this.Name + '<br>' + ((this.MountPoint !== undefined) ? this.MountPoint : this.MountPointID);
1078
                return this.Name + '<br>' + ((this.MountPoint !== undefined) ? this.MountPoint : this.MountPointID);
1056
            }
1079
            }
1057
        }
1080
        }
1058
    };
1081
    };
1059
 
1082
 
1060
    var data_memory = [];
1083
    var data_memory = [];
1061
    if (data.Memory.Swap !== undefined) {
1084
    if (data.Memory.Swap !== undefined) {
1062
        var datas = items(data.Memory.Swap.Mount);
1085
        var datas = items(data.Memory.Swap.Mount);
1063
        data_memory.push_attrs(datas);
1086
        data_memory.push_attrs(datas);
1064
        $('#swap-data').render(data_memory, directive_swap);
1087
        $('#swap-data').render(data_memory, directive_swap);
1065
        $('#swap-data').show();
1088
        $('#swap-data').show();
1066
    } else {
1089
    } else {
1067
        $('#swap-data').hide();
1090
        $('#swap-data').hide();
1068
    }
1091
    }
1069
    $('#memory-data').render(data.Memory, directives);
1092
    $('#memory-data').render(data.Memory, directives);
1070
    $("#block_memory").show();
1093
    $("#block_memory").show();
1071
}
1094
}
1072
 
1095
 
1073
function renderFilesystem(data) {
1096
function renderFilesystem(data) {
1074
    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('filesystem', blocks) < 0))) {
1097
    if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('filesystem', blocks) < 0))) {
1075
        $("#block_filesystem").remove();
1098
        $("#block_filesystem").remove();
1076
        return;
1099
        return;
1077
    }
1100
    }
1078
 
1101
 
1079
    var directives = {
1102
    var directives = {
1080
        Total: {
1103
        Total: {
1081
            html: function () {
1104
            html: function () {
1082
                return formatBytes(this.Total, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore > 0) && showtotals);
1105
                return formatBytes(this.Total, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore > 0) && showtotals);
1083
            }
1106
            }
1084
        },
1107
        },
1085
        Free: {
1108
        Free: {
1086
            html: function () {
1109
            html: function () {
1087
                return formatBytes(this.Free, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore > 0) && showtotals);
1110
                return formatBytes(this.Free, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore > 0) && showtotals);
1088
            }
1111
            }
1089
        },
1112
        },
1090
        Used: {
1113
        Used: {
1091
            html: function () {
1114
            html: function () {
1092
                return formatBytes(this.Used, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore >= 3) && showtotals);
1115
                return formatBytes(this.Used, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore >= 3) && showtotals);
1093
            }
1116
            }
1094
        },
1117
        },
1095
        MountPoint: {
1118
        MountPoint: {
1096
            text: function () {
1119
            text: function () {
1097
                return ((this.MountPoint !== undefined) ? this.MountPoint : this.MountPointID);
1120
                return ((this.MountPoint !== undefined) ? this.MountPoint : this.MountPointID);
1098
            }
1121
            }
1099
        },
1122
        },
1100
        Name: {
1123
        Name: {
1101
            html: function () {
1124
            html: function () {
1102
                return this.Name.replace(/;/g, ";<wbr>") + ((this.MountOptions !== undefined) ? '<br><i>(' + this.MountOptions + ')</i>' : '');
1125
                return this.Name.replace(/;/g, ";<wbr>") + ((this.MountOptions !== undefined) ? '<br><i>(' + this.MountOptions + ')</i>' : '');
1103
            }
1126
            }
1104
        },
1127
        },
1105
        Percent: {
1128
        Percent: {
1106
            html: function () {
1129
            html: function () {
1107
                var used1 = (this.Total != 0) ? Math.ceil((this.Used / this.Total) * 100) : 0;
1130
                var used1 = (this.Total != 0) ? Math.ceil((this.Used / this.Total) * 100) : 0;
1108
                var used2 = Math.ceil(this.Percent);
1131
                var used2 = Math.ceil(this.Percent);
1109
                var used21= used2 - used1;
1132
                var used21= used2 - used1;
1110
                if (used21 > 0) {
1133
                if (used21 > 0) {
1111
                    return '
' + '
1134
                    return '
' + '
1112
 
1135
 
1113
 
1136
 
1114
 
1137
 
1115
 
1138
 
1116
 
1139
 
1117
 
1140
 
1118
 
1141
 
1119
 
1142
 
1120
 
1143
 
1121
 
1144
 
1122
 
1145
 
1123
 
1146
 
1124
 
1147
 
1125
 
1148
 
1126
 
1149
 
1127
 
1150
 
1128
 
1151
 
1129
 
1152
 
1130
 
1153
 
1131
 
1154
 
1132
 
1155
 
1133
 
1156
 
1134
 
1157
 
1135
 
1158
 
1136
 
1159
 
1137
 
1160
 
1138
 
1161
 
1139
 
1162
 
1140
 
1163
 
1141
 
1164
 
1142
 
1165
 
1143
 
1166
 
1144
 
1167
 
1145
 
1168
 
1146
 
1169
 
1147
 
1170
 
1148
 
1171
 
1149
 
1172
 
1150
 
1173
 
1151
 
1174
 
1152
 
1175
 
1153
 
1176
 
1154
 
1177
 
1155
 
1178
 
1156
 
1179
 
1157
 
1180
 
1158
 
1181
 
1159
 
1182
 
1160
 
1183
 
1161
 
1184
 
1162
 
1185
 
1163
 
1186
 
1164
 
1187
 
1165
 
1188
 
1166
 
1189
 
1167
 
1190
 
1168
 
1191
 
1169
 
1192
 
1170
 
1193
 
1171
 
1194
 
1172
 
1195
 
1173
 
1196
 
1174
 
1197
 
1175
 
1198
 
1176
 
1199
 
1177
 
1200
 
1178
 
1201
 
1179
 
1202
 
1180
 
1203
 
1181
 
1204
 
1182
 
1205
 
1183
 
1206
 
1184
 
1207
 
1185
 
1208
 
1186
 
1209
 
1187
 
1210
 
1188
 
1211
 
1189
 
1212
 
1190
 
1213
 
1191
 
1214
 
1192
 
1215
 
1193
 
1216
 
1194
 
1217
 
1195
 
1218
 
1196
 
1219
 
1197
 
1220
 
1198
 
1221
 
1199
 
1222
 
1200
 
1223
 
1201
 
1224
 
1202
 
1225
 
1203
 
1226
 
1204
 
1227
 
1205
 
1228
 
1206
 
1229
 
1207
 
1230
 
1208
 
1231
 
1209
 
1232
 
1210
 
1233
 
1211
 
1234
 
1212
 
1235
 
1213
 
1236
 
1214
 
1237
 
1215
 
1238
 
1216
 
1239
 
1217
 
1240
 
1218
 
1241
 
1219
 
1242
 
1220
 
1243
 
1221
 
1244
 
1222
 
1245
 
1223
 
1246
 
1224
 
1247
 
1225
 
1248
 
1226
 
1249
 
1227
 
1250
 
1228
 
1251
 
1229
 
1252
 
1230
 
1253
 
1231
 
1254
 
1232
 
1255
 
1233
 
1256
 
1234
 
1257
 
1235
 
1258
 
1236
 
1259
 
1237
 
1260
 
1238
 
1261
 
1239
 
1262
 
1240
 
1263
 
1241
 
1264
 
1242
 
1265
 
1243
 
1266
 
1244
 
1267
 
1245
 
1268
 
1246
 
1269
 
1247
 
1270
 
1248
 
1271
 
1249
 
1272
 
1250
 
1273
 
1251
 
1274
 
1252
 
1275
 
1253
 
1276
 
1254
 
1277
 
1255
 
1278
 
1256
 
1279
 
1257
 
1280
 
1258
 
1281
 
1259
 
1282
 
1260
 
1283
 
1261
 
1284
 
1262
 
1285
 
1263
 
1286
 
1264
 
1287
 
1265
 
1288
 
1266
 
1289
 
1267
 
1290
 
1268
 
1291
 
1269
 
1292
 
1270
 
1293
 
1271
 
1294
 
1272
 
1295
 
1273
 
1296
 
1274
 
1297
 
1275
 
1298
 
1276
 
1299
 
1277
 
1300
 
1278
 
1301
 
1279
 
1302
 
1280
 
1303
 
1281
 
1304
 
1282
 
1305
 
1283
 
1306
 
1284
 
1307
 
1285
 
1308
 
1286
 
1309
 
1287
 
1310
 
1288
 
1311
 
1289
 
1312
 
1290
 
1313
 
1291
 
1314
 
1292
 
1315
 
1293
 
1316
 
1294
 
1317
 
1295
 
1318
 
1296
 
1319
 
1297
 
1320
 
1298
 
1321
 
1299
 
1322
 
1300
 
1323
 
1301
 
1324
 
1302
 
1325
 
1303
 
1326
 
1304
 
1327
 
1305
 
1328
 
1306
 
1329
 
1307
 
1330
 
1308
 
1331
 
1309
 
1332
 
1310
 
1333
 
1311
 
1334
 
1312
 
1335
 
1313
 
1336
 
1314
 
1337
 
1315
 
1338
 
1316
 
1339
 
1317
 
1340
 
1318
 
1341
 
1319
 
1342
 
1320
 
1343
 
1321
 
1344
 
1322
 
1345
 
1323
 
1346
 
1324
 
1347
 
1325
 
1348
 
1326
 
1349
 
1327
 
1350
 
1328
 
1351
 
1329
 
1352
 
1330
 
1353
 
1331
 
1354
 
1332
 
1355
 
1333
 
1356
 
1334
 
1357
 
1335
 
1358
 
1336
 
1359
 
1337
 
1360
 
1338
 
1361
 
1339
 
1362
 
1340
 
1363
 
1341
 
1364
 
1342
 
1365
 
1343
 
1366
 
1344
 
1367
 
1345
 
1368
 
1346
 
1369
 
1347
 
1370
 
1348
 
1371
 
1349
 
1372
 
1350
 
1373
 
1351
 
1374
 
1352
 
1375
 
1353
 
1376
 
1354
 
1377
 
1355
 
1378
 
1356
 
1379
 
1357
 
1380
 
1358
 
1381
 
1359
 
1382
 
1360
 
1383
 
1361
 
1384
 
1362
 
1385
 
1363
 
1386
 
1364
 
1387
 
1365
 
1388
 
1366
 
1389
 
1367
 
1390
 
1368
 
1391
 
1369
 
1392
 
1370
 
1393
 
1371
 
1394
 
1372
 
1395
 
1373
 
1396
 
1374
 
1397
 
1375
 
1398
 
1376
 
1399
 
1377
 
1400
 
1378
 
1401
 
1379
 
1402
 
1380
 
1403
 
1381
 
1404
 
1382
 
1405
 
1383
 
1406
 
1384
 
1407
 
1385
 
1408
 
1386
 
1409
 
1387
 
1410
 
1388
 
1411
 
1389
 
1412
 
1390
 
1413
 
1391
 
1414
 
1392
 
1415
 
1393
 
1416
 
1394
 
1417
 
1395
 
1418
 
1396
 
1419
 
1397
 
1420
 
1398
 
1421
 
1399
 
1422
 
1400
 
1423
 
1401
 
1424
 
1402
 
1425
 
1403
 
1426
 
1404
 
1427
 
1405
 
1428
 
1406
 
1429
 
1407
 
1430
 
1408
 
1431
 
1409
 
1432
 
1410
 
1433
 
1411
 
1434
 
1412
 
1435
 
1413
 
1436
 
1414
 
1437
 
1415
 
1438
 
1416
 
1439
 
1417
 
1440
 
1418
 
1441
 
1419
 
1442
 
1420
 
1443
 
1421
 
1444
 
1422
 
1445
 
1423
 
1446
 
1424
 
1447
 
1425
 
1448
 
1426
 
1449
 
1427
 
1450
 
1428
 
1451
 
1429
 
1452
 
1430
 
1453
 
1431
 
1454
 
1432
 
1455
 
1433
 
1456
 
1434
 
1457
 
1435
 
1458
 
1436
 
1459
 
1437
 
1460
 
1438
 
1461
 
1439
 
1462
 
1440
 
1463
 
1441
 
1464
 
1442
 
1465
 
1443
 
1466
 
1444
 
1467
 
1445
 
1468
 
1446
 
1469
 
1447
 
1470
 
1448
 
1471
 
1449
 
1472
 
1450
 
1473
 
1451
 
1474
 
1452
 
1475
 
1453
 
1476
 
1454
 
1477
 
1455
 
1478
 
1456
 
1479
 
1457
 
1480
 
1458
 
1481
 
1459
 
1482
 
1460
 
1483
 
1461
 
1484
 
1462
 
1485
 
1463
 
1486
 
1464
 
1487
 
1465
 
1488
 
1466
 
1489
 
1467
 
1490
 
1468
 
1491
 
1469
 
1492
 
1470
 
1493
 
1471
 
1494
 
1472
 
1495
 
1473
 
1496
 
1474
 
1497
 
1475
 
1498
 
1476
 
1499
 
1477
 
1500
 
1478
 
1501
 
1479
 
1502
 
1480
 
1503
 
1481
 
1504
 
1482
 
1505
 
1483
 
1506
 
1484
 
1507
 
1485
 
1508
 
1486
 
1509
 
1487
 
1510
 
1488
 
1511
 
1489
 
1512
 
1490
 
1513
 
1491
 
1514
 
1492
 
1515
 
1493
 
1516
 
1494
 
1517
 
1495
 
1518
 
1496
 
1519
 
1497
 
1520
 
1498
 
1521
 
1499
 
1522
 
1500
 
1523
 
1501
 
1524
 
1502
 
1525
 
1503
 
1526
 
1504
 
1527
 
1505
 
1528
 
1506
 
1529
 
1507
 
1530
 
1508
 
1531
 
1509
 
1532
 
1510
 
1533
 
1511
 
1534
 
1512
 
1535
 
1513
 
1536
 
1514
 
1537
 
1515
 
1538
 
1516
 
1539
 
1517
 
1540
 
1518
 
1541
 
1519
 
1542
 
1520
 
1543
 
1521
 
1544
 
1522
 
1545
 
1523
 
1546
 
1524
 
1547
 
1525
 
1548
 
1526
 
1549
 
1527
 
1550
 
1528
 
1551
 
1529
 
1552
 
1530
 
1553
 
1531
 
1554
 
1532
 
1555
 
1533
 
1556
 
1534
 
1557
 
1535
 
1558
 
1536
 
1559
 
1537
 
1560
 
1538
 
1561
 
1539
 
1562
 
1540
 
1563
 
1541
 
1564
 
1542
 
1565
 
1543
 
1566
 
1544
 
1567
 
1545
 
1568
 
1546
 
1569
 
1547
 
1570
 
1548
 
1571
 
1549
 
1572
 
1550
 
1573
 
1551
 
1574
 
1552
 
1575
 
1553
 
1576
 
1554
 
1577
 
1555
 
1578
 
1556
 
1579
 
1557
 
1580
 
1558
 
1581
 
1559
 
1582
 
1560
 
1583
 
1561
 
1584
 
1562
 
1585
 
1563
 
1586
 
1564
 
1587
 
1565
 
1588
 
1566
 
1589
 
1567
 
1590
 
1568
 
1591
 
1569
 
1592
 
1570
 
1593
 
1571
 
1594
 
1572
 
1595
 
1573
 
1596
 
1574
 
1597
 
1575
 
1598
 
1576
 
1599
 
1577
 
1600
 
1578
 
1601
 
1579
 
1602
 
1580
 
1603
 
1581
 
1604
 
1582
 
1605
 
1583
 
1606
 
1584
 
1607
 
1585
 
1608
 
1586
 
1609
 
1587
 
1610
 
1588
 
1611
 
1589
 
1612
 
1590
 
1613
 
1591
 
1614
 
1592
 
1615
 
1593
 
1616
 
1594
 
1617
 
1595
 
1618
 
1596
 
1619
 
1597
 
1620
 
1598
 
1621
 
1599
 
1622
 
1600
 
1623
 
1601
 
1624
 
1602
 
1625
 
1603
 
1626
 
1604
 
1627
 
1605
 
1628
 
1606
 
1629
 
1607
 
1630
 
1608
 
1631
 
1609
 
1632
 
1610
 
1633
 
1611
 
1634
 
1612
 
1635
 
1613
 
1636
 
1614
 
1637
 
1615
 
1638
 
1616
 
1639
 
1617
 
1640
 
1618
 
1641
 
1619
 
1642
 
1620
 
1643
 
1621
 
1644
 
1622
 
1645
 
1623
 
1646
 
1624
 
1647
 
1625
 
1648
 
1626
 
1649
 
1627
 
1650
 
1628
 
1651
 
1629
 
1652
 
1630
 
1653
 
1631
 
1654
 
1632
 
1655
 
1633
 
1656
 
1634
 
1657
 
1635
 
1658
 
1636
 
1659
 
1637
 
1660
 
1638
 
1661
 
1639
 
1662
 
1640
 
1663
 
1641
 
1664
 
1642
 
1665
 
1643
 
1666
 
1644
 
1667
 
1645
 
1668
 
1646
 
1669
 
1647
 
1670
 
1648
 
1671
 
1649
 
1672
 
1650
 
1673
 
1651
 
1674
 
1652
 
1675
 
1653
 
1676
 
1654
 
1677
 
1655
 
1678
 
1656
 
1679
 
1657
 
1680
 
1658
 
1681
 
1659
 
1682
 
1660
 
1683
 
1661
 
1684
 
1662
 
1685
 
1663
 
1686
 
1664
 
1687
 
1665
 
1688
 
1666
 
1689
 
1667
 
1690
 
1668
 
1691
 
1669
 
1692
 
1670
 
1693
 
1671
 
1694
 
1672
 
1695
 
1673
 
1696
 
1674
 
1697
 
1675
 
1698
 
1676
 
1699
 
1677
 
1700
 
1678
 
1701
 
1679
 
1702
 
1680
 
1703
 
1681
 
1704
 
1682
 
1705
 
1683
 
1706
 
1684
 
1707
 
1685
 
1708
 
1686
 
1709
 
1687
 
1710
 
1688
 
1711
 
1689
 
1712
 
1690
 
1713
 
1691
 
1714
 
1692
 
1715
 
1693
 
1716
 
1694
 
1717
 
1695
 
1718
 
1696
 
1719
 
1697
 
1720
 
1698
 
1721
 
1699
 
1722
 
1700
 
1723
 
1701
 
1724
 
1702
 
1725
 
1703
 
1726
 
1704
 
1727
 
1705
 
1728
 
1706
 
1729
 
1707
 
1730
 
1708
 
1731
 
1709
 
1732
 
1710
 
1733
 
1711
 
1734
 
1712
 
1735
 
1713
 
1736
 
1714
 
1737
 
1715
 
1738
 
1716
 
1739
 
1717
 
1740
 
1718
 
1741
 
1719
 
1742
 
1720
return round((((9 * degree) / 5) + 32), 1) + String.fromCharCode(160) + genlang(61) + "<br><i>(" + round(degree, 1) + String.fromCharCode(160) + genlang(60) + ")</i>";
1743
return round((((9 * degree) / 5) + 32), 1) + String.fromCharCode(160) + genlang(61) + "<br><i>(" + round(degree, 1) + String.fromCharCode(160) + genlang(60) + ")</i>";
1721
 
1744
 
1722
 
1745
 
1723
 
1746
 
1724
 
1747
 
1725
 
1748
 
1726
 
1749
 
1727
 
1750
 
1728
 
1751
 
1729
 
1752
 
1730
 
1753
 
1731
if ((mhertz >= 0) && (mhertz < 1000)) {
1754
if ((mhertz >= 0) && (mhertz < 1000)) {
1732
 
1755
 
1733
 
1756
 
1734
< 1000)) { if (mhertz >= 1000) {
1757
< 1000)) { if (mhertz >= 1000) {
1735
 
1758
 
1736
 
1759
 
1737
 
1760
 
1738
 
1761
 
1739
 
1762
 
1740
 
1763
 
1741
 
1764
 
1742
 
1765
 
1743
 
1766
 
1744
 
1767
 
1745
 
1768
 
1746
 
1769
 
1747
 
1770
 
1748
 
1771
 
1749
 
1772
 
1750
 
1773
 
1751
 
1774
 
1752
 
1775
 
1753
 
1776
 
1754
 
1777
 
1755
 
1778
 
1756
 
1779
 
1757
 
1780
 
1758
 
1781
 
1759
 
1782
 
1760
 
1783
 
1761
 
1784
 
1762
 
1785
 
1763
 
1786
 
1764
 
1787
 
1765
 
1788
 
1766
 
1789
 
1767
 
1790
 
1768
 
1791
 
1769
 
1792
 
1770
 
1793
 
1771
 
1794
 
1772
 
1795
 
1773
 
1796
 
1774
 
1797
 
1775
 
1798
 
1776
 
1799
 
1777
 
1800
 
1778
 
1801
 
1779
 
1802
 
1780
 
1803
 
1781
 
1804
 
1782
 
1805
 
1783
 
1806
 
1784
 
1807
 
1785
 
1808
 
1786
 
1809
 
1787
 
1810
 
1788
 
1811
 
1789
 
1812
 
1790
 
1813
 
1791
 
1814
 
1792
 
1815
 
1793
 
1816
 
1794
 
1817
 
1795
 
1818
 
1796
 
1819
 
1797
 
1820
 
1798
 
1821
 
1799
 
1822
 
1800
 
1823
 
1801
 
1824
 
1802
 
1825
 
1803
 
1826
 
1804
 
1827
 
1805
 
1828
 
1806
 
1829
 
1807
 
1830
 
1808
 
1831
 
1809
 
1832
 
1810
 
1833
 
1811
 
1834
 
1812
 
1835
 
1813
 
1836
 
1814
 
1837
 
1815
 
1838
 
1816
 
1839
 
1817
 
1840
 
1818
 
1841
 
1819
 
1842
 
1820
 
1843
 
1821
< 1000)) { if (bytes > Math.pow(1000, 5)) {
1844
< 1000)) { if (bytes > Math.pow(1000, 5)) {
1822
 
1845
 
1823
 
1846
 
1824
 
1847
 
1825
 
1848
 
1826
 
1849
 
1827
 
1850
 
1828
 
1851
 
1829
< 1000)) { if (bytes > Math.pow(1000, 3)) {
1852
< 1000)) { if (bytes > Math.pow(1000, 3)) {
1830
 
1853
 
1831
 
1854
 
1832
 
1855
 
1833
 
1856
 
1834
 
1857
 
1835
 
1858
 
1836
 
1859
 
1837
< 1000)) { if (bytes > Math.pow(1000, 1)) {
1860
< 1000)) { if (bytes > Math.pow(1000, 1)) {
1838
 
1861
 
1839
 
1862
 
1840
 
1863
 
1841
 
1864
 
1842
 
1865
 
1843
 
1866
 
1844
 
1867
 
1845
 
1868
 
1846
 
1869
 
1847
 
1870
 
1848
 
1871
 
1849
 
1872
 
1850
 
1873
 
1851
 
1874
 
1852
 
1875
 
1853
 
1876
 
1854
< 1000)) { if (bytes > Math.pow(1024, 4)) {
1877
< 1000)) { if (bytes > Math.pow(1024, 4)) {
1855
 
1878
 
1856
 
1879
 
1857
 
1880
 
1858
 
1881
 
1859
 
1882
 
1860
 
1883
 
1861
 
1884
 
1862
< 1000)) { if (bytes > Math.pow(1024, 2)) {
1885
< 1000)) { if (bytes > Math.pow(1024, 2)) {
1863
 
1886
 
1864
 
1887
 
1865
 
1888
 
1866
 
1889
 
1867
 
1890
 
1868
 
1891
 
1869
 
1892
 
1870
 
1893
 
1871
 
1894
 
1872
 
1895
 
1873
 
1896
 
1874
 
1897
 
1875
 
1898
 
1876
 
1899
 
1877
 
1900
 
1878
 
1901
 
1879
 
1902
 
1880
 
1903
 
1881
< 1000)) { return "<span style='display:none'>" + round(bytes,0) + ".</span>" + show; //span for sorting
1904
< 1000)) { return "<span style='display:none'>" + round(bytes,0) + ".</span>" + show; //span for sorting
1882
 
1905
 
1883
 
1906
 
1884
 
1907
 
1885
 
1908
 
1886
 
1909
 
1887
< 1000)) { if (bps > Math.pow(1000, 5)) {
1910
< 1000)) { if (bps > Math.pow(1000, 5)) {
1888
 
1911
 
1889
 
1912
 
1890
 
1913
 
1891
 
1914
 
1892
 
1915
 
1893
 
1916
 
1894
 
1917
 
1895
 
1918
 
1896
 
1919
 
1897
 
1920
 
1898
 
1921
 
1899
< 1000)) { if (bps > Math.pow(1000, 2)) {
1922
< 1000)) { if (bps > Math.pow(1000, 2)) {
1900
 
1923
 
1901
 
1924
 
1902
 
1925
 
1903
 
1926
 
1904
 
1927
 
1905
 
1928
 
1906
 
1929
 
1907
 
1930
 
1908
 
1931
 
1909
 
1932
 
1910
 
1933
 
1911
 
1934
 
1912
 
1935
 
1913
 
1936
 
1914
 
1937
 
1915
 
1938
 
1916
 
1939
 
1917
 
1940
 
1918
 
1941
 
1919
 
1942
 
1920
 
1943
 
1921
 
1944
 
1922
 
1945
 
1923
 
1946
 
1924
 
1947
 
1925
 
1948
 
1926
 
1949
 
1927
 
1950
 
1928
 
1951
 
1929
 
1952
 
1930
 
1953
 
1931
 
1954
 
1932
 
1955
 
1933
 
1956
 
1934
 
1957
 
1935
 
1958
 
1936
 
1959
 
1937
 
1960
 
1938
 
1961
 
1939
 
1962
 
1940
 
1963
 
1941
 
1964
 
1942
 
1965
 
1943
 
1966
 
1944
 
1967
 
1945
 
1968
 
1946
 
1969
 
1947
 
1970
 
1948
 
1971
 
1949
 
1972
 
1950
 
1973
 
1951
 
1974
 
1952
 
1975
 
1953
 
1976
 
1954
 
1977
 
1955
 
1978
 
1956
 
1979
 
1957
 
1980
 
1958
 
1981
 
1959
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); if (n < 0 || n > 14) {
1982
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); if (n < 0 || n > 14) {
1960
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return 0;
1983
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return 0;
1961
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }
1984
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }
1962
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > if (n === 0) {
1985
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > if (n === 0) {
1963
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return Math.round(x);
1986
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return Math.round(x);
1964
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > } else {
1987
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > } else {
1965
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > e = Math.pow(10, n);
1988
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > e = Math.pow(10, n);
1966
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k = (Math.round(x * e) / e).toString();
1989
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k = (Math.round(x * e) / e).toString();
1967
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > if (k.indexOf('.') === -1) {
1990
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > if (k.indexOf('.') === -1) {
1968
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k += '.';
1991
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k += '.';
1969
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }
1992
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }
1970
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k += e.toString().substring(1);
1993
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k += e.toString().substring(1);
1971
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return k.substring(0, k.indexOf('.') + n + 1);
1994
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return k.substring(0, k.indexOf('.') + n + 1);
1972
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }
1995
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }
1973
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n >}
1996
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n >}
1974
 
1997