MyShaarli/tpl/myShaarli/js/shaarli.min.js

2 lines
96 KiB
JavaScript
Raw Normal View History

2023-05-25 11:13:43 +02:00
/*! For license information please see shaarli.min.js.LICENSE.txt */
!function(r){var e={};function t(a){if(e[a])return e[a].exports;var o=e[a]={i:a,l:!1,exports:{}};return r[a].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=r,t.c=e,t.d=function(r,e,a){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:a})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var a=Object.create(null);if(t.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var o in r)t.d(a,o,function(e){return r[e]}.bind(null,o));return a},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=10)}([function(r,e,t){!function(){var e=function(r,t){var a=this;e.count=(e.count||0)+1,this.count=e.count,this.isOpened=!1,this.input=o(r),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("aria-expanded","false"),this.input.setAttribute("aria-owns","awesomplete_list_"+this.count),this.input.setAttribute("role","combobox"),this.options=t=t||{},function(r,e,t){for(var a in e){var o=e[a],n=r.input.getAttribute("data-"+a.toLowerCase());r[a]="number"==typeof o?parseInt(n):!1===o?null!==n:o instanceof Function?null:n,r[a]||0===r[a]||(r[a]=a in t?t[a]:o)}}(this,{minChars:2,maxItems:10,autoFirst:!1,data:e.DATA,filter:e.FILTER_CONTAINS,sort:!1!==t.sort&&e.SORT_BYLENGTH,container:e.CONTAINER,item:e.ITEM,replace:e.REPLACE,tabSelect:!1},t),this.index=-1,this.container=this.container(r),this.ul=o.create("ul",{hidden:"hidden",role:"listbox",id:"awesomplete_list_"+this.count,inside:this.container}),this.status=o.create("span",{className:"visually-hidden",role:"status","aria-live":"assertive","aria-atomic":!0,inside:this.container,textContent:0!=this.minChars?"Type "+this.minChars+" or more characters for results.":"Begin typing for results."}),this._events={input:{input:this.evaluate.bind(this),blur:this.close.bind(this,{reason:"blur"}),keydown:function(r){var e=r.keyCode;a.opened&&(13===e&&a.selected?(r.preventDefault(),a.select(void 0,void 0,r)):9===e&&a.selected&&a.tabSelect?a.select(void 0,void 0,r):27===e?a.close({reason:"esc"}):38!==e&&40!==e||(r.preventDefault(),a[38===e?"previous":"next"]()))}},form:{submit:this.close.bind(this,{reason:"submit"})},ul:{mousedown:function(r){r.preventDefault()},click:function(r){var e=r.target;if(e!==this){for(;e&&!/li/i.test(e.nodeName);)e=e.parentNode;e&&0===r.button&&(r.preventDefault(),a.select(e,r.target,r))}}}},o.bind(this.input,this._events.input),o.bind(this.input.form,this._events.form),o.bind(this.ul,this._events.ul),this.input.hasAttribute("list")?(this.list="#"+this.input.getAttribute("list"),this.input.removeAttribute("list")):this.list=this.input.getAttribute("data-list")||t.list||[],e.all.push(this)};function t(r){var e=Array.isArray(r)?{label:r[0],value:r[1]}:"object"==typeof r&&"label"in r&&"value"in r?r:{label:r,value:r};this.label=e.label||e.value,this.value=e.value}e.prototype={set list(r){if(Array.isArray(r))this._list=r;else if("string"==typeof r&&r.indexOf(",")>-1)this._list=r.split(/\s*,\s*/);else if((r=o(r))&&r.children){var e=[];a.apply(r.children).forEach((function(r){if(!r.disabled){var t=r.textContent.trim(),a=r.value||t,o=r.label||t;""!==a&&e.push({label:o,value:a})}})),this._list=e}document.activeElement===this.input&&this.evaluate()},get selected(){return this.index>-1},get opened(){return this.isOpened},close:function(r){this.opened&&(this.input.setAttribute("aria-expanded","false"),this.ul.setAttribute("hidden",""),this.isOpened=!1,this.index=-1,this.status.setAttribute("hidden",""),o.fire(this.input,"awesomplete-close",r||{}))},open:function(){this.input.setAttribute("aria-expanded","true"),this.ul.removeAttribute("hidden"),this.isOpened=!0,this.status.removeAttribute("hidden"),this.autoFirst&&-1===this.index&&this.goto(0),o.fire(this.input,"awesompl