var input = "";
var newinput = "";
var checkboxes;
var fields = ["title","summary","categories"];
var filter;
//var docmapdict = {};
escape_regexp = function(str) {
var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g"); // .*+?|()[]{}\
return str.replace(specials, "\\$&");
}
function debug(str) {
document.getElementById("js_error").innerHTML += str + "
"
}
var methods;
function buildMethodList() {
methods = {};
for(var k in docmap) {
var doc = docmap[k];
var mets = doc.methods;
if(mets) {
for(var j=0;jb) return 1;
else
return 0;
}
function getSubClasses(doc) {
var a = [];
if(doc.subclasses) {
for(var i=0;i 200) {
inProgress = true;
return;
}
}
cindex2=0;
}
if(foundMets) {
if(mindex==0) {
var div = document.createElement("div");
div.className="result_category";
div.innerHTML = "Methods";
node.appendChild(div);
}
for(;mindex0) {
var n;
if(subclassCache[v.path]) {
n = subclassCache[v.path].cloneNode(true);
} else {
var subs = getSubClasses(v);
n = document.createElement("div");
var m = n;
n.className = "met_subclasses";
n.appendChild(document.createTextNode("Inherited by: "));
for(var j=0;j 14) {
m = document.createElement("span");
m.className = "hiddenspan";
m.style.display = "none";
n.appendChild(m);
var a2 = document.createElement("a");
a2.setAttribute("href","#");
a2.className = "seemore";
a2.innerHTML = "… see "+(subs.length-10)+" more";
n.appendChild(document.createTextNode(" "));
n.appendChild(a2);
}
if(j>0)
m.appendChild(document.createTextNode(", "));
a.innerHTML = subs[j];
m.appendChild(a);
}
subclassCache[v.path] = n;
}
(function() {
var a = n.getElementsByClassName("seemore")[0];
if(a) {
var m = n.getElementsByClassName("hiddenspan")[0];
a.onclick = function() {
m.style.display = "";
a.parentNode.removeChild(a);
return false;
}
}
})();
div2.appendChild(n);
}
}
}
node.appendChild(div);
if(Date.now()-now > 200) {
inProgress = true;
return;
}
}
}
}
function randomDoc() {
while(node.hasChildNodes())
node.removeChild(node.lastChild);
cindex = 0;
cindex2 = 0;
mindex = 0;
foundMets = false;
mets = [];
document.getElementById("search_input").value = "";
var list = [];
for(var k in docmap) {
if(docmap.hasOwnProperty(k))
list.push(docmap[k]);
}
for(var i=0;i<100;i++) {
var v = list[Math.floor(Math.random()*list.length)];
if(! /Undocumented classes/.test(v.categories)) {
docs = [[v.path.split("/")[0],[v]]];
break;
}
}
doPrint();
document.getElementById("search_count").innerHTML = "random document";
}
function doSearch() {
var count = 0;
while(node.hasChildNodes())
node.removeChild(node.lastChild);
cindex = 0;
cindex2 = 0;
mindex = 0;
foundMets = false;
cats = [];
mets = [];
if(input!="") {
// setup regexp
try {
var str = input;
if(!document.getElementById("check_regexp").checked) {
str = escape_regexp(str); //escape special chars
if(document.getElementById("check_word").checked)
str = "\\b" + str + "\\b";
if(document.getElementById("check_prefix").checked)
str = "^" + str;
if(document.getElementById("check_suffix").checked)
str = str + "$";
}
re = RegExp(str,document.getElementById("ignore_case").checked?"i":"");
} catch(err) {
document.getElementById("search_count").innerHTML = "Invalid regexp";
document.getElementById("search_results").innerHTML = err;
return;
}
// search docmap
docs = {};
for(var k in docmap) {
var v = docmap[k];
var x = v.path.split("/");
var folder = x[0];
var file = x[x.length-1];
if(matchDoc(v,file,folder,re)) {
if(!docs.hasOwnProperty(folder))
docs[folder]=[];
docs[folder].push(v);
count++;
}
}
var tmp = []; for(var k in docs) tmp.push(
[k, docs[k].sort(function(a,b) {
a = a.title;
b = b.title;
return strCmp(a,b);
})]
);
var order = { Classes:1, Reference:2, Overviews:3, Guides:4, Tutorials:5 };
docs = tmp.sort(function(a,b) {
a = order[a[0]] || 10;
b = order[b[0]] || 10;
return strCmp(a,b);
});
// search methods
var include_ext_classes = document.getElementById("check_extensions").checked;
var filter_val = filter.value;
if(document.getElementById("check_methods").checked) {
for(var mname in methods) {
var m = methods[mname];
if(re.test(mname)) {
var c = [];
for(var i=0;i0) {
mets.push([mname,c]);
foundMets = true;
count++;
}
}
}
mets = mets.sort(function(a,b) {
a = a[0];
b = b[0];
return strCmp(a,b);
});
}
doPrint();
}
document.getElementById("search_count").innerHTML = count+" results";
}
function delayed_update() {
if(input != newinput) {
input = newinput;
doSearch();
} else if(inProgress) {
doPrint();
}
}
window.onhashchange = checkHash;