This commit is contained in:
ville rantanen
2018-12-10 17:54:04 +02:00
parent 97f34cf157
commit 21c1468fea

View File

@@ -115,7 +115,7 @@ function make_menu() {
var sel=document.createElement("select");
sel.onchange=function(){
if (this.value=="") { return }
document.getElementById("anchor_"+this.value).scrollIntoView();
document.getElementById(this.value).scrollIntoView();
document.getElementById("menu").value="";
};
sel.id="menu";
@@ -124,13 +124,15 @@ function make_menu() {
opt.value="";
opt.innerHTML="#";
sel.appendChild(opt);
var anchor_index = 0;
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(/^#/,"");
opt.value="anchor_" + name.replace(/^#/,"") + "_" + anchor_index;
sel.appendChild(opt);
anchor_index++;
}
}
}