| 2,6 → 2,13 |
| showCPUListExpanded, showCPUInfoExpanded, showNetworkInfosExpanded, showNetworkActiveSpeed, showCPULoadCompact, oldnetwork = [], refrTimer; |
| |
| /** |
| * Fix potential XSS vulnerability in jQuery |
| */ |
| jQuery.htmlPrefilter = function( html ) { |
| return html; |
| }; |
| |
| /** |
| * generate a cookie, if not exist, and add an entry to it<br><br> |
| * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a> |
| * @param {String} name name that holds the value |
| 231,6 → 238,7 |
| } |
| }, |
| success: function (data) { |
| var refrtime; |
| // console.log(data); |
| // data_dbg = data; |
| if ((typeof(initiate) === 'boolean') && (data.Options !== undefined) && (data.Options["@attributes"] !== undefined) && ((refrtime = data.Options["@attributes"].refresh) !== undefined) && (refrtime !== "0")) { |
| 293,7 → 301,7 |
| try { |
| for (var propertyName in data.Plugins) { |
| if ((data.Plugins[propertyName]["@attributes"] !== undefined) && |
| ((hostname = data.Plugins[propertyName]["@attributes"]["Hostname"]) !== undefined)) { |
| ((hostname = data.Plugins[propertyName]["@attributes"].Hostname) !== undefined)) { |
| $('span[class=hostname_' + pluginname + ']').html(hostname); |
| } |
| break; |
| 323,7 → 331,13 |
| }); |
| } |
| |
| if ((ua=useragent.match(/Version\/(\d+)\.[\d\.]+ (Mobile\/\S+ )?Safari\//)) !== null) { |
| if ((ua=useragent.match(/Midori\/(\d+)\.?(\d+)?/)) !== null) { |
| if ((ua[1]==0) && (ua.length==3) && (ua[2]<=4)) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori04.css'); |
| } else if ((ua[1]==0) && (ua.length==3) && (ua[2]==5)) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori05.css'); |
| } |
| } else if ((ua=useragent.match(/\(KHTML, like Gecko\) Version\/(\d+)\.[\d\.]+ (Mobile\/\S+ )?Safari\//)) !== null) { |
| if (ua[1]<=5) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari5.css'); |
| } else if (ua[1]<=8) { |
| 339,12 → 353,6 |
| } else if (ua[1]==28) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox28.css'); |
| } |
| } else if ((ua=useragent.match(/Midori\/(\d+)\.?(\d+)?/)) !== null) { |
| if ((ua[1]==0) && (ua.length==3) && (ua[2]<=4)) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori04.css'); |
| } else if ((ua[1]==0) && (ua.length==3) && (ua[2]==5)) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori05.css'); |
| } |
| } else if ((ua=useragent.match(/Chrome\/(\d+)\.[\d\.]+/)) !== null) { |
| if (ua[1]<=25) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome25.css'); |
| 351,7 → 359,11 |
| } else if (ua[1]<=28) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome28.css'); |
| } |
| } else if ((ua=useragent.match(/^Opera\/.*Version\/(\d+)\.[\d\.]+$/)) !== null) { |
| if (ua[1]<=11) { |
| $("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-opera11.css'); |
| } |
| } |
| |
| $(window).resize(); |
| |
| 599,12 → 611,12 |
| }, |
| Distro: { |
| html: function () { |
| 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>'; |
| 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="" title="' + this.Distroicon + '" style="width:32px;height:32px;" /></td><td style="vertical-align:middle;">' + this.Distro + '</td></tr></table>'; |
| } |
| }, |
| OS: { |
| html: function () { |
| 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>'; |
| 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="" title="' + this.OS + '.png" style="width:32px;height:32px;" /></td><td style="vertical-align:middle;">' + this.OS + '</td></tr></table>'; |
| } |
| }, |
| LoadAvg: { |
| 620,36 → 632,37 |
| }, |
| Processes: { |
| html: function () { |
| var processes = "", p111 = 0, p112 = 0, p113 = 0, p114 = 0, p115 = 0, p116 = 0; |
| var processes = 0, psarray = [0,0,0,0,0,0]; |
| var not_first = false; |
| processes = parseInt(this.Processes, 10); |
| if (processes > 0) { |
| if (this.ProcessesRunning !== undefined) { |
| p111 = parseInt(this.ProcessesRunning, 10); |
| psarray[0] = parseInt(this.ProcessesRunning, 10); |
| } |
| if (this.ProcessesSleeping !== undefined) { |
| p112 = parseInt(this.ProcessesSleeping, 10); |
| psarray[1] = parseInt(this.ProcessesSleeping, 10); |
| } |
| if (this.ProcessesStopped !== undefined) { |
| p113 = parseInt(this.ProcessesStopped, 10); |
| psarray[2] = parseInt(this.ProcessesStopped, 10); |
| } |
| if (this.ProcessesZombie !== undefined) { |
| p114 = parseInt(this.ProcessesZombie, 10); |
| psarray[3] = parseInt(this.ProcessesZombie, 10); |
| } |
| if (this.ProcessesWaiting !== undefined) { |
| p115 = parseInt(this.ProcessesWaiting, 10); |
| psarray[4] = parseInt(this.ProcessesWaiting, 10); |
| } |
| if (this.ProcessesOther !== undefined) { |
| p116 = parseInt(this.ProcessesOther, 10); |
| psarray[5] = parseInt(this.ProcessesOther, 10); |
| } |
| if (p111 || p112 || p113 || p114 || p115 || p116) { |
| if (psarray[0] || psarray[1] || psarray[2] || psarray[3] || psarray[4] || psarray[5]) { |
| processes += " ("; |
| for (var proc_type in {111:0,112:1,113:2,114:3,115:4,116:5}) { |
| if (eval("p" + proc_type)) { |
| var idlist = {0:111,1:112,2:113,3:114,4:115,5:116}; |
| for (var proc_type in idlist) { |
| if (psarray[proc_type]) { |
| if (not_first) { |
| processes += ", "; |
| } |
| processes += eval("p" + proc_type) + String.fromCharCode(160) + genlang(proc_type); |
| processes += psarray[proc_type] + String.fromCharCode(160) + genlang(idlist[proc_type]); |
| not_first = true; |
| } |
| } |
| 728,7 → 741,7 |
| }, |
| Voltage: { |
| html: function() { |
| return round(this.Voltage, 2) + genlang(82); //V |
| return round(this.Voltage, 2) + String.fromCharCode(160) + genlang(62); //V |
| } |
| }, |
| Bogomips: { |
| 770,7 → 783,7 |
| }, |
| Voltage: { |
| html: function() { |
| return round(this.Voltage, 2) + genlang(82); //V |
| return round(this.Voltage, 2) + String.fromCharCode(160) + genlang(62); //V |
| } |
| }, |
| Capacity: { |
| 1130,8 → 1143,8 |
| }, |
| Percent: { |
| html: function () { |
| var used1 = (this.Total != 0) ? Math.ceil((this.Used / this.Total) * 100) : 0; |
| var used2 = Math.ceil(this.Percent); |
| var used1 = Math.max(Math.min((this.Total != 0) ? Math.ceil((this.Used / this.Total) * 100) : 0, 100), 0); |
| var used2 = Math.max(Math.min(Math.ceil(this.Percent), 100), 0); |
| var used21= used2 - used1; |
| if (used21 > 0) { |
| return '<div class="progress">' + '<div class="' + |
| 1138,8 → 1151,8 |
| ( ( ((this.Ignore == undefined) || (this.Ignore < 4)) && ((data.Options["@attributes"].threshold !== undefined) && |
| (parseInt(this.Percent, 10) >= parseInt(data.Options["@attributes"].threshold, 10))) ) ? 'progress-bar progress-bar-danger' : 'progress-bar progress-bar-info' ) + |
| '" style="width:' + used1 + '% ;"></div>' + |
| '<div class="progress-bar progress-bar-warning" style="width:' + used21 + '% ;"></div>' |
| +'</div><div class="percent">' + this.Percent + '% ' + ((this.Inodes !== undefined) ? '<i>(' + this.Inodes + '%)</i>' : '') + '</div>'; |
| '<div class="progress-bar progress-bar-warning" style="width:' + used21 + '% ;"></div>' + |
| '</div><div class="percent">' + this.Percent + '% ' + ((this.Inodes !== undefined) ? '<i>(' + this.Inodes + '%)</i>' : '') + '</div>'; |
| } else { |
| return '<div class="progress">' + '<div class="' + |
| ( ( ((this.Ignore == undefined) || (this.Ignore < 4)) && ((data.Options["@attributes"].threshold !== undefined) && |
| 1200,6 → 1213,15 |
| } |
| |
| var directives = { |
| Name: { |
| text: function () { |
| if (this.Bridge !== undefined) { |
| return this.Name + " (" + this.Bridge + ")"; |
| } else { |
| return this.Name; |
| } |
| } |
| }, |
| RxBytes: { |
| html: function () { |
| var htmladd = ''; |
| 1317,7 → 1339,7 |
| var directives = { |
| Value: { |
| text: function () { |
| return round(this.Value,2) + String.fromCharCode(160) + "V"; |
| return (isFinite(this.Value)?round(this.Value,2):"---") + String.fromCharCode(160) + "V"; |
| } |
| }, |
| Min: { |
| 1409,11 → 1431,14 |
| Value: { |
| html: function () { |
| if (this.Unit === "%") { |
| if (isFinite(this.Value)) |
| return '<div class="progress">' + |
| '<div class="progress-bar progress-bar-info" style="width:' + round(this.Value,0) + '%;"></div>' + |
| '</div><div class="percent">' + round(this.Value,0) + '%</div>'; |
| else |
| return '---%'; |
| } else { |
| return round(this.Value,0) + String.fromCharCode(160) + genlang(63); //RPM |
| return (isFinite(this.Value)?round(this.Value,0):"---") + String.fromCharCode(160) + genlang(63); //RPM |
| } |
| } |
| }, |
| 1462,7 → 1487,7 |
| var directives = { |
| Value: { |
| text: function () { |
| return round(this.Value,2) + String.fromCharCode(160) + "W"; |
| return (isFinite(this.Value)?round(this.Value,2):"---") + String.fromCharCode(160) + "W"; |
| } |
| }, |
| Max: { |
| 1505,7 → 1530,7 |
| var directives = { |
| Value: { |
| text: function () { |
| return round(this.Value,2) + String.fromCharCode(160) + "A"; |
| return (isFinite(this.Value)?round(this.Value,2):"---") + String.fromCharCode(160) + "A"; |
| } |
| }, |
| Min: { |
| 1555,10 → 1580,12 |
| Value: { |
| html: function () { |
| if (this.Unit === "%") { |
| if (isFinite(this.Value)) |
| return '<div class="progress">' + |
| '<div class="progress-bar progress-bar-info" style="width:' + round(this.Value,0) + '%;"></div>' + |
| '</div><div class="percent">' + round(this.Value,0) + '%</div>'; |
| // return round(this.Value,0) + "%"; |
| else |
| return '---%'; |
| } else { |
| return this.Value; |
| } |