PageSourceSearch

https://tyrantlucifer.com/js/search/local-search.js

js tyrantlucifer.com collected 2026-09-25 21:14:26 UTC 3,888 bytes, 1 lines download raw bytes

1"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}window.addEventListener("load",function(){function e(){var e;document.body.style.cssText="width: 100%;overflow: hidden",document.querySelector("#local-search .search-dialog").style.display="block",document.querySelector("#local-search-input input").focus(),btf.fadeIn(document.getElementById("search-mask"),.5),r||(e=GLOBAL_CONFIG.localSearch.path,fetch(GLOBAL_CONFIG.root+e).then(function(e){return e.text()}).then(function(e){return(new window.DOMParser).parseFromString(e,"text/xml")}).then(function(e){var t=_toConsumableArray(e.querySelectorAll("entry")).map(function(e){var t=e.querySelector("content");return{title:e.querySelector("title").textContent,content:t?t.textContent:"",url:e.querySelector("url").textContent}}),e=document.querySelector("#local-search-input input"),r=document.getElementById("local-search-results");e.addEventListener("input",function(){var d,y='<div class="search-result-list">',h=this.value.trim().toLowerCase().split(/[\s]+/);r.innerHTML="",this.value.trim().length<=0||(d=0,t.forEach(function(e){var r,t,n,a,o=!0,c=(e.title&&""!==e.title.trim()||(e.title="Untitled"),e.title.trim().toLowerCase()),l=e.content.trim().replace(/<[^>]+>/g,"").toLowerCase(),i=e.url.startsWith("/")?e.url:GLOBAL_CONFIG.root+e.url,s=-1,u=-1;""!==c||""!==l?h.forEach(function(e,t){r=c.indexOf(e),s=l.indexOf(e),r<0&&s<0?o=!1:(s<0&&(s=0),0===t&&(u=s))}):o=!1,o&&(e=e.content.trim().replace(/<[^>]+>/g,""),0<=u&&(n=u+100,(n=0==(t=(t=u-30)<0?0:t)?100:n)>e.length&&(n=e.length),a=e.substring(t,n),h.forEach(function(e){var t=new RegExp(e,"gi");a=a.replace(t,'<span class="search-keyword">'+e+"</span>"),c=c.replace(t,'<span class="search-keyword">'+e+"</span>")}),y+='<div class="local-search__hit-item"><a href="'+i+'" class="search-result-title">'+c+"</a>",d+=1,""!==l)&&(y+='<p class="search-result">'+a+"...</p>"),y+="</div>")}),0===d&&(y+='<div id="local-search__hits-empty">'+GLOBAL_CONFIG.localSearch.languages.hits_empty.replace(/\$\{query}/,this.value.trim())+"</div>"),y+="</div>",r.innerHTML=y,window.pjax&&window.pjax.refresh(r))})}),r=!0),document.addEventListener("keydown",function e(t){"Escape"===t.code&&(n(),document.removeEventListener("keydown",e))})}function t(){document.querySelector("#search-button > .search").addEventListener("click",e),document.getElementById("search-mask").addEventListener("click",n),document.querySelector("#local-search .search-close-button").addEventListener("click",n)}var r=!1,n=function(){document.body.style.cssText="width: '';overflow: ''";var e=document.querySelector("#local-search .search-dialog");e.style.animation="search_close .5s",setTimeout(function(){e.style.cssText="display: none; animation: ''"},500),btf.fadeOut(document.getElementById("search-mask"),.5)};t(),window.addEventListener("pjax:complete",function(){"block"===getComputedStyle(document.querySelector("#local-search .search-dialog")).display&&n(),t()})});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.