summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/widgets/javascript/traffic_graph.js
blob: d0f7ee0c7baa2056b3851d1ae093f392aeba50e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * traffic_graph.js
 *
 * part of pfSense (https://www.pfsense.org)
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

function trafficshowDiv(incDiv,ifDescription,refreshIntervalSec,swapButtons) {
	// put the graph object HTML in the element and make it appear
	selectedDiv = incDiv + "graphdiv";
	$('#' + selectedDiv).html(
		'<object data="graph.php?ifnum=' + incDiv + '&amp;ifname=' + ifDescription + '&amp;timeint=' + refreshIntervalSec + '&amp;initdelay=0" height="100%" width="100%">' +
		'<param name="id" value="graph" />' +
		'<param name="type" value="image/svg+xml" />' +
		'<param name="pluginspage" value="http://www.adobe.com/svg/viewer/install/auto" />' +
		'</object>');
	$('#' + selectedDiv).effect('blind',{mode:'show'},1000);
	d = document;
	if (swapButtons) {
		selectIntLink = selectedDiv + "-min";
		textlink = d.getElementById(selectIntLink);
		textlink.style.display = "inline";

		selectIntLink = selectedDiv + "-open";
		textlink = d.getElementById(selectIntLink);
		textlink.style.display = "none";
	}
	document.traffic_graphs_widget_iform["shown[" + incDiv + "]"].value = "show";
}

function  trafficminimizeDiv(incDiv,swapButtons) {
	// remove the graph object HTML from the element (so it does not keep using CPU) and fade
	selectedDiv = incDiv + "graphdiv";
	$('#' + selectedDiv).html('');
	$('#' + selectedDiv).effect('blind',{mode:'hide'},1000);
	d = document;
	if (swapButtons) {
		selectIntLink = selectedDiv + "-open";
		textlink = d.getElementById(selectIntLink);
		textlink.style.display = "inline";

		selectIntLink = selectedDiv + "-min";
		textlink = d.getElementById(selectIntLink);
		textlink.style.display = "none";
	}
	document.traffic_graphs_widget_iform["shown[" + incDiv + "]"].value = "hide";
}

OpenPOWER on IntegriCloud