summaryrefslogtreecommitdiff
path: root/html/rrdui.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/rrdui.js')
-rw-r--r--html/rrdui.js44
1 files changed, 42 insertions, 2 deletions
diff --git a/html/rrdui.js b/html/rrdui.js
index ad056d5..f1c7286 100644
--- a/html/rrdui.js
+++ b/html/rrdui.js
@@ -47,12 +47,19 @@ function loadedGraphData(doc)
* GRAPHS
*/
+function getFrameDocument()
+{
+ var frame = document.getElementById("main-frame");
+ /* COMPAT: IE and Mozilla access the content of frames differently */
+ return frame.contentDocument ? frame.contentDocument : frame.contentWindow.document;
+}
+
function setupFrame()
{
+ gdoc = getFrameDocument();
var frame = document.getElementById("main-frame");
/* COMPAT: IE and Mozilla access the content of frames differently */
- gdoc = frame.contentDocument ? frame.contentDocument : frame.contentWindow.document;
- gwindow = frame.contentWindow ? frame.contentWindow : frame.contentDocument.window;
+ gwindow = frame.contentDocument ? frame.contentDocument.defaultView : frame.contentWindow;
}
function displayCurrentPage()
@@ -109,6 +116,7 @@ function displayCurrentPage()
img.className = "graph";
img.id = id;
+ img.style.cursor = "crosshair";
area.appendChild(img);
@@ -147,9 +155,31 @@ function reloadGraph(img)
/* Size */
uri += "&height=" + GRAPH_HEIGHT + "&width=" + GRAPH_WIDTH;
+ img._loading = true;
+ updateCursors(img);
+ img.onload = new Function("reloadedGraph('" + img.id + "');");
img.setAttribute("src", uri);
}
+function reloadedGraph(id)
+{
+ var img = getFrameDocument().getElementById(id);
+ img._loading = false;
+ updateCursors(img);
+}
+
+function updateCursors(img)
+{
+ if(img._actions)
+ {
+ var i, acts = img._actions.getElementsByTagName("img");
+ for(i = 0; i < acts.length; i++)
+ acts.item(i).style.cursor = img._loading ? "wait" : "pointer";
+ }
+
+ img.style.cursor = img._loading ? "wait" : "crosshair";
+}
+
function zoomGraphStart(evt)
{
/* COMPAT: In IE the left button is 1, Mozilla is 0 */
@@ -332,7 +362,16 @@ function actionsDisplay(evt)
return;
var actions = gdoc.getElementById("actions");
+
+ /* Disconnect from previous image */
+ if(actions._img)
+ actions._img._actions = null;
+
+ /* Attach to this image */
actions._img = img;
+ img._actions = actions;
+ updateCursors(img);
+
actions._display = true;
actions.style.top = img.offsetTop;
@@ -368,6 +407,7 @@ function actionsHide(evt)
actions.style.display = "none";
img.onmouseout = actions.onmouseout = null;
+ img._actions = null;
actions._img = null;
actions._display = false;
}