summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorVinicius Coque <vcoque@gmail.com>2011-10-22 20:13:06 -0200
committerVinicius Coque <vcoque@gmail.com>2011-10-22 20:13:06 -0200
commite03ef9a02cb3b3e328be1eab5230114483082853 (patch)
treee5c7dc1f4011fc6e6bbc9ceb8f79b64f319d7a04 /usr
parent78d84a88e0f87ad2b44aa8f3c6b5d37fee2135e7 (diff)
downloadpfsense-e03ef9a02cb3b3e328be1eab5230114483082853.zip
pfsense-e03ef9a02cb3b3e328be1eab5230114483082853.tar.gz
Converting ajax code from prototype to jQuery
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/diag_dump_states.php18
-rwxr-xr-xusr/local/www/status_graph.php37
-rw-r--r--usr/local/www/status_openvpn.php16
3 files changed, 34 insertions, 37 deletions
diff --git a/usr/local/www/diag_dump_states.php b/usr/local/www/diag_dump_states.php
index a8671c1..56d527f 100755
--- a/usr/local/www/diag_dump_states.php
+++ b/usr/local/www/diag_dump_states.php
@@ -74,18 +74,18 @@ include("head.inc");
<script type="text/javascript">
function removeState(srcip, dstip) {
- var busy = function(icon) {
- icon.onclick = "";
- icon.src = icon.src.replace("\.gif", "_d.gif");
- icon.style.cursor = "wait";
+ var busy = function(index,icon) {
+ jQuery(icon).bind("onclick","");
+ jQuery(icon).attr('src',jQuery(icon).attr('src').replace("\.gif", "_d.gif"));
+ jQuery(icon).css("cursor","wait");
}
- $A(document.getElementsByName("i:" + srcip + ":" + dstip)).each(busy);
+ jQuery('img[name="i:' + srcip + ":" + dstip + '"]').each(busy);
- new Ajax.Request(
+ jQuery.ajax(
"<?=$_SERVER['SCRIPT_NAME'];?>" +
"?action=remove&srcip=" + srcip + "&dstip=" + dstip,
- { method: "get", onComplete: removeComplete }
+ { type: "get", complete: removeComplete }
);
}
@@ -96,8 +96,8 @@ include("head.inc");
return;
}
- $A(document.getElementsByName("r:" + values[1] + ":" + values[2])).each(
- function(row) { Effect.Fade(row, { duration: 1.0 }); }
+ jQuery('tr[name="r:' + values[1] + ":" + values[2] + '"]').each(
+ function(index,row) { jQuery(row).fadeOut(1000); }
);
}
</script>
diff --git a/usr/local/www/status_graph.php b/usr/local/www/status_graph.php
index bc689ab..628c9bc 100755
--- a/usr/local/www/status_graph.php
+++ b/usr/local/www/status_graph.php
@@ -103,21 +103,20 @@ function bandwidthAjax(hostinterface) {
uri = "bandwidth_by_ip.php?if=" + hostinterface;
var opt = {
// Use GET
- method: 'get',
- asynchronous: true,
- // Handle 404
- on404: function(t) {
- alert('Error 404: location "' + t.statusText + '" was not found.');
+ type: 'get',
+ error: function(req) {
+ // Handle 404
+ if(req.status == 404)
+ alert('Error 404: location "' + uri + '" was not found.');
+ // Handle other errors
+ else
+ alert('Error ' + req.status + ' -- ' + req.statusText);
},
- // Handle other errors
- onFailure: function(t) {
- alert('Error ' + t.status + ' -- ' + t.statusText);
- },
- onSuccess: function(t) {
- updateBandwidthHosts(t.responseText);
+ success: function(data) {
+ updateBandwidthHosts(data);
}
}
- new Ajax.Request(uri, opt);
+ jQuery.ajax(uri, opt);
}
function updateBandwidthHosts(data){
@@ -145,21 +144,19 @@ function updateBandwidthHosts(data){
hostbandwidthOut.innerHTML = hostinfo[2] + " Bits/sec";
//make the row appear if hidden
- var rowid = "host" + y;
- textlink = d.getElementById(rowid);
- if (textlink.style.display == "none"){
+ var rowid = "#host" + y;
+ if (jQuery(rowid).css('dislay') == "none"){
//hide rows that contain no data
- Effect.Appear(rowid, {duration:1});
+ jQuery(rowid).show(1000);
}
}
}
else
{
- var rowid = "host" + y;
- textlink = d.getElementById(rowid);
- if (textlink.style.display != "none"){
+ var rowid = "#host" + y;
+ if (jQuery(rowid).css('dislay') != "none"){
//hide rows that contain no data
- Effect.Fade(rowid, {duration:2});
+ jQuery(rowid).fadeOut(2000);
}
}
}
diff --git a/usr/local/www/status_openvpn.php b/usr/local/www/status_openvpn.php
index fd45b3b..a5ff598 100644
--- a/usr/local/www/status_openvpn.php
+++ b/usr/local/www/status_openvpn.php
@@ -110,17 +110,17 @@ include("head.inc"); ?>
<script type="text/javascript">
function killClient(mport, remipp) {
var busy = function(icon) {
- icon.onclick = "";
- icon.src = icon.src.replace("\.gif", "_d.gif");
- icon.style.cursor = "wait";
+ jQuery(icon).bind("onclick","");
+ jQuery(icon).attr('src',jQuery(icon).attr('src').replace("\.gif", "_d.gif"));
+ jQuery(icon).css("cursor","wait");
}
- $A(document.getElementsByName("i:" + mport + ":" + remipp)).each(busy);
+ jQuery('img[name="i:' + mport + ":" + remipp + '"]').each(busy);
- new Ajax.Request(
+ jQuery.ajax(
"<?=$_SERVER['SCRIPT_NAME'];?>" +
"?action=kill&port=" + mport + "&remipp=" + remipp,
- { method: "get", onComplete: killComplete }
+ { type: "get", complete: killComplete }
);
}
@@ -131,8 +131,8 @@ include("head.inc"); ?>
return;
}
- $A(document.getElementsByName("r:" + values[1] + ":" + values[2])).each(
- function(row) { Effect.Fade(row, { duration: 1.0 }); }
+ jQuery('tr[name="r:' + values[1] + ":" + values[2] + '"]').each(
+ function(index,row) { jQuery(row).fadeOut(1000); }
);
}
</script>
OpenPOWER on IntegriCloud