picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 77003899befd50c84876da7a156ba607eafc13cb
parent c92e8563dfcc854ccfc607dfd39380e7b2790009
Author: Alexander Burger <abu@software-lab.de>
Date:   Fri,  7 Dec 2012 17:09:48 +0100

Sort button for the function reference by Jon Kleiser
Diffstat:
Mdoc/ref.html | 33++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/doc/ref.html b/doc/ref.html @@ -1898,7 +1898,7 @@ abbreviations: <a href="refZ.html">Z</a> <a href="ref_.html">Other</a> -<p><dl> +<p><span id="sortBtnHome"></span><dl> <dt>Symbol Functions <dd><code> @@ -2650,5 +2650,36 @@ abbreviations: <p>The <code>PicoLisp</code> system can be downloaded from the <a href="http://software-lab.de/down.html">PicoLisp Download</a> page. +<script type="text/javascript"> +var sortBtn; + +if (document.querySelectorAll) { + sortBtn = document.createElement("input"); + sortBtn.setAttribute("type", "button"); + sortBtn.setAttribute("onclick", "sortFunWords()"); + sortBtn.value = "Sort Words Alphabetically"; + document.getElementById("sortBtnHome").appendChild(sortBtn); +}; + +function sortFunWords() { + var dls = document.querySelectorAll("dl"), funDl = dls[dls.length-1]; + var cats = funDl.querySelectorAll("dd code"); + for (var c=0; c<cats.length; c++) { + var aElems = cats[c].querySelectorAll("a"), aArr = []; + for (var i=0; i<aElems.length; i++) { aArr.push(aElems[i]); } + aArr.sort(function(a,b) { return (a.innerHTML < b.innerHTML) ? -1 : 1; }); + var dd = cats[c].parentNode; + dd.removeChild(cats[c]); + var newCode = document.createElement("code"); + dd.appendChild(newCode); + for (var i=0; i<aArr.length; i++) { + newCode.appendChild(aArr[i]); + newCode.appendChild(document.createTextNode(" ")); + } + } + sortBtn.setAttribute("disabled", "disabled"); +} +</script> + </body> </html>