summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/ajax/index.html2
-rw-r--r--www/ajax/rrdui.js34
-rw-r--r--www/ajax/style.css1
3 files changed, 29 insertions, 8 deletions
diff --git a/www/ajax/index.html b/www/ajax/index.html
index 3ed3264..d08d5de 100644
--- a/www/ajax/index.html
+++ b/www/ajax/index.html
@@ -29,7 +29,7 @@
<table border="0" width="100%">
<tr><td id="headers" width="60%">
- <span class="header" id="header-template">Text</span>
+ <a class="header" id="header-template">Text</a>
</td>
<td align="right" id="logo">
diff --git a/www/ajax/rrdui.js b/www/ajax/rrdui.js
index d4ea8b6..74bd8f2 100644
--- a/www/ajax/rrdui.js
+++ b/www/ajax/rrdui.js
@@ -12,6 +12,7 @@ if(ENDPOINT.charAt(0) != '/')
/* TODO: Loading indicator */
var categoryCurrent = null;
+var categoriesList = new Object();
var categoryArea = document.getElementById("headers");
var xmlData = null;
var gdoc = null;
@@ -43,6 +44,27 @@ function loadedGraphData(doc)
xmlData = doc;
displayCategories();
+
+ var cat;
+
+ // Initially load any bookmarked category
+ if(location.hash)
+ {
+ cat = location.hash.substr(1);
+ if(categoriesList[cat])
+ categoryCurrent = cat;
+ }
+
+ // No category loaded, choose inital
+ if(!categoryCurrent)
+ {
+ for(cat in categoriesList)
+ {
+ categoryCurrent = cat;
+ break;
+ }
+ }
+
displayCurrentPage();
}
@@ -574,7 +596,7 @@ function changeCategory(evt)
function displayCategories()
{
- var cats = new Object();
+ categoriesList = new Object();
var cat, i, name;
/* Get the template and clean it up a bit */
@@ -589,21 +611,19 @@ function displayCategories()
cat = "Other";
graphs.item(i).setAttribute("category", "Other");
}
- cats[cat] = true;
+ categoriesList[cat] = true;
}
- for(name in cats)
+ for(name in categoriesList)
{
- if(!categoryCurrent)
- categoryCurrent = name;
-
var el = template.cloneNode(false);
el.removeAttribute("id");
el.appendChild(document.createTextNode(name));
el.setAttribute("category", name);
+ el.setAttribute("href", "#" + escape(name));
el.onclick = function(evt)
- { return changeCategory(evt || window.event); }
+ { changeCategory(evt || window.event); }
categoryArea.insertBefore(el, template);
}
diff --git a/www/ajax/style.css b/www/ajax/style.css
index b72e4ca..ac7f89d 100644
--- a/www/ajax/style.css
+++ b/www/ajax/style.css
@@ -60,6 +60,7 @@ body
-moz-border-radius: 3pt;
cursor: pointer;
margin-right: 5pt;
+ text-decoration: none;
}
/* Our sample header (which gets copied for each group) is hidden */