diff options
author | Stef Walter <stef@memberwebs.com> | 2006-11-30 01:39:21 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2006-11-30 01:39:21 +0000 |
commit | 09e655dc8fa914d8347e1e2102f2482109829c91 (patch) | |
tree | bce6790ff2c00d75cc9dd2a17c7a8810f16ffbb3 | |
parent | 4707deeca1dded8e20e92a21a4d16a5c56c97401 (diff) |
Make the category links into a refs so they can be bookmarked.
-rw-r--r-- | www/ajax/index.html | 2 | ||||
-rw-r--r-- | www/ajax/rrdui.js | 34 | ||||
-rw-r--r-- | www/ajax/style.css | 1 |
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 */ |