mirage-config/docs/js/script.min.js
2022-10-09 01:10:05 +03:00

14 lines
2.6 KiB
JavaScript

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