added a dropdown menu for single column view
This commit is contained in:
34
index.html
34
index.html
@@ -26,6 +26,7 @@
|
|||||||
#search { width: 100%; display: table; }
|
#search { width: 100%; display: table; }
|
||||||
.search_span { display: table-cell; text-align: center; vertical-align: middle; }
|
.search_span { display: table-cell; text-align: center; vertical-align: middle; }
|
||||||
.head { font-size: 16px; text-align:left; padding-top: 0.2em; margin-bottom: -0.5em; }
|
.head { font-size: 16px; text-align:left; padding-top: 0.2em; margin-bottom: -0.5em; }
|
||||||
|
#menu { font-size: 12px; width: 3em; }
|
||||||
.tickbox { width: 3em; }
|
.tickbox { width: 3em; }
|
||||||
#reload_span { float: right; }
|
#reload_span { float: right; }
|
||||||
LI.nolink:before {
|
LI.nolink:before {
|
||||||
@@ -56,6 +57,9 @@ function init() {
|
|||||||
if (!config.search) {
|
if (!config.search) {
|
||||||
document.getElementById('search').style.display='none';
|
document.getElementById('search').style.display='none';
|
||||||
}
|
}
|
||||||
|
if (config.columns==1 || narrow_window()) {
|
||||||
|
make_menu();
|
||||||
|
}
|
||||||
document.getElementById("filter").focus();
|
document.getElementById("filter").focus();
|
||||||
hitList=search_hits(document.getElementById("filter").value);
|
hitList=search_hits(document.getElementById("filter").value);
|
||||||
print_results(hitList);
|
print_results(hitList);
|
||||||
@@ -81,9 +85,34 @@ function make_link(md) {
|
|||||||
|
|
||||||
function make_head(c) {
|
function make_head(c) {
|
||||||
var name=c.substring(1).trim();
|
var name=c.substring(1).trim();
|
||||||
var head=c.trim().replace(/ /g," ");
|
var head=c.replace(/ /g," ");
|
||||||
return '<a name="'+name+'"><div class=head align=center>'+head+'</div><hr WIDTH="100%" SIZE=3 NOSHADE>';
|
var id=name.replace(/ /g,"");
|
||||||
|
return '<a name="'+name+'" id="anchor_'+id+'"><div class=head align=center>'+head+'</div></a><hr WIDTH="100%" SIZE=3 NOSHADE>';
|
||||||
}
|
}
|
||||||
|
function make_menu() {
|
||||||
|
var doc=document.getElementById("menu_span");
|
||||||
|
doc.innerHTML="";
|
||||||
|
var sel=document.createElement("select");
|
||||||
|
sel.onchange=function(){
|
||||||
|
if (this.value=="") { return }
|
||||||
|
document.getElementById("anchor_"+this.value).scrollIntoView();
|
||||||
|
document.getElementById("menu").value="";
|
||||||
|
};
|
||||||
|
sel.id="menu";
|
||||||
|
doc.appendChild(sel);
|
||||||
|
var opt=document.createElement("option");
|
||||||
|
sel.appendChild(opt);
|
||||||
|
for (c=0; c<linkList.length; c++) {
|
||||||
|
if ( linkList[c].substring(0,2) == "# " ) {
|
||||||
|
var opt=document.createElement("option");
|
||||||
|
var name=linkList[c].substring(1).trim().replace(/ /g,"");
|
||||||
|
opt.innerHTML=linkList[c].trim();
|
||||||
|
opt.value=name.replace(/^#/,"");
|
||||||
|
sel.appendChild(opt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function filter(ev) {
|
function filter(ev) {
|
||||||
var needle=document.getElementById('filter').value;
|
var needle=document.getElementById('filter').value;
|
||||||
hitList=search_hits(needle);
|
hitList=search_hits(needle);
|
||||||
@@ -224,6 +253,7 @@ var config = {
|
|||||||
<body onload="read_links()">
|
<body onload="read_links()">
|
||||||
<div id="search">
|
<div id="search">
|
||||||
<span class="search_span"><input type="text" oninput="filter(event)" onkeypress="filter(event)" onblur="no_filter()" id="filter" title="Filter links by name"></span>
|
<span class="search_span"><input type="text" oninput="filter(event)" onkeypress="filter(event)" onblur="no_filter()" id="filter" title="Filter links by name"></span>
|
||||||
|
<span class="search_span" id="menu_span"></span>
|
||||||
<span class="search_span tickbox">^<input type=checkbox id=open_blank title="Open links in new window" onclick="toggle_blank()" tabindex=-1></span>
|
<span class="search_span tickbox">^<input type=checkbox id=open_blank title="Open links in new window" onclick="toggle_blank()" tabindex=-1></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="main"></div>
|
<div id="main"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user