aboutsummaryrefslogtreecommitdiff
path: root/assets/js/search-script.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/search-script.js')
-rw-r--r--assets/js/search-script.js1
1 files changed, 0 insertions, 1 deletions
diff --git a/assets/js/search-script.js b/assets/js/search-script.js
deleted file mode 100644
index 2175005..0000000
--- a/assets/js/search-script.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(){"use strict";var t={compile:function(t){return e.template.replace(e.pattern,function(n,r){var o=e.middleware(r,t[r],e.template);return void 0!==o?o:t[r]||n})},setOptions:function(t){e.pattern=t.pattern||e.pattern,e.template=t.template||e.template,"function"==typeof t.middleware&&(e.middleware=t.middleware)}};const e={pattern:/\{(.*?)\}/g,template:"",middleware:function(){}};var n=new function(){this.matches=function(t,e){return function(t,e){var n=e.length,r=t.length;if(n<r)return!1;if(r===n)return t===e;t:for(var o=0,i=0;o<r;o++){for(var u=t.charCodeAt(o);i<n;)if(e.charCodeAt(i++)===u)continue t;return!1}return!0}(e.toLowerCase(),t.toLowerCase())}},r=new function(){this.matches=function(t,e){return!!t&&(t=t.trim().toLowerCase(),(e=e.trim().toLowerCase()).split(" ").filter(function(e){return 0<=t.indexOf(e)}).length===e.split(" ").length)}},o={put:function(t){return a(t)?l(t):function(t){return Boolean(t)&&"[object Array]"===Object.prototype.toString.call(t)}(t)?function(t){const e=[];s();for(let n=0,r=t.length;n<r;n++)a(t[n])&&e.push(l(t[n]));return e}(t):void 0},clear:s,search:function(t){return t?function(t,e,n,r){const o=[];for(let u=0;u<t.length;u++){var i=function(t,e,n,r){for(const o in t)if(!function(t,e){for(let r=0,o=e.length;r<o;r++){var n=e[r];if(new RegExp(n).test(t))return!0}return!1}(t[o],r.exclude)&&n.matches(t[o],e))return t}(t[u],e,n,r);i&&o.push(i)}return o}(u,t,c.searchStrategy,c).sort(c.sort):[]},setOptions:function(t){(c=t||{}).fuzzy=t.fuzzy||!1,c.limit=t.limit||10,c.searchStrategy=t.fuzzy?n:r,c.sort=t.sort||i,c.exclude=t.exclude||[]}};function i(){return 0}const u=[];let c={};function s(){return u.length=0,u}function a(t){return Boolean(t)&&"[object Object]"===Object.prototype.toString.call(t)}function l(t){return u.push(t),u}c.fuzzy=!1,c.limit=0,c.searchStrategy=c.fuzzy?n:r,c.sort=i,c.exclude=[];var f=function(t,e){const n=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");n.open("GET",t,!0),n.onreadystatechange=function(t,e){return function(){if(4===t.readyState&&200===t.status)try{e(null,JSON.parse(t.responseText))}catch(t){e(t,null)}}}(n,e),n.send()};var p=function(t,e){const n={};for(const r in t)n[r]=t[r],void 0!==e[r]&&(n[r]=e[r]);return n},d=function(t){try{return!!(t instanceof Object&&JSON.parse(JSON.stringify(t)))}catch(t){return!1}};!function(e){let n,r={searchInput:null,resultsContainer:null,json:[],success:Function.prototype,searchResultTemplate:'<li class="border-b mt-5 pb-4 hover:underline"><a href="{url}" title="{desc}">{title}</a> <p style="--tw-text-opacity: 1;color: rgba(106, 105, 128, var(--tw-text-opacity));font-size: 0.875rem;line-height: 1.25rem;">{date}</p></li>',templateMiddleware:Function.prototype,sortMiddleware:function(){return 0},noResultsText:"No results found",limit:8,fuzzy:!1,debounceTime:null,exclude:[]};const i=function(t,e){e?(clearTimeout(n),n=setTimeout(t,e)):t.call()};var u=["searchInput","resultsContainer","json"];const c=function t(e){if(!(n=e)||!(void 0!==n.required&&n.required instanceof Array))throw new Error("-- OptionsValidator: required options missing");var n;if(!(this instanceof t))return new t(e);const r=e.required;this.getRequiredOptions=function(){return r},this.validate=function(t){const e=[];return r.forEach(function(n){void 0===t[n]&&e.push(n)}),e}}({required:u});function s(t){o.put(t),r.searchInput.addEventListener("input",function(t){-1===[13,16,20,37,38,39,40,91].indexOf(t.which)&&(a(),i(function(){h(t.target.value)},r.debounceTime))})}function a(){r.resultsContainer.innerHTML=""}function l(t){r.resultsContainer.innerHTML+=t}function h(e){var n;(n=e)&&0<n.length&&(a(),function(e,n){var o=e.length;if(0===o)return l(r.noResultsText);for(let r=0;r<o;r++)e[r].query=n,l(t.compile(e[r]))}(o.search(e),e))}function m(t){throw new Error("SimpleJekyllSearch --- "+t)}e.SimpleJekyllSearch=function(e){var n;return 0<c.validate(e).length&&m("You must specify the following required options: "+u),r=p(r,e),t.setOptions({template:r.searchResultTemplate,middleware:r.templateMiddleware}),o.setOptions({fuzzy:r.fuzzy,limit:r.limit,sort:r.sortMiddleware,exclude:r.exclude}),d(r.json)?s(r.json):(n=r.json,f(n,function(t,e){t&&m("failed to get JSON ("+n+")"),s(e)})),e={search:h},"function"==typeof r.success&&r.success.call(e),e}}(window)}(); \ No newline at end of file