diff options
Diffstat (limited to 'src/search_js.h')
-rw-r--r-- | src/search_js.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/search_js.h b/src/search_js.h index 934f338..985d03c 100644 --- a/src/search_js.h +++ b/src/search_js.h @@ -707,3 +707,72 @@ " return false;\n" " }\n" "}\n" +"\n" +"function setKeyActions(elem,action)\n" +"{\n" +" elem.setAttribute('onkeydown',action);\n" +" elem.setAttribute('onkeypress',action);\n" +" elem.setAttribute('onkeyup',action);\n" +"}\n" +"\n" +"function setClassAttr(elem,attr)\n" +"{\n" +" elem.setAttribute('class',attr);\n" +" elem.setAttribute('className',attr);\n" +"}\n" +"\n" +"function createResults()\n" +"{\n" +" var results = document.getElementById(\"SRResults\");\n" +" for (var e=0; e<searchData.length; e++)\n" +" {\n" +" var id = searchData[e][0];\n" +" var srResult = document.createElement('div');\n" +" srResult.setAttribute('id','SR_'+id);\n" +" setClassAttr(srResult,'SRResult');\n" +" var srEntry = document.createElement('div');\n" +" setClassAttr(srEntry,'SREntry');\n" +" var srLink = document.createElement('a');\n" +" srLink.setAttribute('id','Item'+e);\n" +" setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');\n" +" setClassAttr(srLink,'SRSymbol');\n" +" srLink.innerHTML = searchData[e][1][0];\n" +" srEntry.appendChild(srLink);\n" +" if (searchData[e][1].length==2) // single result\n" +" {\n" +" srLink.setAttribute('href',searchData[e][1][1][0]);\n" +" if (searchData[e][1][1][1])\n" +" {\n" +" srLink.setAttribute('target','_parent');\n" +" }\n" +" var srScope = document.createElement('span');\n" +" setClassAttr(srScope,'SRScope');\n" +" srScope.innerHTML = searchData[e][1][1][2];\n" +" srEntry.appendChild(srScope);\n" +" }\n" +" else // multiple results\n" +" {\n" +" srLink.setAttribute('href','javascript:searchResults.Toggle(\"SR_'+id+'\")');\n" +" var srChildren = document.createElement('div');\n" +" setClassAttr(srChildren,'SRChildren');\n" +" for (var c=0; c<searchData[e][1].length-1; c++)\n" +" {\n" +" var srChild = document.createElement('a');\n" +" srChild.setAttribute('id','Item'+e+'_c'+c);\n" +" setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');\n" +" setClassAttr(srChild,'SRScope');\n" +" srChild.setAttribute('href',searchData[e][1][c+1][0]);\n" +" if (searchData[e][1][c+1][1])\n" +" {\n" +" srChild.setAttribute('target','_parent');\n" +" }\n" +" srChild.innerHTML = searchData[e][1][c+1][2];\n" +" srChildren.appendChild(srChild);\n" +" }\n" +" srEntry.appendChild(srChildren);\n" +" }\n" +" srResult.appendChild(srEntry);\n" +" results.appendChild(srResult);\n" +" }\n" +"}\n" +"\n" |