summaryrefslogtreecommitdiffstats
path: root/usr/local/www/javascript/index/ajax.js
diff options
context:
space:
mode:
authorJoecowboy <i7wasn7m3@gmail.com>2012-01-05 18:04:57 -0600
committerJoecowboy <i7wasn7m3@gmail.com>2012-01-05 18:04:57 -0600
commite54d3461b47dd6610f2a4a95c7e38a2740f5291f (patch)
treeb718136b6d85ccb18a408aae3157cffef6f69c75 /usr/local/www/javascript/index/ajax.js
parent54f818b16f18c73b0b2689239a94abbce337cd13 (diff)
downloadpfsense-e54d3461b47dd6610f2a4a95c7e38a2740f5291f.zip
pfsense-e54d3461b47dd6610f2a4a95c7e38a2740f5291f.tar.gz
Fixed Javascript error in function updateInterfaces(x)
Removed the return that revented the updates to widgets in function stats(x) Tweaked Javascript code in function updateTemp(x) for temperature output
Diffstat (limited to 'usr/local/www/javascript/index/ajax.js')
-rw-r--r--usr/local/www/javascript/index/ajax.js47
1 files changed, 25 insertions, 22 deletions
diff --git a/usr/local/www/javascript/index/ajax.js b/usr/local/www/javascript/index/ajax.js
index 1759c05..bafdbff 100644
--- a/usr/local/www/javascript/index/ajax.js
+++ b/usr/local/www/javascript/index/ajax.js
@@ -1,9 +1,9 @@
-
/* Most widgets update their backend data every 10 seconds. 11 seconds
* will ensure that we update the GUI right after the stats are updated.
* Seconds * 1000 = value
*/
-var update_interval = 11000;
+var Seconds = 11;
+var update_interval = (Math.abs(Math.ceil(Seconds))-1)*1000 + 990;
function updateMeters() {
url = '/getstats.php';
@@ -16,7 +16,11 @@ function updateMeters() {
stats(data);
}
});
- setTimeout('updateMeters()', update_interval);
+ setTimer();
+}
+
+function setTimer() {
+ timeout = window.setTimeout('updateMeters()', update_interval);
}
function stats(x) {
@@ -27,17 +31,16 @@ function stats(x) {
else
return false;
}))
- return;
-
- updateCPU(values[0]);
- updateMemory(values[1]);
- updateUptime(values[2]);
- updateState(values[3]);
- updateTemp(values[4]);
- updateDateTime(values[5]);
- updateInterfaceStats(values[6]);
- updateInterfaces(values[7]);
- updateGatewayStats(values[8]);
+
+ updateUptime(values[2]);
+ updateDateTime(values[5]);
+ updateCPU(values[0]);
+ updateMemory(values[1]);
+ updateState(values[3]);
+ updateTemp(values[4]);
+ updateInterfaceStats(values[6]);
+ updateInterfaces(values[7]);
+ updateGatewayStats(values[8]);
}
function updateMemory(x) {
@@ -63,11 +66,12 @@ function updateCPU(x) {
}
function updateTemp(x) {
- if(jQuery("#tempmeter")) {
- jQuery("#tempmeter").val(x + 'C');
+ if(jQuery("#tempmeter"))
+ jQuery("#tempmeter").val(x + '\u00B0' + 'C');
+ if(jQuery('#tempwidtha'))
jQuery("#tempwidtha").css('width',x + 'px');
+ if(jQuery('#tempwidthb'))
jQuery("#tempwidthb").css('width',(100 - x) + 'px');
- }
}
function updateDateTime(x) {
@@ -111,8 +115,8 @@ function updateInterfaceStats(x){
function updateInterfaces(x){
if (widgetActive("interfaces")){
- interfaces = x.split("~");
- interfaces.each(function(iface){
+ interfaces_split = x.split("~");
+ interfaces_split.each(function(iface){
details = iface.split(",");
switch(details[1]) {
case "up":
@@ -149,6 +153,5 @@ function widgetActive(x) {
/* start updater */
jQuery(document).ready(function(){
- setTimeout('updateMeters()', update_interval);
-});
-
+ setTimer();
+}); \ No newline at end of file
OpenPOWER on IntegriCloud