From: Jean-Philippe Orsini Date: Thu, 14 Jul 2011 15:02:42 +0000 (+0000) Subject: added missing js file X-Git-Tag: v0.8.0.5~716 X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=commitdiff_plain;h=c445c380ac6e070eb63ce2df8f5fa83aaee01a6a added missing js file --- diff --git a/www/psensor.js b/www/psensor.js new file mode 100644 index 0000000..79757ea --- /dev/null +++ b/www/psensor.js @@ -0,0 +1,53 @@ +function format_mem_size(s) { + var mo_bytes = 1024 * 1024; + var go_bytes = 1024 * mo_bytes; + + var o = s % 1024; + var k = Math.round((s / 1024) % 1024); + var m = Math.round((s / (1024*1024)) % 1024); + var g = Math.round(s / (1024*1024*1024)); + + if (g >= 1) + return g+"Go "; + + if (m >= 1) + return m+"Mo"; + + if (k >= 1) + return k+"Ko"; + + if (o > 0) + return o+"o"; + + return "0"; +}; + +function type_to_str(stype) { + var stype_str = "N/A"; + + if (stype & 0x0100) { + stype_str = "Sensor"; + } else if (stype & 0x0200) { + stype_str = "NVidia"; + } else if (stype & 0x0400) { + stype_str = "HDD"; + } else if (stype & 0x0800) { + stype_str = "Fan"; + } + + if (stype & 0x0001) { + stype_str += " Temperature"; + } + + return stype_str; +}; + +function type_to_unit(stype) { + if (stype & 0x0001) { + unit = " C"; + } else if (stype & 0x0002) { + unit = " RPM"; + } + + return unit; +}