Subversion Repositories ALCASAR

Rev

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

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

return round((((9 * degree) / 5) + 32), 1) + String.fromCharCode(160) + genlang(61) + "<br><i>(" + round(degree, 1) + String.fromCharCode(160) + genlang(60) + ")</i>";

1720
return round((((9 * degree) / 5) + 32), 1) + String.fromCharCode(160) + genlang(61) + "<br><i>(" + round(degree, 1) + String.fromCharCode(160) + genlang(60) + ")</i>";
1624
 
1721
 
1625
 
1722
 
1626
 
1723
 
1627
 
1724
 
1628
 
1725
 
1629
 
1726
 
1630
 
1727
 
1631
 
1728
 
1632
 
1729
 
1633
 
1730
 
1634
<= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {< 0))) {

if ((mhertz >= 0) && (mhertz < 1000)) {

1731
if ((mhertz >= 0) && (mhertz < 1000)) {
1635
 
1732
 
1636
 
1733
 
1637
<= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {< 0))) {

< 1000)) { if (mhertz >= 1000) {

1734
< 1000)) { if (mhertz >= 1000) {
1638
 
1735
 
1639
 
1736
 
-
 
1737
 
-
 
1738
 
-
 
1739
 
-
 
1740
 
-
 
1741
 
-
 
1742
 
-
 
1743
 
-
 
1744
 
-
 
1745
 
-
 
1746
 
-
 
1747
 
-
 
1748
 
-
 
1749
 
-
 
1750
 
-
 
1751
 
-
 
1752
 
-
 
1753
 
1640
 
1754
 
1641
 
1755
 
1642
 
1756
 
1643
 
1757
 
1644
 
1758
 
1645
 
1759
 
1646
 
1760
 
1647
 
1761
 
1648
 
1762
 
1649
 
1763
 
1650
 
1764
 
1651
 
1765
 
1652
 
1766
 
1653
 
1767
 
1654
 
1768
 
1655
 
1769
 
1656
 
1770
 
1657
 
1771
 
1658
 
1772
 
1659
 
1773
 
1660
 
1774
 
1661
 
1775
 
1662
 
1776
 
1663
 
1777
 
1664
 
1778
 
1665
 
1779
 
1666
 
1780
 
1667
 
1781
 
1668
 
1782
 
1669
 
1783
 
1670
 
1784
 
1671
 
1785
 
1672
 
1786
 
1673
 
1787
 
1674
 
1788
 
1675
 
1789
 
1676
 
1790
 
1677
 
1791
 
1678
 
1792
 
1679
 
1793
 
1680
 
1794
 
1681
 
1795
 
1682
 
1796
 
1683
 
1797
 
1684
 
1798
 
1685
 
1799
 
1686
 
1800
 
1687
 
1801
 
1688
 
1802
 
1689
 
1803
 
1690
 
1804
 
1691
 
1805
 
1692
 
1806
 
1693
 
1807
 
1694
 
1808
 
1695
 
1809
 
1696
 
1810
 
1697
 
1811
 
1698
 
1812
 
1699
 
1813
 
1700
 
1814
 
1701
 
1815
 
1702
 
1816
 
1703
 
1817
 
1704
 
1818
 
1705
 
1819
 
1706
 
1820
 
1707
 
1821
< 1000)) { if (bytes > Math.pow(1000, 5)) {
1708
 
1822
 
1709
 
1823
 
1710
 
1824
 
1711
<= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {< 0))) {

< 1000)) { if (bytes > Math.pow(1000, 4)) {

1825
 
1712
 
1826
 
1713
 
1827
 
1714
 
1828
 
1715
 
1829
< 1000)) { if (bytes > Math.pow(1000, 3)) {
1716
 
1830
 
1717
 
1831
 
1718
 
1832
 
1719
<= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {< 0))) {

< 1000)) { if (bytes > Math.pow(1000, 2)) {

1833
 
1720
 
1834
 
1721
 
1835
 
1722
 
1836
 
1723
 
1837
< 1000)) { if (bytes > Math.pow(1000, 1)) {
1724
 
1838
 
1725
 
1839
 
1726
 
1840
 
1727
 
1841
 
1728
 
1842
 
1729
 
1843
 
1730
 
1844
 
1731
 
1845
 
1732
 
1846
 
1733
 
1847
 
1734
 
1848
 
1735
 
1849
 
1736
<= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {< 0))) {

< 1000)) { if (bytes > Math.pow(1024, 5)) {

1850
 
1737
 
1851
 
1738
 
1852
 
1739
 
1853
 
1740
 
1854
< 1000)) { if (bytes > Math.pow(1024, 4)) {
1741
 
1855
 
1742
 
1856
 
1743
 
1857
 
1744
<= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {< 0))) {

< 1000)) { if (bytes > Math.pow(1024, 3)) {

1858
 
1745
 
1859
 
1746
 
1860
 
1747
 
1861
 
1748
 
1862
< 1000)) { if (bytes > Math.pow(1024, 2)) {
1749
 
1863
 
1750
 
1864
 
1751
 
1865
 
1752
<= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {< 0))) {

< 1000)) { if (bytes > Math.pow(1024, 1)) {

1866
 
1753
 
1867
 
1754
 
1868
 
1755
 
1869
 
1756
 
1870
 
1757
 
1871
 
1758
 
1872
 
1759
 
1873
 
1760
 
1874
 
1761
 
1875
 
1762
 
1876
 
1763
 
1877
 
1764
 
1878
 
1765
 
1879
 
1766
 
1880
 
1767
 
1881
< 1000)) { return "<span style='display:none'>" + round(bytes,0) + ".</span>" + show; //span for sorting
1768
 
1882
 
1769
 
1883
 
1770
 
1884
 
1771
 
1885
 
1772
 
1886
 
1773
 
1887
< 1000)) { if (bps > Math.pow(1000, 5)) {
1774
 
1888
 
1775
 
1889
 
1776
 
1890
 
1777
 
1891
 
1778
 
1892
 
1779
 
1893
 
1780
 
1894
 
1781
<= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {< 0))) {

< 1000)) { if (bps > Math.pow(1000, 3)) {

1895
 
1782
 
1896
 
1783
 
1897
 
1784
 
1898
 
1785
 
1899
< 1000)) { if (bps > Math.pow(1000, 2)) {
1786
 
1900
 
1787
 
1901
 
1788
 
1902
 
1789
 
1903
 
1790
 
1904
 
1791
 
1905
 
1792
 
1906
 
1793
 
1907
 
1794
 
1908
 
1795
 
1909
 
1796
 
1910
 
1797
 
1911
 
1798
 
1912
 
1799
 
1913
 
1800
 
1914
 
1801
 
1915
 
1802
 
1916
 
1803
 
1917
 
1804
 
1918
 
1805
 
1919
 
1806
 
1920
 
1807
 
1921
 
1808
 
1922
 
1809
 
1923
 
1810
 
1924
 
1811
 
1925
 
1812
 
1926
 
1813
 
1927
 
1814
 
1928
 
1815
 
1929
 
1816
 
1930
 
1817
 
1931
 
1818
 
1932
 
1819
 
1933
 
1820
 
1934
 
1821
 
1935
 
1822
 
1936
 
1823
 
1937
 
1824
 
1938
 
1825
 
1939
 
1826
 
1940
 
1827
 
1941
 
1828
 
1942
 
1829
 
1943
 
1830
 
1944
 
1831
 
1945
 
1832
 
1946
 
1833
 
1947
 
1834
 
1948
 
1835
 
1949
 
1836
 
1950
 
1837
 
1951
 
1838
 
1952
 
1839
 
1953
 
1840
 
1954
 
1841
 
1955
 
1842
 
1956
 
1843
 
1957
 
1844
 
1958
 
1845
 
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) {
1846
 
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;
1847
 
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 > }
1848
 
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) {
1849
 
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);
1850
 
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 {
1851
 
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);
1852
 
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();
1853
 
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) {
1854
 
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 += '.';
1855
 
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 > }
1856
 
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);
1857
 
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);
1858
 
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 > }
1859
 
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 >}
1860
 
1974
 
1861
 
-
 
1862
 
-
 
1863
 
-
 
1864
 
-
 
1865
 
-