Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //================================================================================
- //REPLACE THIS:
- //================================================================================
- function listanchors()
- {
- if (typeof inhibitQuickIndex !== 'undefined') return;
- 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 += ' \x3Ca href="\x23' + a +
- '"\x3E\x3Cspan class="d_psymbol"\x3E' + a + '\x3C/span\x3E\x3C/a\x3E';
- }
- if (newText != "") newText = "\x3Cp\x3E\x3Cb\x3EJump to:\x3C/b\x3E" + newText + "\x3C/p\x3E";
- var a = document.getElementById("quickindex");
- a.innerHTML = newText;
- }
- //================================================================================
- //WITH THIS:
- //================================================================================
- function listanchors()
- {
- if (typeof inhibitQuickIndex !== 'undefined') return;
- var a = document.getElementById("quickindex");
- if (!a) return;
- var newText = "";
- // listanchors modification begin {
- function keys(obj)
- {
- var keys = [];
- for(var key in obj)
- if(obj.hasOwnProperty(key))
- keys.push(key);
- return keys;
- }
- var content_div = document.getElementById('content');
- var elems = new Array;
- var regex = /^([^\s]+)\s+\x3Ca name="([^"]+)"[^\x3E]*\x3E\x3C\/a\x3E\x3C[^\x3E]+\x3E([^\x3C]+)\x3C\/[^\x3E]+\x3E(.*?;)$/im;
- var subregex = /(\x3C\w+)\s[^\x3E]*(\x3E)/img;
- var decl_array = new Array;
- var found = false;
- if(content_div != null)
- elems = content_div.getElementsByTagName('*');
- for(var i in elems)
- {
- if((" " + elems[i].className + " ").indexOf(" d_decl ") > -1)
- {
- var node = elems[i];
- var count = 0;
- do
- {
- if(node.tagName == "DL")
- {
- count++;
- if(count > 1)
- break;
- }
- node = node.parentNode;
- }
- while(node != content_div);
- if(count == 1)
- {
- var matches;
- matches = regex.exec(elems[i].innerHTML);
- if(matches != null && matches.length == 5)
- {
- found = true;
- var type;
- matches[4] = matches[4].replace(subregex, "$1$2");
- if(matches[4].length > 0 && matches[4][0] == "(")
- type = "function";
- else
- type = matches[1];
- if(!(type in decl_array))
- decl_array[type] = new Array;
- decl_array[type].push(matches[1] +
- " \x3Ca href=\"#" + matches[2] + "\"\x3E" + matches[3] + "\x3C/a\x3E" + matches[4]);
- }
- }
- }
- }
- if(found)
- {
- decl_types = keys(decl_array);
- decl_types.sort(function(a,b){
- var priority = ["function", "class", "struct"].reverse();
- var aa = priority.indexOf(a);
- var bb = priority.indexOf(b);
- if(aa != bb)
- return bb-aa;
- return a.localeCompare(b);
- });
- for(var index in decl_types)
- {
- var type = decl_types[index];
- newText += '\x3Cbr\x3E';
- newText += '\x3Cu\x3E' + type + '\x3C/u\x3E\x3Cbr\x3E';
- for(var decl in decl_array[type])
- newText += decl_array[type][decl] + '\x3Cbr\x3E';
- }
- }
- else
- {
- // old code {
- 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 += ' \x3Ca href="\x23' + a +
- '"\x3E\x3Cspan class="d_psymbol"\x3E' + a + '\x3C/span\x3E\x3C/a\x3E';
- }
- // } // old code
- }
- // } // listanchors modification end
- if (newText != "") newText = "\x3Cp\x3E\x3Cb\x3EJump to:\x3C/b\x3E" + newText + "\x3C/p\x3E";
- var a = document.getElementById("quickindex");
- a.innerHTML = newText;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement