summaryrefslogtreecommitdiff
path: root/www/ajax/rrdui.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/ajax/rrdui.js')
-rw-r--r--www/ajax/rrdui.js33
1 files changed, 18 insertions, 15 deletions
diff --git a/www/ajax/rrdui.js b/www/ajax/rrdui.js
index 74bd8f2..f6c907e 100644
--- a/www/ajax/rrdui.js
+++ b/www/ajax/rrdui.js
@@ -12,7 +12,7 @@ if(ENDPOINT.charAt(0) != '/')
/* TODO: Loading indicator */
var categoryCurrent = null;
-var categoriesList = new Object();
+var categoriesList = new Array();
var categoryArea = document.getElementById("headers");
var xmlData = null;
var gdoc = null;
@@ -45,25 +45,22 @@ function loadedGraphData(doc)
displayCategories();
- var cat;
+ var cat, i;
// Initially load any bookmarked category
if(location.hash)
{
cat = location.hash.substr(1);
- if(categoriesList[cat])
- categoryCurrent = cat;
+ for(i = 0; i < categoriesList.length; i++)
+ {
+ if(cat == categoriesList[i])
+ categoryCurrent = cat;
+ }
}
// No category loaded, choose inital
if(!categoryCurrent)
- {
- for(cat in categoriesList)
- {
- categoryCurrent = cat;
- break;
- }
- }
+ categoryCurrent = categoriesList[0];
displayCurrentPage();
}
@@ -596,8 +593,8 @@ function changeCategory(evt)
function displayCategories()
{
- categoriesList = new Object();
- var cat, i, name;
+ var categories = new Object();
+ var cat, i;
/* Get the template and clean it up a bit */
var template = document.getElementById("header-template");
@@ -611,11 +608,17 @@ function displayCategories()
cat = "Other";
graphs.item(i).setAttribute("category", "Other");
}
- categoriesList[cat] = true;
+ categories[cat] = true;
}
- for(name in categoriesList)
+ categoriesList = new Array();
+ for(cat in categories)
+ categoriesList.push(cat);
+ categoriesList.sort();
+
+ for(i in categoriesList)
{
+ var name = categoriesList[i];
var el = template.cloneNode(false);
el.removeAttribute("id");
el.appendChild(document.createTextNode(name));