Bug 3840 – Jump to: section in the docs should be sorted
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-02-21T09:01:00Z
Last change time
2014-02-15T02:42:54Z
Assigned to
nobody
Creator
destructionator
Comments
Comment #0 by destructionator — 2010-02-21T09:01:06Z
The Jump To: section on the phobos 2 docs could be made a lot easier by sorting the anchors listed alphabetically.
I looked at the html source and noticed that they are generated by some Javascript.
Here's a replacement for the function in there now that does this sorting:
<script>
function listanchors()
{
var a = document.getElementById("quickindex");
if (!a) return;
var newText = "";
var hash = new Array;
var n = 0;
var values = new Array;
// List all anchors.
for (var i = 0; i < document.anchors.length; i++)
{
var a = document.anchors[i];
var text = a.name;
if (hash[text] > 0) continue;
hash[text] = 1;
values[n++] = a.name
}
values.sort();
for(var i = 0; i < values.length; i++) {
var a = values[i];
newText += '<a href="#' + a + '"><span class="d_psymbol">'
+ a + '</span></a> ';
}
if (newText != "") newText = "<p><b>Jump to:</b> " + newText + '</p>';
var a = document.getElementById("quickindex");
a.innerHTML = newText;
}
</script>