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