fa23-si/dist/plugin/search.js

1 line
4.7 KiB
JavaScript

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}({4:function(e,t,n){"use strict";n.r(t);var r=function(){var e,t,n,r;function i(e,t){var n=document.getElementById(e)||document.body,r=t||"EM",i=new RegExp("^(?:"+r+"|SCRIPT|FORM)$"),o=["#ff6","#a0ffff","#9f9","#f99","#f6f"],l=[],a=0,c="",d=[];this.setRegex=function(e){e=e.replace(/^[^\w]+|[^\w]+$/g,"").replace(/[^\w'-]+/g,"|"),c=new RegExp("("+e+")","i")},this.getRegex=function(){return c.toString().replace(/^\/\\b\(|\)\\b\/i$/g,"").replace(/\|/g," ")},this.hiliteWords=function(e){if(null!=e&&e&&c&&!i.test(e.nodeName)){if(e.hasChildNodes())for(var t=0;t<e.childNodes.length;t++)this.hiliteWords(e.childNodes[t]);if(3==e.nodeType&&(nv=e.nodeValue)&&(regs=c.exec(nv))){for(var n=e;null!=n&&"SECTION"!=n.nodeName;)n=n.parentNode;var u=Reveal.getIndices(n),s=d.length,p=!1;for(t=0;t<s;t++)d[t].h===u.h&&d[t].v===u.v&&(p=!0);p||d.push(u),l[regs[0].toLowerCase()]||(l[regs[0].toLowerCase()]=o[a++%o.length]);var f=document.createElement(r);f.appendChild(document.createTextNode(regs[0])),f.style.backgroundColor=l[regs[0].toLowerCase()],f.style.fontStyle="inherit",f.style.color="#000";var g=e.splitText(regs.index);g.nodeValue=g.nodeValue.substring(regs[0].length),e.parentNode.insertBefore(f,g)}}},this.remove=function(){for(var e=document.getElementsByTagName(r);e.length&&(el=e[0]);)el.parentNode.replaceChild(el.firstChild,el)},this.apply=function(e){if(null!=e&&e)return this.remove(),this.setRegex(e),this.hiliteWords(n),d}}function o(){var e=document.getElementById("searchinputdiv"),t=document.getElementById("searchinput");e.style.display="inline",t.focus(),t.select()}function l(){document.getElementById("searchinputdiv").style.display="none",r&&r.remove()}function a(){if(n){var o=document.getElementById("searchinput").value;""===o?(r&&r.remove(),e=null):(r=new i("slidecontent"),e=r.apply(o),t=0)}e&&(e.length&&e.length<=t&&(t=0),e.length>t&&(Reveal.slide(e[t].h,e[t].v),t++))}var c={};if(c.wrapper=document.querySelector(".reveal"),!c.wrapper.querySelector(".searchbox")){var d=document.createElement("div");d.id="searchinputdiv",d.classList.add("searchdiv"),d.style.position="absolute",d.style.top="10px",d.style.right="10px",d.style.zIndex=10,d.innerHTML='<span><input type="search" id="searchinput" class="searchinput" style="vertical-align: top;"/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJiSURBVHjatFZNaxNBGH5md+Mmu92NVdKDRipSAyqCghgQD4L4cRe86UUtAQ+eFCxoa4/25EXBFi8eBE+eRPoDhB6KgiiixdAPCEkx2pjvTXadd9yNsflwuyUDD/O+u8PzzDPvzOwyx3EwyCZhwG3gAkp7MnpjgbopjsltcD4gjuXZZKeAR348MYLYTm3LzOs/y3j3JTfZxgXWXmTuwPHIc4VmoOmv5IrI53+AO2DdHLjkDWQ3GoEEVFXtXQOvkSnPWcyUceviLhwbDYv8/XIVj97kse7TodLvZXxYxrPUHkQ1ufXs3FEdybEIxucySOesoNvUgWU1cP3MkCBfTFdw9fGaAMVmRELq7LBw2Q3/FaAxxWIRpw+ZIr/7IouPqzUBiqmdHAv7EuhRAwf1er2Vy4x1jW3b2d5Jfvu5IPp7l2LYbcgCFFNb+FoJ7oBqEAqFMPNqFcmEgVMJDfMT+1tvN0pNjERlMS6QA5pFOKxiKVPFhakPeL3It+WGJUDxt2wFR+JhzI7v5ctkd8DXOZAkCYYxhO+lKm4+Xfqz/rIixBuNBl7eOYzkQQNzqX249mRl6zUgEcYkaJrGhUwBinVdh6IouPzwE6/DL5w4oLkH8y981aDf+uq6hlKpJESiUdNfDZi7/ehG9K6KfiA3pml0PLcsq+cSMTj2NL9ukc4UOmz7AZ3+crkC4mHujFvXNaMFB3bEr8xPS6p5O+jXxq4VZtaen7/PwzrntjcLUE0iHPS1Ud1cdiEJl/8WivZk0wXd7zWOMkeF8s0CcAmkNrC2nvXZDbbbN73ccYnZoH9bfgswAFzAe9/h3dbKAAAAAElFTkSuQmCC" id="searchbutton" class="searchicon" style="vertical-align: top; margin-top: -1px;"/></span>',c.wrapper.appendChild(d)}return document.getElementById("searchbutton").addEventListener("click",(function(e){a()}),!1),document.getElementById("searchinput").addEventListener("keyup",(function(e){switch(e.keyCode){case 13:e.preventDefault(),a(),n=!1;break;default:n=!0}}),!1),document.addEventListener("keydown",(function(e){"F"==e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),"inline"!==document.getElementById("searchinputdiv").style.display?o():l())}),!1),l(),{id:"search",init:function(e){e.registerKeyboardShortcut("CTRL + Shift + F","Search")},open:o}}();Reveal.registerPlugin(r)}});