diff options
author | Bill Marquette <bill.marquette@gmail.com> | 2009-03-14 01:25:46 -0500 |
---|---|---|
committer | Bill Marquette <bill.marquette@gmail.com> | 2009-03-14 01:26:52 -0500 |
commit | 01da41cf8a21a07734e25a5bce4c2d35f81a0134 (patch) | |
tree | 3500d038d20cbf08e1d6dc3102304cf5f5df1f1b /usr/local/www/javascript/index/sajax.js | |
parent | 9050b9f970dc6531c749be488f57f7c14a89b77a (diff) | |
download | pfsense-01da41cf8a21a07734e25a5bce4c2d35f81a0134.zip pfsense-01da41cf8a21a07734e25a5bce4c2d35f81a0134.tar.gz |
Sajax is no more, long live Prototype
This eliminates one AJAX library, but not all "non-Prototype" AJAX code
Diffstat (limited to 'usr/local/www/javascript/index/sajax.js')
-rw-r--r-- | usr/local/www/javascript/index/sajax.js | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/usr/local/www/javascript/index/sajax.js b/usr/local/www/javascript/index/sajax.js deleted file mode 100644 index f44f8f0..0000000 --- a/usr/local/www/javascript/index/sajax.js +++ /dev/null @@ -1,148 +0,0 @@ - -/* 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; - -function updateMeters() { - x_get_stats(stats); - window.setTimeout('updateMeters()', update_interval); -} - -function stats(x) { - var values = x.split("|"); - if (values.find(function(value){ - if (value == 'undefined' || value == null) - return true; - 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]); -} - -function updateMemory(x) { - if($('memusagemeter')) - $("memusagemeter").value = x + '%'; - if($('memwidtha')) - $("memwidtha").style.width = x + 'px'; - if($('memwidthb')) - $("memwidthb").style.width = (100 - x) + 'px'; -} - -function updateCPU(x) { - if($('cpumeter')) - $("cpumeter").value = x + '%'; - if($('cpuwidtha')) - $("cpuwidtha").style.width = x + 'px'; - if($('cpuwidthb')) - $("cpuwidthb").style.width = (100 - x) + 'px'; - /* Load CPU Graph widget if enabled */ - if(typeof GraphValue == 'function') { - GraphValue(graph[0], x); - } -} - -function updateTemp(x) { - if($("tempmeter")) { - $("tempmeter").value = x + 'C'; - $("tempwidtha").style.width = x + 'px'; - $("tempwidthb").style.width = (100 - x) + 'px'; - } -} - -function updateDateTime(x) { - if($('datetime')) - $("datetime").firstChild.data = x; -} - -function updateUptime(x) { - if($('uptime')) - $("uptime").value = x; -} - -function updateState(x) { - if($('pfstate')) - $("pfstate").value = x; -} - -function updateGatewayStats(x){ - if (widgetActive("gateways")){ - gateways_split = x.split(","); - var counter = 1; - for (var y=0; y<gateways_split.length-1; y++){ - if($('gateway' + counter)) { - $('gateway' + counter).update(gateways_split[y]); - counter++; - } - } - } -} - -function updateInterfaceStats(x){ - if (widgetActive("interface_statistics")){ - statistics_split = x.split(","); - var counter = 1; - for (var y=0; y<statistics_split.length-1; y++){ - if($('stat' + counter)) { - $('stat' + counter).update(statistics_split[y]); - counter++; - } - } - } -} - -function updateInterfaces(x){ - if (widgetActive("interfaces")){ - interfaces = x.split("~"); - interfaces.each(function(iface){ - details = iface.split(","); - switch(details[1]) { - case "up": - $(details[0] + '-up').style.display = "inline"; - $(details[0] + '-down').style.display = "none"; - $(details[0] + '-block').style.display = "none"; - $(details[0] + '-ip').update(details[2]); - $(details[0] + '-media').update(details[3]); - break; - case "down": - $(details[0] + '-down').style.display = "inline"; - $(details[0] + '-up').style.display = "none"; - $(details[0] + '-block').style.display = "none"; - $(details[0] + '-ip').update(details[2]); - $(details[0] + '-media').update(details[3]); - break; - case "block": - $(details[0] + '-block').style.display = "inline"; - $(details[0] + '-down').style.display = "none"; - $(details[0] + '-up').style.display = "none"; - break; - } - }); - } -} - -function widgetActive(x) { - var widget = document.getElementById(x + '-container'); - if (widget.style.display != "none") - return true; - else - return false; -} - -/* start ajax helper "thread" if not started */ -if(!ajaxStarted) { - window.setTimeout('updateMeters()', update_interval); - var ajaxStarted = true; -} - |