hide non-search result headers
This commit is contained in:
34
index.html
34
index.html
@@ -18,6 +18,13 @@
|
||||
content:"-";
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
TD.narrow LI {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
LI.nolink:before {
|
||||
content:" ";
|
||||
padding-right: 1.0em;
|
||||
}
|
||||
A:link { text-decoration:none; color: #000000; }
|
||||
A:visited { text-decoration:none; color: #000000; }
|
||||
A:hover { text-decoration: underline; }
|
||||
@@ -33,10 +40,7 @@
|
||||
#open_blank_span { cursor: pointer; font-size:16px;}
|
||||
#open_blank_box { position:relative; left: 0.0em; border: 1px solid black; padding-left: 1em; }
|
||||
#open_blank_arrow { position: relative; left: -0.5em; top: 0em; }
|
||||
LI.nolink:before {
|
||||
content:" ";
|
||||
padding-right: 1.0em;
|
||||
}
|
||||
.hidden { display:none; }
|
||||
</STYLE>
|
||||
<script language="javascript">
|
||||
function init() {
|
||||
@@ -143,6 +147,7 @@ function search_hits(needle) {
|
||||
return Array.apply(null, {length: linkList.length}).map(Number.call, Number);
|
||||
}
|
||||
hitList=[];
|
||||
var headName="";
|
||||
for (l=0; l<linkList.length; l++) {
|
||||
var match=linkReg.exec(linkList[l].toLowerCase());
|
||||
if (match != null ) {
|
||||
@@ -154,6 +159,13 @@ function search_hits(needle) {
|
||||
if ( match[2].indexOf(needle)>-1 ) { hitList.push(l); }
|
||||
continue
|
||||
}
|
||||
if (match===null) {
|
||||
/* not a link, match anyway */
|
||||
if (linkList[l].toLowerCase().indexOf(needle)>-1) {
|
||||
hitList.push(l);
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
return hitList
|
||||
}
|
||||
@@ -165,6 +177,7 @@ function open_link(c) {
|
||||
if (match != null ) { location.href=match[2]; return }
|
||||
return
|
||||
}
|
||||
var cats=[];
|
||||
function print_results(hitList) {
|
||||
var doc=document.getElementById("main");
|
||||
doc.innerHTML="";
|
||||
@@ -174,18 +187,29 @@ function print_results(hitList) {
|
||||
doc.appendChild(tbl);
|
||||
var str="";
|
||||
var cat=0;
|
||||
cats=[];
|
||||
for (c=0; c<linkList.length; c++) {
|
||||
if ( linkList[c].substring(0,2) == "# " ) {
|
||||
if (cat%config.columns==0 || narrow_window()) { tbody.innerHTML+="<tr>"; }
|
||||
var name=linkList[c].substring(1).trim().replace(/ /g,"");
|
||||
var td=document.createElement("td");
|
||||
td.id="td_"+name;
|
||||
if (narrow_window()) { td.className+=" narrow"; }
|
||||
if (cat%config.columns==0 || narrow_window()) {
|
||||
tbody.innerHTML+="<tr>";
|
||||
}
|
||||
td.innerHTML+=make_head(linkList[c]);
|
||||
tbody.appendChild(td);
|
||||
cats.push({name:name, count:0});
|
||||
cat+=1;
|
||||
} else {
|
||||
if (hitList.indexOf(c)==-1) { continue }
|
||||
td.innerHTML+=make_link(linkList[c]);
|
||||
cats[cat-1].count++;
|
||||
}
|
||||
}
|
||||
for (c=0; c<cats.length; c++) {
|
||||
if (cats[c].count==0) { document.getElementById("td_"+cats[c].name).className+=" hidden"; }
|
||||
}
|
||||
}
|
||||
function reload_source() {
|
||||
location.href=config.source
|
||||
|
||||
Reference in New Issue
Block a user