poodinis/docs/js/script.min.js
fc36909cca Properly add docs under a unix filesyste
Windows screws up files with same name with different case
2017-12-09 00:59:26 +01:00

2 lines
2.6 KiB
JavaScript

function setupDdox(){for(var e=document.querySelectorAll(".tree-view .package"),t=0;t<e.length;++t)e[t].addEventListener("click",toggleTree);for(var e=document.querySelectorAll(".tree-view .package a"),t=0;t<e.length;++t)e[t].addEventListener("click",function(e){e.stopPropagation()});e=document.querySelectorAll(".tree-view.collapsed ul");for(var t=0;t<e.length;++t)e[t].style.display="none";document.getElementById("symbolSearch").setAttribute("tabindex","1000")}function toggleTree(e){var t=this.parentNode;t.classList.toggle("collapsed");for(var l=t.children,n=t.classList.contains("collapsed")?"none":"block",r=1;r<l.length;++r)l[r].style.display=n;return this.style.display="none",this.style.display="block",!1}function performSymbolSearch(e,t){function l(e){for(var t=e.length-1;t>=0;t--)for(u in a)if(e[t].length>=a[u].length&&e[t].substr(0,a[u].length)==a[u])return e.length-1-t;return e.length}function n(e,t){var n=e.attributes.indexOf("deprecated")>=0,r=t.attributes.indexOf("deprecated")>=0;if(n!=r)return n-r;var s=e.name.toLowerCase(),i=t.name.toLowerCase(),o=s.split("."),h=i.split("."),c=o[o.length-1],d=h[h.length-1],u=a.indexOf(c)>=0,g=a.indexOf(d)>=0;if(u!=g)return g-u;var f=l(o),m=l(h);return f!=m?f-m:o.length<h.length?-1:o.length>h.length?1:c.length<d.length?-1:c.length>d.length?1:s<i?-1:s>i?1:0}var r=function(e){return document.getElementById(e)};"undefined"===e&&(e=26),void 0===t&&(t=40);var s=r("symbolSearch").value.toLowerCase();if(s!=lastSearchString){lastSearchString=s;++searchCounter;r("symbolSearchResults").style.display="none",r("symbolSearchResults").innerHTML="",r("symbolSearch").classList.remove("with_results");var a=s.trim().split(/\s+/);if(!(0==a.length||1==a.length&&a[0].length<2)){for(var i=[],o=0;o<symbols.length;++o){var h=symbols[o],c=!0;for(u in a)if(h.name.toLowerCase().indexOf(a[u])<0){c=!1;break}c&&i.push(h)}for(i.sort(n),o=0;o<i.length&&o<t;o++){var h=i[o],d=document.createElement("li");d.classList.add(h.kind);for(var u=0;u<h.attributes.length;++u)d.classList.add(h.attributes[u]);for(var g=h.name,f=g.split("."),m=f.length-1,p="."+f[m];m>0&&f[m-1].length+p.length<=e;)m--,p="."+f[m]+p;p=m>0?".."+p:p.substr(1);var y=document.createElement("a");y.setAttribute("href",symbolSearchRootDir+h.path),y.setAttribute("title",g),y.setAttribute("tabindex",1001),y.textContent=p,d.appendChild(y),r("symbolSearchResults").appendChild(d)}if(i.length>t){var b=document.createElement("li");b.innerHTML="&hellip;"+(i.length-100)+" additional results",r("symbolSearchResults").appendChild(b)}i.length&&(r("symbolSearchResults").style.display="initial",r("symbolSearch").classList.add("with_results"))}}}var searchCounter=0,lastSearchString="";