From 3dad3bd8f6e1b5b388a9f289a84738f97ff61527 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Sat, 17 Jun 2017 09:49:35 +0300 Subject: [PATCH] added a dropdown menu for single column view --- index.html | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index b3c8027..bd6b069 100644 --- a/index.html +++ b/index.html @@ -26,6 +26,7 @@ #search { width: 100%; display: table; } .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; } + #menu { font-size: 12px; width: 3em; } .tickbox { width: 3em; } #reload_span { float: right; } LI.nolink:before { @@ -56,6 +57,9 @@ function init() { if (!config.search) { document.getElementById('search').style.display='none'; } + if (config.columns==1 || narrow_window()) { + make_menu(); + } document.getElementById("filter").focus(); hitList=search_hits(document.getElementById("filter").value); print_results(hitList); @@ -81,9 +85,34 @@ function make_link(md) { function make_head(c) { var name=c.substring(1).trim(); - var head=c.trim().replace(/ /g," "); - return '
'+head+'

'; + var head=c.replace(/ /g," "); + var id=name.replace(/ /g,""); + return '
'+head+'

'; } +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