bpm-presentation/plugin/search/search.js

8 lines
22 KiB
JavaScript
Raw Normal View History

2022-01-19 21:19:28 -05:00
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).RevealSearch=t()}(this,(function(){"use strict";var e,t,n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){try{return!!e()}catch(e){return!0}},o=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),i=function(e){return e&&e.Math==Math&&e},u=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof n&&n)||function(){return this}()||Function("return this")(),c=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),a=c,f=Function.prototype,l=f.bind,s=f.call,p=a&&l.bind(s,s),d=a?function(e){return e&&p(e)}:function(e){return e&&function(){return s.apply(e,arguments)}},g=function(e){return"function"==typeof e},v=r,y=g,h=/#|\.prototype\./,b=function(e,t){var n=x[m(e)];return n==w||n!=S&&(y(t)?v(t):!!t)},m=b.normalize=function(e){return String(e).replace(h,".").toLowerCase()},x=b.data={},S=b.NATIVE="N",w=b.POLYFILL="P",O=b,E=g,j=function(e){return"object"==typeof e?null!==e:E(e)},R=u,I=j,T=R.String,P=R.TypeError,C=function(e){if(I(e))return e;throw P(T(e)+" is not an object")},k=u,_=g,A=k.String,N=k.TypeError,$=d,M=C,F=function(e){if("object"==typeof e||_(e))return e;throw N("Can't set "+A(e)+" as a prototype")},L=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=$(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return M(n),F(r),t?e(n,r):n.__proto__=r,n}}():void 0),D=g,z=j,K=L,B={},U=j,W=u.document,Y=U(W)&&U(W.createElement),G=function(e){return Y?W.createElement(e):{}},V=G,q=!o&&!r((function(){return 7!=Object.defineProperty(V("div"),"a",{get:function(){return 7}}).a})),X=o&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),H=c,J=Function.prototype.call,Q=H?J.bind(J):function(){return J.apply(J,arguments)},Z=u,ee=g,te=function(e){return ee(e)?e:void 0},ne=function(e,t){return arguments.length<2?te(Z[e]):Z[e]&&Z[e][t]},re=d({}.isPrototypeOf),oe=u,ie=ne("navigator","userAgent")||"",ue=oe.process,ce=oe.Deno,ae=ue&&ue.versions||ce&&ce.version,fe=ae&&ae.v8;fe&&(t=(e=fe.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!t&&ie&&(!(e=ie.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=ie.match(/Chrome\/(\d+)/))&&(t=+e[1]);var le=t,se=r,pe=!!Object.getOwnPropertySymbols&&!se((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&le&&le<41})),de=pe&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ge=ne,ve=g,ye=re,he=de,be=u.Object,me=he?function(e){return"symbol"==typeof e}:function(e){var t=ge("Symbol");return ve(t)&&ye(t.prototype,be(e))},xe=u.String,Se=g,we=function(e){try{return xe(e)}catch(e){return"Object"}},Oe=u.TypeError,Ee=function(e){if(Se(e))return e;throw Oe(we(e)+" is not a function")},je=function(e,t){var n=e[t];return null==n?void 0:Ee(n)},Re=Q,Ie=g,Te=j,Pe=u.TypeError,Ce={exports:{}},ke=u,_e=Object.defineProperty,Ae=function(e,t){try{_e(ke,e,{value:t,configurable:!0,writable:!0})}catch(n){ke[e]=t}return t},Ne=Ae,$e="__core-js_shared__",Me=u[$e]||Ne($e,{}),Fe=Me;(Ce.exports=function(e,t){return Fe[e]||(Fe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"});var Le=u.TypeError,De=function(e){if(null==e)throw Le("Can't call method on "+e);return e},ze=De,Ke=u.Object,Be=function(e){return Ke(ze(e))},Ue=Be,We=d({}.hasOwnProperty),Ye=Object.hasOwn||function(e,t){return We(Ue(e),t)},Ge=d,Ve=0,qe=Math.random(),Xe=Ge(1..toString),He=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Xe(++Ve+qe,36)},Je=u,Qe=Ce.exports,Ze=Ye,et=He
2022-01-19 14:35:25 -05:00
/*!
* Handles finding a text string anywhere in the slides and showing the next occurrence to the user
* by navigatating to that slide and highlighting it.
*
* @author Jon Snyder <snyder.jon@gmail.com>, February 2013
2022-01-19 21:19:28 -05:00
*/;return function(){var e,t,n,r,o,i,u;function c(){(t=document.createElement("div")).classList.add("searchbox"),t.style.position="absolute",t.style.top="10px",t.style.right="10px",t.style.zIndex=10,t.innerHTML='<input type="search" class="searchinput" placeholder="Search..." style="vertical-align: top;"/>\n\t\t</span>',(n=t.querySelector(".searchinput")).style.width="240px",n.style.fontSize="14px",n.style.padding="4px 6px",n.style.color="#000",n.style.background="#fff",n.style.borderRadius="2px",n.style.border="0",n.style.outline="0",n.style.boxShadow="0 2px 18px rgba(0, 0, 0, 0.2)",n.style["-webkit-appearance"]="none",e.getRevealElement().appendChild(t),n.addEventListener("keyup",(function(t){if(13===t.keyCode)t.preventDefault(),function(){if(i){var t=n.value;""===t?(u&&u.remove(),r=null):(u=new l("slidecontent"),r=u.apply(t),o=0)}r&&(r.length&&r.length<=o&&(o=0),r.length>o&&(e.slide(r[o].h,r[o].v),o++))}(),i=!1;else i=!0}),!1),f()}function a(){t||c(),t.style.display="inline",n.focus(),n.select()}function f(){t||c(),t.style.display="none",u&&u.remove()}function l(t,n){var r=document.getElementById(t)||document.body,o=n||"EM",i=new RegExp("^(?:"+o+"|SCRIPT|FORM)$"),u=["#ff6","#a0ffff","#9f9","#f99","#f6f"],c=[],a=0,f="",l=[];this.setRegex=function(e){e=e.replace(/^[^\w]+|[^\w]+$/g,"").replace(/[^\w'-]+/g,"|"),f=new RegExp("("+e+")","i")},this.getRegex=function(){return f.toString().replace(/^\/\\b\(|\)\\b\/i$/g,"").replace(/\|/g," ")},this.hiliteWords=function(t){if(null!=t&&t&&f&&!i.test(t.nodeName)){if(t.hasChildNodes())for(var n=0;n<t.childNodes.length;n++)this.hiliteWords(t.childNodes[n]);var r,s;if(3==t.nodeType)if((r=t.nodeValue)&&(s=f.exec(r))){for(var p=t;null!=p&&"SECTION"!=p.nodeName;)p=p.parentNode;var d=e.getIndices(p),g=l.length,v=!1;for(n=0;n<g;n++)l[n].h===d.h&&l[n].v===d.v&&(v=!0);v||l.push(d),c[s[0].toLowerCase()]||(c[s[0].toLowerCase()]=u[a++%u.length]);var y=document.createElement(o);y.appendChild(document.createTextNode(s[0])),y.style.backgroundColor=c[s[0].toLowerCase()],y.style.fontStyle="inherit",y.style.color="#000";var h=t.splitText(s.index);h.nodeValue=h.nodeValue.substring(s[0].length),t.parentNode.insertBefore(y,h)}}},this.remove=function(){for(var e,t=document.getElementsByTagName(o);t.length&&(e=t[0]);)e.parentNode.replaceChild(e.firstChild,e)},this.apply=function(e){if(null!=e&&e)return this.remove(),this.setRegex(e),this.hiliteWords(r),l}}return{id:"search",init:function(n){(e=n).registerKeyboardShortcut("CTRL + Shift + F","Search"),document.addEventListener("keydown",(function(e){"F"==e.key&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),t||c(),"inline"!==t.style.display?a():f())}),!1)},open:a}}}));